Skip to content

docs(readme): document testing process for outside contributors #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 68 additions & 8 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ This repo has the necessary setup for running [jquery-wp-content](https://github
git clone --recursive git@github.com:jquery/jquery-wp-docker.git 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 ```sh
cp wp-config-sample.php wp-config.php cp wp-config-sample.php wp-config.php
``` ```


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. 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 ```php
define('AUTH_KEY', 'put your unique phrase here'); define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here'); define('SECURE_AUTH_KEY', 'put your unique phrase here');
// etc. // etc.
``` ```


4. Copy .env.example to .env and edit the file to define database credentials 1. Copy .env.example to .env and edit the file to define database credentials


```sh ```sh
cp .env.example .env cp .env.example .env
``` ```


5. Optionally, add local SSL certs to the `ssl` directory. 1. 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). * If you don't have any, you can generate them using [mkcert](https://github.com/FiloSottile/mkcert).
Run the following: Run the following:
Expand All @@ -40,6 +40,7 @@ cp .env.example .env
``` ```


* Then, in the `ssl` directory, run: * Then, in the `ssl` directory, run:

```sh ```sh
mkcert \ mkcert \
local.jquery.com \ local.jquery.com \
Expand All @@ -58,13 +59,72 @@ cp .env.example .env
local.contribute.jquery.org \ local.contribute.jquery.org \
local.meetings.jquery.org local.meetings.jquery.org
``` ```

Wildcards don't work for multi-level subdomains. Add each site to the list of domains. 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`. * Rename the created certs to `cert.pem` and `cert-key.pem`.


6. Run `docker compose up --build` to start the containers. 1. Run `docker compose up --build` to start the containers.

1. Construct the database.

#### Outside contributors

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:

| 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
```

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.`.

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.

After a successful deployment, visit http://local.api.jquery.com to see the site, or https://local.api.jquery.com if you created certs.

---


7. Import the database from a production WordPress instance. #### Infrastructure team members only


```sh ```sh
# You need SSH admin access to this production server # You need SSH admin access to this production server
Expand All @@ -82,7 +142,7 @@ cp .env.example .env
docker exec -i jquerydb mysql -u root -proot < 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 ```sh
ssh wpblogs-01.ops.jquery.net ssh wpblogs-01.ops.jquery.net
Expand All @@ -106,7 +166,7 @@ cp .env.example .env
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_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 ## Updating


Expand Down