From 6e7512de0d2a4f73f16a1941b5d252d63a54182e Mon Sep 17 00:00:00 2001 From: 3wc <3wc.git@doesthisthing.work> Date: Fri, 11 Sep 2020 12:34:07 +0200 Subject: [PATCH] Initial import --- .envrc.sample | 3 ++ .gitignore | 1 + README.md | 18 +++++++++ compose.yml | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+) create mode 100644 .envrc.sample create mode 100644 .gitignore create mode 100644 README.md create mode 100644 compose.yml diff --git a/.envrc.sample b/.envrc.sample new file mode 100644 index 0000000..c0786bb --- /dev/null +++ b/.envrc.sample @@ -0,0 +1,3 @@ +export DOMAIN=swarmpit.example.com +export STACK_NAME=swarmpit +export LETS_ENCRYPT_ENV=production diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..37b52cc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.envrc diff --git a/README.md b/README.md new file mode 100644 index 0000000..a89fc44 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +Swarmpit +--- + +[Swarmpit][swarmpit] Docker swarm dashboard, based on the ["Docker Swarm Rocks" compose file][swarm-rocks-swarmpit]. + +1. Set up Docker Swarm and [`abra`][abra] +2. Deploy [`compose-stacks/traefik`][compose-traefik] +3. `cp .envrc.sample .envrc` +4. Edit `.envrc` - be sure to change `$DOMAIN` to something that resolves to + your Docker swarm box +5. `direnv allow` (or `. .envrc`) +6. `abra deploy` +7. Log into the web interface to create an initial user + +[swarmpit]: https://swarmpit.io/ +[swarm-rocks-swarmpit]: https://dockerswarm.rocks/swarmpit/ +[abra]: https://git.autonomic.zone/autonomic-cooperative/abra +[compose-traefik]: https://git.autonomic.zone/compose-stacks/traefik diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..2f17002 --- /dev/null +++ b/compose.yml @@ -0,0 +1,101 @@ +version: '3.3' + +services: + app: + image: swarmpit/swarmpit:latest + environment: + - SWARMPIT_DB=http://db:5984 + - SWARMPIT_INFLUXDB=http://influxdb:8086 + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + networks: + - net + - proxy + deploy: + resources: + limits: + cpus: '0.50' + memory: 1024M + reservations: + cpus: '0.25' + memory: 512M + placement: + constraints: + - node.role == manager + labels: + - traefik.enable=true + - traefik.docker.network=proxy + #- traefik.constraint-label=proxy + - traefik.http.routers.${STACK_NAME}-http.rule=Host(`${DOMAIN?Variable not set}`) + - traefik.http.routers.${STACK_NAME}-http.entrypoints=web + - traefik.http.routers.${STACK_NAME}-http.middlewares=https-redirect + - traefik.http.routers.${STACK_NAME}-https.rule=Host(`${DOMAIN?Variable not set}`) + - traefik.http.routers.${STACK_NAME}-https.entrypoints=web-secure + - traefik.http.routers.${STACK_NAME}-https.tls=true + - traefik.http.routers.${STACK_NAME}-https.tls.certresolver=${LETS_ENCRYPT_ENV} + - traefik.http.services.${STACK_NAME}.loadbalancer.server.port=8080 + + db: + image: couchdb:2.3.0 + volumes: + - db-data:/opt/couchdb/data + networks: + - net + deploy: + resources: + limits: + cpus: '0.30' + memory: 512M + reservations: + cpus: '0.15' + memory: 256M + #placement: + # constraints: + # - node.labels.swarmpit.db-data == true + influxdb: + image: influxdb:1.7 + volumes: + - influx-data:/var/lib/influxdb + networks: + - net + deploy: + resources: + reservations: + cpus: '0.3' + memory: 128M + limits: + cpus: '0.6' + memory: 512M + #placement: + # constraints: + # - node.labels.swarmpit.influx-data == true + agent: + image: swarmpit/agent:latest + environment: + - DOCKER_API_VERSION=1.35 + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + networks: + - net + deploy: + mode: global + resources: + limits: + cpus: '0.10' + memory: 64M + reservations: + cpus: '0.05' + memory: 32M + +networks: + net: + driver: overlay + attachable: true + proxy: + external: true + +volumes: + db-data: + driver: local + influx-data: + driver: local