Community Ops/Hosting Services/Migration
From MozillaWiki
Contents
Setting up Wordpress
Requirements
- Read the Quick Introduction to our infrastructure
- VPN access to our infrastructure.
- DNS for the domain is handled by Route 53 on our own AWS account. A bug will need to be filed if mozilla owns the domain (make template for bug).
- The database for the instance is in the shared RDS instance on our own AWS account. If the site is being migrated, the database may need to be migrated from the old infrastructure.
PaaS 101
- The default FQDN is going to be something like:
<app_name>.<env>.paas.mozilla.community
eg:
takebacktheweb.staging.paas.mozilla.community
To add a different FQDN, you will need to add an entry in consul.
- Add folders under the apps folder by creating the APPNAME/ key
- Inside the APPNAME folder create another folder with the environment this wordpress instance relates to (staging or production)
- Inside the environment folder create a key called haproxy-rule and set the value as the custom FQDN for the wordpress instance (eg takebacktheweb.mozilla.community)
- If the marathon app was already started before adding this value, it will need to be restarted for the changes to take effect
Note: In order to have a custom FQDN outside .paas.mozilla.community we need a way to store the information so we are using Consul's KV storage to achieve this. We are using the KV values to configure the haproxy templates and consul-template (the service responsible for haproxy autoconfiguration) iterates over keys and renders the expected outcome
WordPress
- Add entries in ansible playbook to create the required volume mountpoints
- Use the WordPress marathon template to start writing the Marathon definition for the WordPress instance.
Note: We will be using the official docker image for WordPress for these websites.
- Override settings with ENV vars. Any other instances of CHANGEME in the template should be changed.
WORDPRESS_DB_HOST: database host url (shared) WORDPRESS_DB_USER: username of the new DB user for this specific deployment WORDPRESS_DB_PASSWORD: password of the new DB user for this specific deployment WORDPRESS_DB_NAME: the name of the database to use for this specific deployment
- Deploy the app to Marathon
curl -X POST http://path/to/marathon/v2/apps -d @wordpress.json -H "Content-type: application/json"
- In Marathon, label the app with:
tags: public,<env>
Note: <env> should be either "production" or "staging"
- When site is up, make sure that sie url reflects the one that we want to use, eg:
takebacktheweb.mozilla.community
DNS
If using a custom FQDN, the DNS record for the domain should be a CNAME record pointing to the generated FQDN (eg takebacktheweb.mozilla.community would be a CNAME record for takebacktheweb.staging.paas.mozilla.community)
Setup & Connecting to MainWP
The below docs contain video/text tutorials on how to install the MainWP child plugin and add the site to our MainWP instance
- http://docs.mainwp.com/adding-a-site-to-your-mainwp/
- http://docs.mainwp.com/enabling-auto-updates-for-plugins-themes-and-wp-core-files/
- Create a new user to give to the community