Skip to content

Instantly share code, notes, and snippets.

@wasi
Last active May 7, 2018 15:19
Show Gist options
  • Save wasi/77154d72298307c552e79195f2f58442 to your computer and use it in GitHub Desktop.
Save wasi/77154d72298307c552e79195f2f58442 to your computer and use it in GitHub Desktop.
flynn

manual install

sudo curl -fsSL -o /tmp/install-flynn https://dl.flynn.io/install-flynn
sudo bash /tmp/install-flynn --channel nightly
sudo flynn-host init --init-discovery
sudo flynn-host init --discovery __token__
zpool create flynn-default /dev/sdb1
sudo service flynn-host start
sudo CLUSTER_DOMAIN=demo.localflynn.com flynn-host bootstrap --min-hosts 3 --discovery __token__

clean reinstall

sudo bash /tmp/install-flynn --clean --yes

add lets encrypt

flynn/flynn#1995

  • follow the instructions here: https://github.com/google/acme (you should end up with cert & key in ~/.config/acme/)
  • acme cert -manual example.com
  • then update the route for the domain
flynn route update <route-id> --tls-key ~/.config/acme/your-domain.key --tls-cert ~/.config/acme/your-domain.crt

hint: to get the route id, just call flynn route

restore

scp ~/dev/devops/flynn/current.tar root@flynn.host:~
sudo service flynn-host start
sudo flynn-host bootstrap --from-backup ~/current.tar --min-hosts 1

debug

flynn-host collect-debug-info

loose connection

flynn -a discoverd log

recover from failed host

check if flynn -a controller pg psql works. if not:

flynn-host fix

mongo restore

tar -cf mongo-latest.dump mongo/2016-xx-xx/db/
flynn mongodb restore -f latest.dump

redis

External Access:

flynn -a $(flynn env get FLYNN_REDIS) route add tcp --service $(flynn env get FLYNN_REDIS) --leader

dashboard token

flynn -a dashboard env get LOGIN_TOKEN

recalculate pin for 'flynn add cluster'

flynn/flynn#3354

http://stackoverflow.com/questions/40138413/how-to-obtain-tls-pin-from-flynn-cluster

openssl x509 -inform PEM -outform DER < cert.pem | openssl dgst -binary -sha256 | openssl base64

ufw firewall

sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw allow 3000:3500/tcp
sudo ufw allow in on flynnbr0
sudo ufw allow in on flannel.1
# redis: sudo ufw allow from xx.xx.xx.xx to any port 3397
sudo nano /etc/default/ufw # -> DEFAULT_FORWARD_POLICY=”ACCEPT”
sudo ufw enable
sudo ufw status verbose

increase slugbuilder

flynn limit set temp_disk
flynn -a APPNAME limit set slugbuilder temp_disk=1G

# or setting a global slugbuilder disk limit with:
flynn -a gitreceive env set SLUGBUILDER_DEFAULT_MEMORY_LIMIT=1G
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment