Service: Wordpress - EyevinnOSC/community GitHub Wiki
WordPress (serviceId wordpress-wordpress) is the open source publishing platform behind a large part of the web, for building anything from a personal blog to a full site. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance with up to 10 GiB of storage per instance. It needs a MySQL-compatible database. Source: WordPress/WordPress.
- Run a WordPress site that you configure and publish through the WordPress admin.
- Store all content, settings and users in a MySQL or MariaDB database that you control.
- Run several sites in one database by using a different table prefix (
DbTablePrefix).
Create the database first and confirm it is running: MariaDB (serviceId linuxserver-docker-mariadb) or a MySQL server hosted elsewhere. Create the admin password as a secret first and pass it as {{secrets.rootpassword}} when creating the MariaDB instance. Use describe-service-instance to read the database host and port (the TCP address).
Store the database user name and password as service secrets with create-service-secret on serviceId wordpress-wordpress (for example dbuser and dbpassword). Then call create-service-instance with serviceId: "wordpress-wordpress":
{
"name": "guide",
"DbHost": "<db-host>:<db-port>",
"DbUser": "{{secrets.dbuser}}",
"DbPassword": "{{secrets.dbpassword}}",
"DbName": "<database-name>"
}Wait for the instance to be running (wait-for-service-ready) and use describe-service-instance to get the URL. Open it to configure your WordPress site. The instance URL has the form <tenantId>-<name>.wordpress-wordpress.auto.prod-se.osaas.io.
| Option | Required | Type | Meaning |
|---|---|---|---|
| name | Yes | string | Name of the instance. Alphanumeric, at most 20 characters. |
| DbHost | Yes | string | Host of the database server: a hostname, IP address or socket path, optionally with a port such as mysql:3306. |
| DbUser | Yes | string | Database user. It needs privileges (SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER and so on) on the WordPress database, for creating tables at installation and updating the schema on upgrades. |
| DbPassword | Yes | string, sensitive | Password of the database user. |
| DbName | No | string | Name of the WordPress database. It must exist on the server, or the user must be allowed to create it. |
| DbTablePrefix | No | string | Prefix of the WordPress table names. WordPress uses wp_ (tables such as wp_posts, wp_options) when none is given. A different prefix lets several sites share one database. |
DbPassword is sensitive: use a service secret and {{secrets.NAME}} as the whole field value. Changing a secret later does not restart a running instance.
Open the instance URL and configure your site. It is recommended to put a CDN in front of the instance for accelerated delivery and a custom domain name.
In the CloudFront service in the AWS console, click "Create Distribution". Set the origin domain to <tenantId>-<name>.wordpress-wordpress.auto.prod-se.osaas.io, your instance, where <tenantId> is the id of your tenant. Set the origin protocol policy to "HTTPS only". For the viewer behavior, set "Redirect http to https" and allow all HTTP methods (GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE). For the cache settings, leave the defaults at first.
Create an Origin Request Policy WordpressStatic:
- Headers: None
- Cookies: None
- Query strings: None
Create an Origin Request Policy WordpressDynamic:
- Headers: Include
CloudFront-Is-Tablet-Viewer,CloudFront-Forwarded-Proto,CloudFront-Is-Mobile-Viewer,CloudFront-Is-Desktop-Viewer - Cookies: Include
comment_*,wordpress_*,wp-settings-* - Query strings: All
Create an Origin Request Policy WordpressDynamicAdmin:
- Headers: Include
CloudFront-Is-Tablet-Viewer,CloudFront-Forwarded-Proto,CloudFront-Is-Mobile-Viewer,CloudFront-Is-Desktop-Viewer - Cookies: All
- Query strings: All
Create a Cache Policy WordpressDynamicContent:
- Minimum, default and maximum TTL: 60
- Headers: Include
CloudFront-Is-Tablet-Viewer,CloudFront-Forwarded-Proto,CloudFront-Is-Mobile-Viewer,CloudFront-Is-Desktop-Viewer,Authorization,X-WP-Nonce - Cookies: Include
comment_*,wordpress_*,wp-settings-* - Query strings: All
Do not forward the Host header to the origin.