Skip to content

Commit fd9a212

Browse files
authored
docs(readme): Describe how to import the blog database
Ref jquery/infrastructure-puppet#17
1 parent 1e02bed commit fd9a212

File tree

2 files changed

+38
-14
lines changed

2 files changed

+38
-14
lines changed

README.md

+37-13
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,45 @@ cp .env.example .env
6666
6767
7. Import the database from a production WordPress instance.
6868
69-
```sh
70-
# You need SSH admin access to this production server
71-
ssh wp-05.ops.jquery.net
72-
sudo -u tarsnap mysqldump --databases `sudo -u tarsnap mysql -B -N -e "SHOW DATABASES LIKE 'wordpress_%'"` > wordpress.sql
73-
```
69+
```sh
70+
# You need SSH admin access to this production server
71+
ssh wp-05.ops.jquery.net
7472
75-
Then, on your local machine, run:
73+
sudo -u tarsnap mysqldump --databases `sudo -u tarsnap mysql -B -N -e "SHOW DATABASES LIKE 'wordpress_%'"` > wordpress.sql
74+
```
7675
77-
```sh
78-
# Copy the SQL dump from your home directory on the server (as created by the previous command)
79-
scp wp-05.ops.jquery.net:~/wordpress.sql .
80-
# Docker root database password must match your .env file
81-
# NOTE: There must be no space between -p and the password!
82-
docker exec -i jquerydb mysql -u root -proot < wordpress.sql
83-
```
76+
Then, on your local machine, run:
77+
78+
```sh
79+
# Copy the SQL dump from your home directory on the server (as created by the previous command)
80+
# NOTE: There must be no space between -p and the password!
81+
scp wp-05.ops.jquery.net:~/wordpress.sql .
82+
docker exec -i jquerydb mysql -u root -proot < wordpress.sql
83+
```
84+
85+
Optionally, import the blog database as well. This uses a slightly different set of commands because our blogs have a shorter naming convention for their database than the doc sites. This stems from a time that the blogs were in fact native to the jquery.com site and database, and remain internally named as such.
86+
87+
```sh
88+
ssh wpblogs-01.ops.jquery.net
89+
90+
# Export wordpress_jquery, and import as wordpress_blog_jquery_com.
91+
# Use --no-create-db to omit DB name during export, so we can set expected name during import.
92+
sudo -u tarsnap mysqldump -p wordpress_jquery --no-create-db > wordpress_blog_jquery_com.sql;
93+
sudo -u tarsnap mysqldump -p wordpress_jqueryui --no-create-db > wordpress_blog_jqueryui_com.sql;
94+
sudo -u tarsnap mysqldump -p wordpress_jquerymobile --no-create-db > wordpress_blog_jquerymobile_com.sql;
95+
```
96+
97+
And then locally:
98+
99+
```sh
100+
scp wpblogs-01.ops.jquery.net:wordpress_blog_{jquery_com,jqueryui_com,jquerymobile_com}.sql .
101+
102+
echo 'CREATE DATABASE IF NOT EXISTS wordpress_blog_jquery_com; CREATE DATABASE IF NOT EXISTS wordpress_blog_jqueryui_com; CREATE DATABASE IF NOT EXISTS wordpress_blog_jquerymobile_com;' | docker exec -i jquerydb mysql -u root -proot
103+
104+
docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jquery_com < wordpress_blog_jquery_com.sql;
105+
docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jqueryui_com < wordpress_blog_jqueryui_com.sql;
106+
docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jquerymobile_com < wordpress_blog_jquerymobile_com.sql;
107+
```
84108
85109
8. Visit http://local.api.jquery.com, or https://local.api.jquery.com if you created certs.
86110

jquery-wp-content

Submodule jquery-wp-content updated 55 files

0 commit comments

Comments
 (0)