- Point domain to
ns1.digitalocean.com
,ns2.digitalocean.com
andns3.digitalocean.com
- Go to the Network tab in DO and add the domain.
- Create a Droplet and select the following:
- Use the Mexico image.
- Select the $20 tier.
- Select the closest data center to the country the site is intented for.
- Select "Private networking".
- Select "Enable monitoring"
- Add your public key (probably already in the image if you're on the core team).
- Give it a hostname "coronastatus-[country]".
- Go back to the network tab and select the domain.
- Add an
A
record:@
>Select the Droplet
- Add a
CNAME
record:dev
>@
- Add a
CNAME
record:www
>@
- Add an
- ssh into the machine:
ssh app@[ip-of-droplet]
- Rename Mexican directory names to the correct name
- Rename
/srv/coronastatus.mx/
to/srv/coronastatus.[tld]
- Rename
/srv/dev.coronastatus.mx/
to/srv/dev.coronastatus.[tld]
- Edit line in
/srv/scripts/deploy-prod.sh
to the same directory as step 6a. - Edit line in
srv/scripts/deploy-dev.sh
to the same directory as step 6b.
- Rename
- Change the nginx virtual host configurations
- Rename
/etc/nginx/sites-available/coronastatus.mx
to/etc/nginx/sites-available/coronastatus.[tld]
- Rename
/etc/nginx/sites-available/dev.coronastatus.mx
to/etc/nginx/sites-available/dev.coronastatus.[tld]
- Edit server name line in
/etc/nginx/sites-available/coronastatus.[tld]
tocoronastatus.[tld] www.coronastatus.[tld]
- Edit server name line in
/etc/nginx/sites-available/dev.coronastatus.[tld]
todev.coronastatus.[tld]
- Remove (
rm
) the symlinks in/etc/nginx/sites-enabled/*
- Add new symlink to new virtual host
ln -s /etc/nginx/sites-available/coronastatus.[tld] /etc/nginx/sites-enabled/coronastatus.[tld]
- Add new symlink to new virtual host
ln -s /etc/nginx/sites-available/dev.coronastatus.[tld] /etc/nginx/sites-enabled/dev.coronastatus.[tld]
- Reload nginx by running
sudo service nginx reload
- Run certbot
sudo certbot --nginx
, select all, and enable redirect from http to https. - If step above fails the DNS records are probably incorrect. Double check with domain owner.
- Rename
- Change the systemd script to point to correct directory (we don't rename the systemd job for easier deployments).
- Edit
/etc/systemd/system/coronastatusnl.servce
and change the name tocoronastatus.[tld] app
- Edit
/etc/systemd/system/coronastatusnl.servce
and change workspacce directory to/srv/coronastatus.[tld]
- Reload systemd by running
sudo systemctl daemon-reload
- Edit
- Update the config for the site
- Edit
/srv/coronastatus.[tld]/config.json
with the correct config values - Delete or move the
/srv/coronastatus.[tld]/covid_db*
files to somewhere else. - Deploy the latest version by running
/srv/scripts/deploy-prod.sh
- Try to start the server outside of systemd to check that it boots:
yarn start
- Confirm that the site works correctly by visiting `https://coronastatus.[tld]
- Edit
- Add the domain to the
ops/deploy-prod-all.sh
script.