Skip to content

Commit 54711ed

Browse files
committed
docs(readme): document testing process for outside contributors
- these instructions are required if a user does not have access to the production databases
1 parent 797cfa3 commit 54711ed

File tree

1 file changed

+84
-30
lines changed

1 file changed

+84
-30
lines changed

README.md

Lines changed: 84 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,47 +64,101 @@ cp .env.example .env
6464
6565
6. Run `docker compose up --build` to start the containers.
6666
67-
7. Import the database from a production WordPress instance.
67+
7. Construct the database.
68+
69+
#### All users
70+
71+
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:
72+
73+
| Site | Database Name |
74+
|------|---------------|
75+
| jquery.com | wordpress_jquery_com |
76+
| api.jquery.com | wordpress_api_jquery_com |
77+
| blog.jquery.com | wordpress_blog_jquery_com |
78+
| learn.jquery.com | wordpress_learn_jquery_com |
79+
| releases.jquery.com | wordpress_releases_jquery_com |
80+
| jqueryui.com | wordpress_jqueryui_com |
81+
| api.jqueryui.com | wordpress_api_jqueryui_com |
82+
| blog.jqueryui.com | wordpress_blog_jqueryui_com |
83+
| jquerymobile.com | wordpress_jquerymobile_com |
84+
| api.jquerymobile.com | wordpress_api_jquerymobile_com |
85+
| blog.jquerymobile.com | wordpress_blog_jquerymobile_com |
86+
| jquery.org | wordpress_jquery_org |
87+
| brand.jquery.org | wordpress_brand_jquery_org |
88+
| contribute.jquery.org | wordpress_contribute_jquery_org |
89+
| meetings.jquery.org | wordpress_meetings_jquery_org |
90+
91+
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:
6892
69-
```sh
70-
# You need SSH admin access to this production server
71-
ssh wp-05.ops.jquery.net
93+
```sh
94+
'CREATE DATABASE IF NOT EXISTS wordpress_jquery_com;' | docker exec -i jquerydb mysql -u root -proot
95+
```
96+
97+
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.`.
98+
99+
Fill in the form with the following information:
100+
101+
- Site Title: Any (e.g., "jQuery")
102+
- Username: Any
103+
- Password: Any
104+
- Your Email: Any email address
105+
- Search Engine Visibility: Uncheck
106+
107+
Click Install WordPress.
108+
109+
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:
110+
111+
```json
112+
{
113+
"url": "http://local.api.jquery.com",
114+
"username": "dev",
115+
"password": "dev"
116+
}
117+
```
118+
119+
Replace the `url` with the site you are testing. The `dev` user is automatically created by this repo's wp-config.php.
72120

73-
sudo -u tarsnap mysqldump --databases `sudo -u tarsnap mysql -B -N -e "SHOW DATABASES LIKE 'wordpress_%'"` > wordpress.sql
74-
```
121+
#### Infrastructure team members only
75122

76-
Then, on your local machine, run:
123+
```sh
124+
# You need SSH admin access to this production server
125+
ssh wp-05.ops.jquery.net
126+
127+
sudo -u tarsnap mysqldump --databases `sudo -u tarsnap mysql -B -N -e "SHOW DATABASES LIKE 'wordpress_%'"` > wordpress.sql
128+
```
77129

78-
```sh
79-
# Copy the SQL dump from your home directory on the server (as created by the previous command)
80-
# NOTE: There must be no space between -p and the password!
81-
scp -C wp-05.ops.jquery.net:~/wordpress.sql .
82-
docker exec -i jquerydb mysql -u root -proot < wordpress.sql
83-
```
130+
Then, on your local machine, run:
131+
132+
```sh
133+
# Copy the SQL dump from your home directory on the server (as created by the previous command)
134+
# NOTE: There must be no space between -p and the password!
135+
scp -C wp-05.ops.jquery.net:~/wordpress.sql .
136+
docker exec -i jquerydb mysql -u root -proot < wordpress.sql
137+
```
84138

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.
139+
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.
86140

87-
```sh
88-
ssh wpblogs-01.ops.jquery.net
141+
```sh
142+
ssh wpblogs-01.ops.jquery.net
89143
90-
# Export wordpress_jquery, and import as wordpress_blog_jquery_com.
91-
# Use --no-create-db to omit DB name during export, so we can set expected name during import.
92-
sudo -u tarsnap mysqldump -p wordpress_jquery --no-create-db > wordpress_blog_jquery_com.sql;
93-
sudo -u tarsnap mysqldump -p wordpress_jqueryui --no-create-db > wordpress_blog_jqueryui_com.sql;
94-
sudo -u tarsnap mysqldump -p wordpress_jquerymobile --no-create-db > wordpress_blog_jquerymobile_com.sql;
95-
```
144+
# Export wordpress_jquery, and import as wordpress_blog_jquery_com.
145+
# Use --no-create-db to omit DB name during export, so we can set expected name during import.
146+
sudo -u tarsnap mysqldump -p wordpress_jquery --no-create-db > wordpress_blog_jquery_com.sql;
147+
sudo -u tarsnap mysqldump -p wordpress_jqueryui --no-create-db > wordpress_blog_jqueryui_com.sql;
148+
sudo -u tarsnap mysqldump -p wordpress_jquerymobile --no-create-db > wordpress_blog_jquerymobile_com.sql;
149+
```
96150

97-
And then locally:
151+
And then locally:
98152

99-
```sh
100-
scp -C wpblogs-01.ops.jquery.net:wordpress_blog_{jquery_com,jqueryui_com,jquerymobile_com}.sql .
153+
```sh
154+
scp -C wpblogs-01.ops.jquery.net:wordpress_blog_{jquery_com,jqueryui_com,jquerymobile_com}.sql .
101155
102-
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
156+
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
103157
104-
docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jquery_com < wordpress_blog_jquery_com.sql;
105-
docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jqueryui_com < wordpress_blog_jqueryui_com.sql;
106-
docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jquerymobile_com < wordpress_blog_jquerymobile_com.sql;
107-
```
158+
docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jquery_com < wordpress_blog_jquery_com.sql;
159+
docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jqueryui_com < wordpress_blog_jqueryui_com.sql;
160+
docker exec -i jquerydb mysql -u root -proot --database wordpress_blog_jquerymobile_com < wordpress_blog_jquerymobile_com.sql;
161+
```
108162

109163
8. Visit http://local.api.jquery.com, or https://local.api.jquery.com if you created certs.
110164

0 commit comments

Comments
 (0)