Skip to content

Commit

Permalink
docs(readme): Describe how to import the blog database
Browse files Browse the repository at this point in the history
  • Loading branch information
Krinkle committed Apr 12, 2024
1 parent 1e02bed commit 076bc75
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
48 changes: 35 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,43 @@ cp .env.example .env
7. Import the database from a production WordPress instance.
```sh
# You need SSH admin access to this production server
ssh wp-05.ops.jquery.net
sudo -u tarsnap mysqldump --databases `sudo -u tarsnap mysql -B -N -e "SHOW DATABASES LIKE 'wordpress_%'"` > wordpress.sql
```
```sh
# You need SSH admin access to this production server
ssh wp-05.ops.jquery.net
Then, on your local machine, run:
sudo -u tarsnap mysqldump --databases `sudo -u tarsnap mysql -B -N -e "SHOW DATABASES LIKE 'wordpress_%'"` > wordpress.sql
```
```sh
# Copy the SQL dump from your home directory on the server (as created by the previous command)
scp wp-05.ops.jquery.net:~/wordpress.sql .
# Docker root database password must match your .env file
# NOTE: There must be no space between -p and the password!
docker exec -i jquerydb mysql -u root -proot < wordpress.sql
```
Then, on your local machine, run:
```sh
# Copy the SQL dump from your home directory on the server (as created by the previous command)
# NOTE: There must be no space between -p and the password!
scp wp-05.ops.jquery.net:~/wordpress.sql .
docker exec -i jquerydb mysql -u root -proot < wordpress.sql
```
Optionally, import the blog database as well. This uses a slightly different set of commands because blog have a shorter naming convention for their database and theme than the doc sites.
```sh
ssh wpblogs-01.ops.jquery.net
# Export wordpress_jquery, and import as wordpress_blog_jquery_com.
# Use --no-create-db to omit DB name during export, so we can set expected name during import.
sudo -u tarsnap mysqldump -p wordpress_jquery --no-create-db > wordpress_blog_jquery_com.sql
sudo -u tarsnap mysqldump -p wordpress_jqueryui --no-create-db > wordpress_blog_jqueryui_com.sql
sudo -u tarsnap mysqldump -p wordpress_jquerymobile --no-create-db > wordpress_blog_jquerymobile_com.sql
```
And then locally:
```sh
scp wpblogs-01.ops.jquery.net:wordpress_blog_jquery_com.sql .
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
docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jquery_com < wordpress_blog_jquery_com.sql; echo 'UPDATE wp_options SET option_value="blog.jquery.com" WHERE option_name="stylesheet";' | docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jquery_com
```
8. Visit http://local.api.jquery.com, or https://local.api.jquery.com if you created certs.
Expand Down

0 comments on commit 076bc75

Please sign in to comment.