prologic-saltyim/docs/Deployment.md

2.4 KiB

Deployment

This deployment guide assumes you are using Docker with Swarm mode. There are many other ways to deploy this which we will cover eventually, but for now Docker Swarm is fairly simple.

For other operating systems outside Linux: OpenBSD

Requirements

  • A VPS or VM publically accessible
  • A domain name
  • DNS hosted on Cloudflare
  • A cup of coffee

DNS Setup

  • Update and configure your VPS/VM how you prefer. Hardening and configuration is out of scope for this guide
  • Ensure ports 80/443(tcp) are open via IPTables or UFW, however you choose to open them
  • Visit cloudflare and point yoursalty.domain.com to the public-routable IP address of your system, ensure proxy is checked
  • Grab your API key from the Cloudflare interface, you'll need this shortly.
  • Add an SRV records for Salty service discovery:
    • Type: SRV
    • Name: yourdomain.com
    • Service: _salty
    • Protocol: TCP
    • TTL: 3600
    • Priority: 0
    • Weight: 0
    • Port: 443
    • Target: yoursalty.domain.com
  • Add an SRV records for Salty avatar discovery:
    • Type: SRV
    • Name: yourdomain.com
    • Service: _avatars
    • Protocol: TCP
    • TTL: 3600
    • Priority: 0
    • Weight: 0
    • Port: 443
    • Target: yoursalty.domain.com
  • Grab a coffee and wait a few minutes as DNS can take a bit.

Infrastructure Setup

  • Install docker on your VPS/VM
  • Create an operator user with wheel or sudo group as well as docker group
  • Execute: docker swarm init, you've now created a single node Docker Swarm Cluster
  • Execute: docker network create -d overlay traefik this will create the network needed for Traefik and Salty to communicate
  • Execute: docker stack deploy -c traefik.yml traefik this will deploy the traefik stack
  • Give Traefik a few minutes to warm up. Tail the logs with docker logs -f traefik_traefik.1.someid to ensure there are no errors
  • Execute: docker stack deploy -c salty.yml salty
  • Execute watch docker stack ps salty --no-trunc to ensure the stack comes up and reaches running state
  • Execute: docker logs -f salty_salty.1.someid to verify the service is up
  • If there are no issues, you should be able to visit: https://yoursalty.domain.com and view the PWA
  • Grab another coffee

You will find example Docker Swarm stacks (docker-compose yaml) in stacks: