Skip to content

Commit 90e05ec

Browse files
committed
doc: Import builder docs from private wiki
Integrate docs about building from the private wiki at https://github.com/jquery/infrastructure/wiki.
1 parent 3875671 commit 90e05ec

File tree

1 file changed

+65
-26
lines changed

1 file changed

+65
-26
lines changed

doc/wordpress.md

Lines changed: 65 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,83 @@
1-
# WordPress usage
1+
# WordPress
22

33
We run two quite different types of WordPress installations:
4+
45
* The `blogs` servers host blog.jquery.com, blog.jqueryui.com and
5-
blog.jquerymobile.com. These are edited by humans who have accounts
6-
that they use to log in to the WordPress admin interface directly.
6+
blog.jquerymobile.com. These are edited directly via the WordPress
7+
admin interface by humans who log in with their own accounts.
78
* The `docs` sites host everything else. This is a collection of
8-
about 20 sites that are directly provisioned from Git repositories
9-
using the [grunt-jquery-content] system.
9+
about 20 sites that are automatically provisioned from Git
10+
repositories using the [grunt-jquery-content] system.
1011

1112
[jquery-wp-content]: https://github.com/jquery/grunt-jquery-content/
1213

13-
All of the WordPress settings are managed by Puppet. The sites are
14-
backed by a locally running MariaDB instance.
14+
All sites have their WordPress settings managed by Puppet, and all
15+
sites are powered by a locally running MariaDB instance, and backed
16+
up daily to Tarsnap.
1517

1618
## WordPress versions
1719

18-
By default we have WordPress auto upgrades enabled. If you want to pin
19-
a specific version or to rollback to an older one, set one of these
20+
WordPress "auto upgrades" are enabled. If you want to pin
21+
a specific version or rollback to an older version, set one of these
2022
hiera keys in `common.yaml` to the version you want to use:
23+
2124
```yaml
2225
profile::wordpress::blogs::wordpress_version: ''
2326
profile::wordpress::docs::wordpress_version: ''
2427
```
2528
26-
You might need to restore the database from a backup if you had to roll
27-
back to an older version with an older database schema.
29+
You might also need to restore the database from a backup if the
30+
older version had a different database schema.
2831
29-
## Backups
32+
## Doc sites
3033
31-
We keep Tarsnap backups for the databases and (for blogs) uploads. See
32-
the [backup.md] file for details.
34+
### Builder hosts
3335
34-
[backup.md]: ./backup.md
36+
The docs sites are provisioned by the `builder` hosts. These run
37+
`node-notifier` to pick up changes to the sites and then run Grunt to
38+
perform the upgrade. All of the configuration (including user
39+
management) is handled by Puppet.
40+
41+
### Control flow
42+
43+
1. Each doc site has an associated Git repository, such as [api.jquery.com](https://github.com/jquery/api.jquery.com/).
44+
2. An [organization-wide webhook](https://github.com/organizations/jquery/settings/hooks/) notifies the `builder` and `wp` hosts of commits and published tags. The hooks are secured with secret tokens and SSL-verification.
45+
3. The `builder` hosts are provisioned with `role::docs::builder` by Puppet. Sites are defined by `docs_sites` in [hieradata/common.yaml](../hieradata/common.yaml). The builder host uses [jquery/notifier](https://github.com/jquery/node-notifier-server/) to receive these hooks. In the staging environment, sites generally build on each commit to the main branch. In production, most sites react only to semver-formatted tags.
46+
4. Upon a relevant commit or tag, a [shell script](../modules/profile/files/builder/builder-do-update.sh) is executed on the builder host, which checks out the relevant commit hash, and uses `grunt-jquery-content` to build the WordPress pages, and deployes them via WordPress RPC to the `wp` hosts.
47+
5. The `wp` hosts contain several standalone WordPress installations (Nginx, php-fpm, MariaDB). Our themes and plugins are managed in the [jquery-wp-content.git](https://github.com/jquery/jquery-wp-content) repository. Changes to jquery-wp-content are automatically deployed on every main branch commit, to both production and staging wp hosts.
48+
6. The CDN for most doc sites is Cloudflare, except for releases.jquery.com which is behind Fastly (matching code.jquery.com). See also [cdn.md](./cdn.md).
49+
50+
### Debugging builder notifier
51+
52+
To check for any system problems with the notifier that receives webhooks, or the shell script that builds and deploys the site, ssh to a builder host, and run the following command:
53+
54+
```bash
55+
# Staging : ssh builder-XX.stage.ops.jquery.net
56+
# Production : ssh builder-XX.ops.jquery.net
57+
58+
$ sudo journalctl -u notifier -f -n100
59+
60+
```
61+
62+
### Manual build
63+
64+
```bash
65+
$ ssh builder-XX.stage.ops.jquery.net
66+
$ cd /srv/builder/jquerymobile_com/
67+
$ sudo -u builder git log -1
68+
69+
$ sudo -u builder builder-do-update /srv/builder/jquerymobile_com/
70+
71+
# …
72+
# node_modules/.bin/grunt deploy
73+
# …
74+
# Running "build-posts:page" (build-posts) task
75+
# …
76+
# Running "wordpress-validate" task
77+
# …
78+
# Running "wordpress-sync" task
79+
# …
80+
```
3581

3682
## Blog sites
3783

@@ -56,16 +102,9 @@ the `wp` CLI utility:
56102
4. Log in via wp-admin, and maybe set a new password other than the
57103
randomly generated one?
58104

59-
## Doc sites
60-
61-
### Webhooks
62-
63-
There are token-secured and SSL-verified webhooks for [github.com/jquery](https://github.com/organizations/jquery/settings/hooks/) (organisztion-wide) that notify the `builder` and `wp` hosts
64-
of push events (commits and tags) to all repositories.
105+
## Backups
65106

66-
### Builder hosts
107+
We keep Tarsnap backups for the databases and (for blogs) uploads. See
108+
the [backup.md] file for details.
67109

68-
The docs sites are provisioned by the `builder` hosts. These run
69-
`node-notifier` to pick up changes to the sites and then run Grunt to
70-
perform the upgrade. All of the configuration (including user
71-
management) is handled by Puppet.
110+
[backup.md]: ./backup.md

0 commit comments

Comments
 (0)