Skip to content

Instantly share code, notes, and snippets.

@alxndrhi
Last active December 30, 2023 14:31
Show Gist options
  • Save alxndrhi/a2de658afb9e3e622b70de4bea24f637 to your computer and use it in GitHub Desktop.
Save alxndrhi/a2de658afb9e3e622b70de4bea24f637 to your computer and use it in GitHub Desktop.
Setup Flynn.io on DigitalOcean

Setup DigitalOcean Droplets

Create 3 new Ubuntu 16.04 Droplets (smallest tier is enough to start with)

DNS: add the IP Address of these machines to your DNS config IP 1 = flynn.example.tld IP 2 = flynn.example.tld IP 3 = flynn.example.tld *.flynn.example.tld = CNAME to flynn.example.tld

Setup on each machine:

Create a user to work with

ssh root@IP[1,2,3]
useradd -m -s /bin/bash -G sudo USERNAME
passwd USERNAME
cp -r ~/.ssh /home/USERNAME
chown -R USERNAME:USERNAME /home/USERNAME/.ssh
exit

Now login as user and continue

ssh IP[1,2,3]
sudo apt update
sudo apt upgrade
sudo touch /usr/local/bin/flynn
sudo chown USERNAME:USERNAME /usr/local/bin/flynn
L=/usr/local/bin/flynn && curl -sSL -A "`uname -sp`" https://dl.flynn.io/cli | zcat >$L && chmod +x $L
sudo bash < <(curl -fsSL https://dl.flynn.io/install-flynn)
/sbin/modprobe zfs

Seting up the Firewall

sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw allow 3000:3500/tcp
sudo ufw allow from IP1
sudo ufw allow from IP2
sudo ufw allow from IP3
sudo ufw allow in on flynnbr0
sudo ufw allow in on flannel.1
sudo ufw enable

also change ufw config and set: DEFAULT_FORWARD_POLICY to ACCEPT

sudo vim /etc/default/ufw

Only on the main machine create a discovery token:

sudo flynn-host init --init-discovery
#https://discovery.flynn.io/clusters/53e8402e-030f-4861-95ba-d5b5a91b5902

On the other nodes use the created token:

sudo flynn-host init --discovery https://discovery.flynn.io/clusters/53e8402e-030f-4861-95ba-d5b5a91b5902

Start flynn-host on all nodes

sudo systemctl start flynn-host
sudo systemctl enable flynn-host

Bootstrap the cluster

sudo \
    CLUSTER_DOMAIN=flynn.example.tld \
    flynn-host bootstrap \
    --min-hosts 3 \
    --discovery https://discovery.flynn.io/clusters/53e8402e-030f-4861-95ba-d5b5a91b5902
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment