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 18, 2024
1 parent 1e02bed commit 2cf45f7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
50 changes: 37 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion jquery-wp-content
Submodule jquery-wp-content updated 55 files
+0 −4 NOTICE.txt
+0 −10 plugins/jquery-actions.php
+15 −2 plugins/jquery-filters.php
+40 −44 sites.php
+ themes/blog.jquery.com/i/favicon.ico
+0 −4 themes/blog.jquery.com/style.css
+ themes/brand.jquery.org/images/gauze.png
+1 −1 themes/brand.jquery.org/sidebar.php
+14 −40 themes/brand.jquery.org/style.css
+ themes/jquery.com/i/try-jquery.jpg
+ themes/jquery.com/i/[email protected]
+0 −2 themes/jquery.com/page.php
+2 −0 themes/jquery.com/single.php
+165 −69 themes/jquery.com/style.css
+ themes/jquery.org/images/gauze.png
+0 −50 themes/jquery.org/page-conduct.php
+0 −312 themes/jquery.org/style.css
+1 −1 themes/jquery/archive.php
+1 −0 themes/jquery/author.php
+16 −8 themes/jquery/comments.php
+5 −2 themes/jquery/content.php
+142 −709 themes/jquery/css/base.css
+8 −12 themes/jquery/footer-bottom.php
+2 −1 themes/jquery/footer-ui.php
+4 −4 themes/jquery/footer.php
+28 −19 themes/jquery/functions.php
+9 −12 themes/jquery/header.php
+44 −60 themes/jquery/image.php
+ themes/jquery/images/bg-footer-noise.jpg
+ themes/jquery/images/bullet.png
+ themes/jquery/images/gauze.png
+ themes/jquery/images/jq-global-nav.png
+2 −0 themes/jquery/index.php
+13 −7 themes/jquery/js/main.js
+0 −3 themes/jquery/js/plugins.js
+0 −281 themes/jquery/license.txt
+2 −1 themes/jquery/menu-header.php
+1 −1 themes/jquery/page-fullwidth.php
+6 −1 themes/jquery/page.php
+0 −5 themes/jquery/readme.txt
+6 −6 themes/jquery/responsive.html
+31 −0 themes/jquery/sidebar-blogpost.php
+0 −38 themes/jquery/sidebar-footer.php
+0 −22 themes/jquery/sidebar-page.php
+5 −0 themes/jquery/sidebar.php
+29 −0 themes/jquery/single-blogpost.php
+1 −1 themes/jquerymobile.com/footer.php
+0 −2 themes/jquerymobile.com/page.php
+2 −0 themes/jquerymobile.com/single.php
+1 −1 themes/jqueryui.com/footer.php
+7 −1 themes/jqueryui.com/sidebar.php
+2 −0 themes/jqueryui.com/single.php
+4 −1 themes/jqueryui.com/style.css
+4 −3 themes/learn.jquery.com/style.css
+1 −1 themes/releases.jquery.com/style.css

0 comments on commit 2cf45f7

Please sign in to comment.