Skip to content

Commit 6454c50

Browse files
authored
docs(readme): document testing process for outside contributors
- these instructions are required if a user does not have access to the production databases Closes gh-6
1 parent 797cfa3 commit 6454c50

File tree

2 files changed

+115
-55
lines changed

2 files changed

+115
-55
lines changed

README.md

+114-54
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,125 @@ This repo has the necessary setup for running [jquery-wp-content](https://github
66

77
1. Clone this repo and its submodules
88

9-
```sh
10-
git clone --recursive [email protected]:jquery/jquery-wp-docker.git
11-
```
9+
```sh
10+
git clone --recursive [email protected]:jquery/jquery-wp-docker.git
11+
```
1212

13-
2. Copy the wp-config-sample.php file to wp-config.php
13+
1. Copy the wp-config-sample.php file to wp-config.php
1414

15-
```sh
16-
cp wp-config-sample.php wp-config.php
17-
```
15+
```sh
16+
cp wp-config-sample.php wp-config.php
17+
```
1818

19-
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.
19+
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.
2020

21-
```php
22-
define('AUTH_KEY', 'put your unique phrase here');
23-
define('SECURE_AUTH_KEY', 'put your unique phrase here');
24-
// etc.
25-
```
21+
```php
22+
define('AUTH_KEY', 'put your unique phrase here');
23+
define('SECURE_AUTH_KEY', 'put your unique phrase here');
24+
// etc.
25+
```
2626

27-
4. Copy .env.example to .env and edit the file to define database credentials
27+
1. Copy .env.example to .env and edit the file to define database credentials
2828

29-
```sh
30-
cp .env.example .env
31-
```
29+
```sh
30+
cp .env.example .env
31+
```
32+
33+
1. Optionally, add local SSL certs to the `ssl` directory.
34+
35+
* If you don't have any, you can generate them using [mkcert](https://github.com/FiloSottile/mkcert).
36+
Run the following:
37+
38+
```sh
39+
mkcert -install
40+
```
41+
42+
* Then, in the `ssl` directory, run:
43+
44+
```sh
45+
mkcert \
46+
local.jquery.com \
47+
local.api.jquery.com \
48+
local.blog.jquery.com \
49+
local.learn.jquery.com \
50+
local.releases.jquery.com \
51+
local.jqueryui.com \
52+
local.api.jqueryui.com \
53+
local.blog.jqueryui.com \
54+
local.jquerymobile.com \
55+
local.api.jquerymobile.com \
56+
local.blog.jquerymobile.com \
57+
local.jquery.org \
58+
local.brand.jquery.org \
59+
local.contribute.jquery.org \
60+
local.meetings.jquery.org
61+
```
62+
63+
Wildcards don't work for multi-level subdomains. Add each site to the list of domains.
64+
65+
* Rename the created certs to `cert.pem` and `cert-key.pem`.
66+
67+
1. Run `docker compose up --build` to start the containers.
68+
69+
1. Construct the database.
70+
71+
#### Outside contributors
72+
73+
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:
74+
75+
| Site | Database Name |
76+
|------|---------------|
77+
| jquery.com | wordpress_jquery_com |
78+
| api.jquery.com | wordpress_api_jquery_com |
79+
| blog.jquery.com | wordpress_blog_jquery_com |
80+
| learn.jquery.com | wordpress_learn_jquery_com |
81+
| releases.jquery.com | wordpress_releases_jquery_com |
82+
| jqueryui.com | wordpress_jqueryui_com |
83+
| api.jqueryui.com | wordpress_api_jqueryui_com |
84+
| blog.jqueryui.com | wordpress_blog_jqueryui_com |
85+
| jquerymobile.com | wordpress_jquerymobile_com |
86+
| api.jquerymobile.com | wordpress_api_jquerymobile_com |
87+
| blog.jquerymobile.com | wordpress_blog_jquerymobile_com |
88+
| jquery.org | wordpress_jquery_org |
89+
| brand.jquery.org | wordpress_brand_jquery_org |
90+
| contribute.jquery.org | wordpress_contribute_jquery_org |
91+
| meetings.jquery.org | wordpress_meetings_jquery_org |
92+
93+
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:
94+
95+
```sh
96+
'CREATE DATABASE IF NOT EXISTS wordpress_api_jquery_com;' | docker exec -i jquerydb mysql -u root -proot
97+
```
98+
99+
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.`.
100+
101+
Fill in the form with the following information:
102+
103+
- Site Title: Any (e.g., "jQuery")
104+
- Username: Any
105+
- Password: Any
106+
- Your Email: Any email address
107+
- Search Engine Visibility: Uncheck
108+
109+
Click Install WordPress.
110+
111+
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:
112+
113+
```json
114+
{
115+
"url": "http://local.api.jquery.com",
116+
"username": "dev",
117+
"password": "dev"
118+
}
119+
```
120+
121+
Replace the `url` with the site you are testing. The `dev` user is automatically created by this repo's wp-config.php.
122+
123+
After a successful deployment, visit http://local.api.jquery.com to see the site, or https://local.api.jquery.com if you created certs.
124+
125+
---
32126
33-
5. Optionally, add local SSL certs to the `ssl` directory.
34-
35-
* If you don't have any, you can generate them using [mkcert](https://github.com/FiloSottile/mkcert).
36-
Run the following:
37-
38-
```sh
39-
mkcert -install
40-
```
41-
42-
* Then, in the `ssl` directory, run:
43-
```sh
44-
mkcert \
45-
local.jquery.com \
46-
local.api.jquery.com \
47-
local.blog.jquery.com \
48-
local.learn.jquery.com \
49-
local.releases.jquery.com \
50-
local.jqueryui.com \
51-
local.api.jqueryui.com \
52-
local.blog.jqueryui.com \
53-
local.jquerymobile.com \
54-
local.api.jquerymobile.com \
55-
local.blog.jquerymobile.com \
56-
local.jquery.org \
57-
local.brand.jquery.org \
58-
local.contribute.jquery.org \
59-
local.meetings.jquery.org
60-
```
61-
Wildcards don't work for multi-level subdomains. Add each site to the list of domains.
62-
63-
* Rename the created certs to `cert.pem` and `cert-key.pem`.
64-
65-
6. Run `docker compose up --build` to start the containers.
66-
67-
7. Import the database from a production WordPress instance.
127+
#### Infrastructure team members only
68128
69129
```sh
70130
# You need SSH admin access to this production server
@@ -82,7 +142,7 @@ cp .env.example .env
82142
docker exec -i jquerydb mysql -u root -proot < wordpress.sql
83143
```
84144
85-
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.
145+
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.
86146
87147
```sh
88148
ssh wpblogs-01.ops.jquery.net
@@ -106,7 +166,7 @@ cp .env.example .env
106166
docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jquerymobile_com < wordpress_blog_jquerymobile_com.sql;
107167
```
108168
109-
8. Visit http://local.api.jquery.com, or https://local.api.jquery.com if you created certs.
169+
Then visit http://local.api.jquery.com, or https://local.api.jquery.com if you created certs.
110170
111171
## Updating
112172

0 commit comments

Comments
 (0)