Skip to content

v3.ocaml.org

mtelvers edited this page May 12, 2022 · 3 revisions

Test deployment of v3.ocaml.org to a new domain

This page describes how to deploy v3.ocaml.org to an alternative domain but can also serve as deployment notes for v3.ocaml.org.

The assumed environment is two Ubuntu 21.04 machines one running the website and the other running the Ansible script. Both machines should be accessible via SSH (tcp/22) and the website should have HTTP (tcp/80) and HTTPS (tcp/443) open. The deployment can achieved on a private network range using destination NAT to map the public IP of the the website to the internal address.

Ansible machine

Create an Ubuntu machine for Ansible.

Install Anisble using apt install ansible.

Create ~/.ssh/config to set user to root:-

Host *.example.com
  User root

Clone Git repo and update URLs

git clone https://github.com/tarides/infrastructure.git
cd infrastructure/ci.ocaml.org
sed -i 's/ocaml.org/example.com/g' hosts Caddyfile-* playbook.yml
# reset Docker image name
sed -i 's/v3.example.com-server/v3.ocaml.org-server/g' playbook.yml

Web site machine

Create machine v3a.

On the Ansible machine create an ssh key and deploy it (ssh-copy-id) to machine v3a allowing root to SSH with no password. Check this works and accept the fingerprint.

DNS

Publish DNS A record for v3a pointing to a.b.c.d Publish DNS CNAME record for v3 pointing to v3a

Deploy

ansible-playbook --limit=v3a.example.com -i hosts playbook.yml

Test

https://v3.example.com