Ga naar inhoud

πŸ‡¬πŸ‡§ Installing Trellis on remote servers

TOC

Follow these steps

  1. Install Ubuntu
  2. Setup SSH access
  3. Configure wordpress_sites and vault
  4. Provision with Trellis
  5. Deploy with Trellis
  6. Install WordPress

1. Install Ubuntu

Start with a stock Ubuntu 18.04 LTS

Everything default, except:

  • location: Other -> Europe -> Netherlands
  • hostname: client-production or client-staging (e.g. fitchef-production)
  • realname: Client company name
  • username: client-name
  • password: [generated random password]
  • Partition disks: Guided - use entire disk and setup LVM
  • Updates: Automatic security updates
  • Software selection: standard system utilities + OpenSSH server

2. Setup SSH access

Logged in to the just set up server as the user according to the given username.

Terminal window
`mkdir .ssh && chmod 700 .ssh/ && cd .ssh/
vi authorized_keys
chmod 600 authorized_keys`

Paste public key Mac: public key of local vagrant cat ~/.ssh/id_rsa.pub

Windows: public key of local vagrant VM. In running VM cat ~/.ssh/id_rsa.pub

Verify that you can login to the server with SSH.


3. Configure wordpress_sites and vault

Trellis uses ansible-vault to securely store passwords.

Please make sure the following files are up to par:

  • group_vars/production/wordpress_sites.yml
  • group_vars/production/vault.yml

Make sure the vault_users password is set to the admin_user’s sudo password.


4. Provision with Trellis

  • Update IP address to point to the right server in trellis/hosts/[environment]
  • Run these commands from the trellis root folder. (Note: Windows users run this from the VM)
Terminal window
ansible-galaxy install -r requirements.yml
ansible-playbook server.yml -e env=production
  • Exit the server (exit)

5. Deploy with Trellis

Requirements:

  • GitLab account with SSH access

  • On Mac:

Terminal window
ssh-add -K
  • Deploy website:
Terminal window
./bin/deploy.sh [environment] [domain name]

This leaves you with a provisioned server. πŸ’ͺ


6. Install WordPress

Visit the domain and complete the WordPress installation.


Optionally you can use WP DB Migrate Pro or WP CLI to migrate the database and media files from your test environment to production.