From 54711edfb7ac4ff13ff81aa6d9ea62e94fdb6b43 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Tue, 9 Jul 2024 11:48:18 -0400 Subject: [PATCH 1/5] docs(readme): document testing process for outside contributors - these instructions are required if a user does not have access to the production databases --- README.md | 114 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 84 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 2075eed..2a573a2 100644 --- a/README.md +++ b/README.md @@ -64,47 +64,101 @@ cp .env.example .env 6. Run `docker compose up --build` to start the containers. -7. Import the database from a production WordPress instance. +7. Construct the database. + +#### All users + +You do not need to be an infrastructure team member to test jQuery websites. Each site can be deployed after installing wordpress locally, but the database for that site needs to be created first. The database name for each site is listed below: + +| Site | Database Name | +|------|---------------| +| jquery.com | wordpress_jquery_com | +| api.jquery.com | wordpress_api_jquery_com | +| blog.jquery.com | wordpress_blog_jquery_com | +| learn.jquery.com | wordpress_learn_jquery_com | +| releases.jquery.com | wordpress_releases_jquery_com | +| jqueryui.com | wordpress_jqueryui_com | +| api.jqueryui.com | wordpress_api_jqueryui_com | +| blog.jqueryui.com | wordpress_blog_jqueryui_com | +| jquerymobile.com | wordpress_jquerymobile_com | +| api.jquerymobile.com | wordpress_api_jquerymobile_com | +| blog.jquerymobile.com | wordpress_blog_jquerymobile_com | +| jquery.org | wordpress_jquery_org | +| brand.jquery.org | wordpress_brand_jquery_org | +| contribute.jquery.org | wordpress_contribute_jquery_org | +| meetings.jquery.org | wordpress_meetings_jquery_org | + +Select the corresponding database name from the table above for the site you wish to test and run the following command to create the database: - ```sh - # You need SSH admin access to this production server - ssh wp-05.ops.jquery.net +```sh +'CREATE DATABASE IF NOT EXISTS wordpress_jquery_com;' | docker exec -i jquerydb mysql -u root -proot +``` + +Then, visit the local site in your browser to complete the WordPress installation, such as http://local.api.jquery.com/wp-admin/install.php. Make sure the address begins with `local.`. + +Fill in the form with the following information: + +- Site Title: Any (e.g., "jQuery") +- Username: Any +- Password: Any +- Your Email: Any email address +- Search Engine Visibility: Uncheck + +Click Install WordPress. + +You should now be able to run `grunt deploy` from the corresponding jQuery site repo. Make sure the repo has a `config.json` with the following: + +```json +{ + "url": "http://local.api.jquery.com", + "username": "dev", + "password": "dev" +} +``` + +Replace the `url` with the site you are testing. The `dev` user is automatically created by this repo's wp-config.php. - sudo -u tarsnap mysqldump --databases `sudo -u tarsnap mysql -B -N -e "SHOW DATABASES LIKE 'wordpress_%'"` > wordpress.sql - ``` +#### Infrastructure team members only - Then, on your local machine, run: +```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 - # 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 -C wp-05.ops.jquery.net:~/wordpress.sql . - 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 -C 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. +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 databases 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 +```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; - ``` +# 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: +And then locally: - ```sh - scp -C wpblogs-01.ops.jquery.net:wordpress_blog_{jquery_com,jqueryui_com,jquerymobile_com}.sql . +```sh +scp -C 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 +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; - ``` +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. From c7cd7338905bf12d045651050c72dc2b2b40033c Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Tue, 9 Jul 2024 11:51:26 -0400 Subject: [PATCH 2/5] fixup! keep examples consistently about api --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a573a2..f90f124 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ You do not need to be an infrastructure team member to test jQuery websites. Eac Select the corresponding database name from the table above for the site you wish to test and run the following command to create the database: ```sh -'CREATE DATABASE IF NOT EXISTS wordpress_jquery_com;' | docker exec -i jquerydb mysql -u root -proot +'CREATE DATABASE IF NOT EXISTS wordpress_api_jquery_com;' | docker exec -i jquerydb mysql -u root -proot ``` Then, visit the local site in your browser to complete the WordPress installation, such as http://local.api.jquery.com/wp-admin/install.php. Make sure the address begins with `local.`. From c61348eeffb9b53895ebe546676c4c1fb092989f Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Tue, 9 Jul 2024 14:04:27 -0400 Subject: [PATCH 3/5] fixup! remove dangling step 8 --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f90f124..43fb13c 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ cp .env.example .env 7. Construct the database. -#### All users +### Outside contributors You do not need to be an infrastructure team member to test jQuery websites. Each site can be deployed after installing wordpress locally, but the database for that site needs to be created first. The database name for each site is listed below: @@ -118,7 +118,9 @@ You should now be able to run `grunt deploy` from the corresponding jQuery site Replace the `url` with the site you are testing. The `dev` user is automatically created by this repo's wp-config.php. -#### Infrastructure team members only +After a successful deployment, visit http://local.api.jquery.com to see the site, or https://local.api.jquery.com if you created certs. + +### Infrastructure team members only ```sh # You need SSH admin access to this production server @@ -160,7 +162,7 @@ docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jqueryui_ 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. +Then visit http://local.api.jquery.com, or https://local.api.jquery.com if you created certs. ## Updating From 69cb14f15ef13ee38f2d063015f97c5b71a34597 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Tue, 9 Jul 2024 15:22:28 -0400 Subject: [PATCH 4/5] fixup! use auto-numbering for ol list --- README.md | 262 +++++++++++++++++++++++++++--------------------------- 1 file changed, 133 insertions(+), 129 deletions(-) diff --git a/README.md b/README.md index 43fb13c..97adf30 100644 --- a/README.md +++ b/README.md @@ -6,163 +6,167 @@ This repo has the necessary setup for running [jquery-wp-content](https://github 1. Clone this repo and its submodules -```sh -git clone --recursive git@github.com:jquery/jquery-wp-docker.git -``` + ```sh + git clone --recursive git@github.com:jquery/jquery-wp-docker.git + ``` -2. Copy the wp-config-sample.php file to wp-config.php +1. Copy the wp-config-sample.php file to wp-config.php -```sh -cp wp-config-sample.php wp-config.php -``` + ```sh + cp wp-config-sample.php wp-config.php + ``` + +1. Edit the wp-config.php file and set unique keys and salts using https://api.wordpress.org/secret-key/1.1/salt/. Do NOT change the `DB_` defines. + + ```php + define('AUTH_KEY', 'put your unique phrase here'); + define('SECURE_AUTH_KEY', 'put your unique phrase here'); + // etc. + ``` -3. Edit the wp-config.php file and set unique keys and salts using https://api.wordpress.org/secret-key/1.1/salt/. Do NOT change the `DB_` defines. +1. Copy .env.example to .env and edit the file to define database credentials -```php -define('AUTH_KEY', 'put your unique phrase here'); -define('SECURE_AUTH_KEY', 'put your unique phrase here'); -// etc. -``` + ```sh + cp .env.example .env + ``` -4. Copy .env.example to .env and edit the file to define database credentials +1. Optionally, add local SSL certs to the `ssl` directory. -```sh -cp .env.example .env -``` + * If you don't have any, you can generate them using [mkcert](https://github.com/FiloSottile/mkcert). + Run the following: -5. Optionally, add local SSL certs to the `ssl` directory. - - * If you don't have any, you can generate them using [mkcert](https://github.com/FiloSottile/mkcert). - Run the following: - - ```sh - mkcert -install - ``` - - * Then, in the `ssl` directory, run: - ```sh - mkcert \ - local.jquery.com \ - local.api.jquery.com \ - local.blog.jquery.com \ - local.learn.jquery.com \ - local.releases.jquery.com \ - local.jqueryui.com \ - local.api.jqueryui.com \ - local.blog.jqueryui.com \ - local.jquerymobile.com \ - local.api.jquerymobile.com \ - local.blog.jquerymobile.com \ - local.jquery.org \ - local.brand.jquery.org \ - local.contribute.jquery.org \ - local.meetings.jquery.org - ``` - Wildcards don't work for multi-level subdomains. Add each site to the list of domains. - - * Rename the created certs to `cert.pem` and `cert-key.pem`. - -6. Run `docker compose up --build` to start the containers. - -7. Construct the database. - -### Outside contributors - -You do not need to be an infrastructure team member to test jQuery websites. Each site can be deployed after installing wordpress locally, but the database for that site needs to be created first. The database name for each site is listed below: - -| Site | Database Name | -|------|---------------| -| jquery.com | wordpress_jquery_com | -| api.jquery.com | wordpress_api_jquery_com | -| blog.jquery.com | wordpress_blog_jquery_com | -| learn.jquery.com | wordpress_learn_jquery_com | -| releases.jquery.com | wordpress_releases_jquery_com | -| jqueryui.com | wordpress_jqueryui_com | -| api.jqueryui.com | wordpress_api_jqueryui_com | -| blog.jqueryui.com | wordpress_blog_jqueryui_com | -| jquerymobile.com | wordpress_jquerymobile_com | -| api.jquerymobile.com | wordpress_api_jquerymobile_com | -| blog.jquerymobile.com | wordpress_blog_jquerymobile_com | -| jquery.org | wordpress_jquery_org | -| brand.jquery.org | wordpress_brand_jquery_org | -| contribute.jquery.org | wordpress_contribute_jquery_org | -| meetings.jquery.org | wordpress_meetings_jquery_org | - -Select the corresponding database name from the table above for the site you wish to test and run the following command to create the database: - -```sh -'CREATE DATABASE IF NOT EXISTS wordpress_api_jquery_com;' | docker exec -i jquerydb mysql -u root -proot -``` + ```sh + mkcert -install + ``` -Then, visit the local site in your browser to complete the WordPress installation, such as http://local.api.jquery.com/wp-admin/install.php. Make sure the address begins with `local.`. + * Then, in the `ssl` directory, run: -Fill in the form with the following information: + ```sh + mkcert \ + local.jquery.com \ + local.api.jquery.com \ + local.blog.jquery.com \ + local.learn.jquery.com \ + local.releases.jquery.com \ + local.jqueryui.com \ + local.api.jqueryui.com \ + local.blog.jqueryui.com \ + local.jquerymobile.com \ + local.api.jquerymobile.com \ + local.blog.jquerymobile.com \ + local.jquery.org \ + local.brand.jquery.org \ + local.contribute.jquery.org \ + local.meetings.jquery.org + ``` -- Site Title: Any (e.g., "jQuery") -- Username: Any -- Password: Any -- Your Email: Any email address -- Search Engine Visibility: Uncheck + Wildcards don't work for multi-level subdomains. Add each site to the list of domains. -Click Install WordPress. + * Rename the created certs to `cert.pem` and `cert-key.pem`. -You should now be able to run `grunt deploy` from the corresponding jQuery site repo. Make sure the repo has a `config.json` with the following: +1. Run `docker compose up --build` to start the containers. -```json -{ - "url": "http://local.api.jquery.com", - "username": "dev", - "password": "dev" -} -``` +1. Construct the database. -Replace the `url` with the site you are testing. The `dev` user is automatically created by this repo's wp-config.php. + #### Outside contributors -After a successful deployment, visit http://local.api.jquery.com to see the site, or https://local.api.jquery.com if you created certs. + You do not need to be on the jQuery Infrastructure Team to test jQuery websites. Each site can be deployed after installing wordpress locally, but the database for that site needs to be created first. The database name for each site is listed below: -### Infrastructure team members only + | Site | Database Name | + |------|---------------| + | jquery.com | wordpress_jquery_com | + | api.jquery.com | wordpress_api_jquery_com | + | blog.jquery.com | wordpress_blog_jquery_com | + | learn.jquery.com | wordpress_learn_jquery_com | + | releases.jquery.com | wordpress_releases_jquery_com | + | jqueryui.com | wordpress_jqueryui_com | + | api.jqueryui.com | wordpress_api_jqueryui_com | + | blog.jqueryui.com | wordpress_blog_jqueryui_com | + | jquerymobile.com | wordpress_jquerymobile_com | + | api.jquerymobile.com | wordpress_api_jquerymobile_com | + | blog.jquerymobile.com | wordpress_blog_jquerymobile_com | + | jquery.org | wordpress_jquery_org | + | brand.jquery.org | wordpress_brand_jquery_org | + | contribute.jquery.org | wordpress_contribute_jquery_org | + | meetings.jquery.org | wordpress_meetings_jquery_org | -```sh -# You need SSH admin access to this production server -ssh wp-05.ops.jquery.net + Select the corresponding database name from the table above for the site you wish to test and run the following command to create the database: -sudo -u tarsnap mysqldump --databases `sudo -u tarsnap mysql -B -N -e "SHOW DATABASES LIKE 'wordpress_%'"` > wordpress.sql -``` + ```sh + 'CREATE DATABASE IF NOT EXISTS wordpress_api_jquery_com;' | docker exec -i jquerydb mysql -u root -proot + ``` -Then, on your local machine, run: + Then, finish installing WordPress by visiting the appropriate install URL for that site, such as http://local.api.jquery.com/wp-admin/install.php. Make sure the address begins with `local.`. -```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 -C wp-05.ops.jquery.net:~/wordpress.sql . -docker exec -i jquerydb mysql -u root -proot < wordpress.sql -``` + Fill in the form with the following information: -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 databases 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. + - Site Title: Any (e.g., "jQuery") + - Username: Any + - Password: Any + - Your Email: Any email address + - Search Engine Visibility: Uncheck -```sh -ssh wpblogs-01.ops.jquery.net + Click Install WordPress. -# 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; -``` + You should now be able to run `grunt deploy` from the corresponding jQuery site repo. Make sure the repo has a `config.json` with the following: -And then locally: + ```json + { + "url": "http://local.api.jquery.com", + "username": "dev", + "password": "dev" + } + ``` -```sh -scp -C wpblogs-01.ops.jquery.net:wordpress_blog_{jquery_com,jqueryui_com,jquerymobile_com}.sql . + Replace the `url` with the site you are testing. The `dev` user is automatically created by this repo's wp-config.php. -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 + After a successful deployment, visit http://local.api.jquery.com to see the site, or https://local.api.jquery.com if you created certs. -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; -``` + --- + + #### Infrastructure team members only + + ```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 + ``` + + 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 -C 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 databases 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 -C 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; + ``` -Then visit http://local.api.jquery.com, or https://local.api.jquery.com if you created certs. + Then visit http://local.api.jquery.com, or https://local.api.jquery.com if you created certs. ## Updating From d38f309c10eb605de2d2549028876bfe2d4a9046 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Tue, 9 Jul 2024 15:35:17 -0400 Subject: [PATCH 5/5] fixup! update jquery-wp-content --- jquery-wp-content | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery-wp-content b/jquery-wp-content index 9e69788..7c1d367 160000 --- a/jquery-wp-content +++ b/jquery-wp-content @@ -1 +1 @@ -Subproject commit 9e697881ae276b391d976d31a8c5f5184fd085fc +Subproject commit 7c1d367730142174b6d00ef76a4e0480e6e95a96