mirror of
https://git.mills.io/saltyim/saltyim.git
synced 2024-06-16 11:58:24 +00:00
12fc010ce7
this changeset addresses the need for a simple docker swarm deployment and setup of dns records on cloudflare. Co-authored-by: m u t e f a l l <mutefall@noreply.mills.io> Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/167 Reviewed-by: James Mills <james@mills.io> Co-authored-by: m u t e f a l l <mutefall@noreply@mills.io> Co-committed-by: m u t e f a l l <mutefall@noreply@mills.io> |
||
---|---|---|
.. | ||
README.MD | ||
salty.yml | ||
traefik.yml |
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.
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
- Type:
- 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
- Type:
- 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
orsudo
group as well asdocker
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