DigitalOcean is a cloud infrastructure provider that offers virtual servers called droplets starting at $5/month that can handle most normal WordPress sites when provisioned with Trellis.
To provision a server, Trellis requires a server running a bare/stock version of Ubuntu 18.04 LTS (Bionic Beaver). When logged into DigitalOcean, create a new droplet and select the Ubuntu 18.04 option.
ℹ️ If you signup for DigitalOcean through our referral link you will receive a free $100 in credit for 2 months!
While creating a droplet you have the option to include SSH keys that are attached to your DigitalOcean account. Make sure your SSH key is included here so that the Ansible can connect to the droplet during provisioning.
You should already have installed Trellis locally and configured your WordPress site. Make sure to go ahead and enable SSL/Let’s Encrypt if you’re going to be using it. Let’s Encrypt integration requires that the canonical hosts for your sites (
www.example.com by default) to have DNS that points to your new droplet.
You might also want to setup a floating IP from the Networking area in DigitalOcean. This will allow you to create new droplets and switch them over to your static floating IP address without any downtime.
hosts/production and replace
your_server_hostname with the floating IP address you assigned to your new droplet.
[production] 188.8.131.52 [web] 184.108.40.206
Provisioning DigitalOcean droplet
At this point you can now provision your new droplet. From your Trellis directory:
$ ansible-playbook server.yml -e env=production
When you see the following message, enter
yes to continue:
TASK [connection : Check whether Ansible can connect as root] ********************************************************** The authenticity of host '220.127.116.11 (18.104.22.168)' can't be established. ED25519 key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. Are you sure you want to continue connecting (yes/no)?
The remote server playbook will run and provision your droplet with PHP 7.3, Nginx, and everything else included in Trellis.
Deploying to DigitalOcean droplet
Once your server is provisioned you’ll want to perform the first deploy. If you try to visit your site before deploying you’ll see a server 500 error. From your Trellis directory:
./bin/deploy.sh production example.com
After the first deploy is done, you can now either install WordPress by visiting the site or even import an existing database.