From fd9a2125d57e74e4de8853c41cb3a92b708bda7b Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 19 Apr 2024 16:12:28 +0100 Subject: [PATCH] docs(readme): Describe how to import the blog database Ref https://github.com/jquery/infrastructure-puppet/issues/17 --- README.md | 50 +++++++++++++++++++++++++++++++++++------------ jquery-wp-content | 2 +- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 103b48f..50665d4 100644 --- a/README.md +++ b/README.md @@ -66,21 +66,45 @@ 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 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. + + ```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,jqueryui_com,jquerymobile_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; + docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jqueryui_com < wordpress_blog_jqueryui_com.sql; + docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jquerymobile_com < wordpress_blog_jquerymobile_com.sql; + ``` 8. Visit http://local.api.jquery.com, or https://local.api.jquery.com if you created certs. diff --git a/jquery-wp-content b/jquery-wp-content index 504ae80..b12072b 160000 --- a/jquery-wp-content +++ b/jquery-wp-content @@ -1 +1 @@ -Subproject commit 504ae8029c84930e5ca8c165832c4b46b14cff58 +Subproject commit b12072b0bfb35f76375b1b5eb0cde867ca1f4ebe