From f53c55a9b6aead1ba46880fe909140b41cd64b75 Mon Sep 17 00:00:00 2001 From: Josh Faigan Date: Fri, 29 Sep 2023 22:01:40 -0400 Subject: [PATCH] added docker swarm config --- README.md | 5 ++++- dc-ops.yml | 2 +- dc-swarm.yml | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 dc-swarm.yml diff --git a/README.md b/README.md index c12dc62..f48f68e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ ## Filling the Database - To fill the database: - - Go to base.html - Click the button that says "Fill Database" - Please note it will take a bit to complete. When it's done you'll get a message saying data filled. @@ -21,3 +20,7 @@ - `docker-compose build` - `docker-compose up` +## And DevOps! +- If you have portainer or another docker management system that allows you to use github repos, you can point to this repo and use `dc-ops.yml` to deploy the app. +### Thank you +- Thank you to @digitsgaming for the continual support with server infrastructure and deployment. \ No newline at end of file diff --git a/dc-ops.yml b/dc-ops.yml index aa08b61..c5bc590 100644 --- a/dc-ops.yml +++ b/dc-ops.yml @@ -1,4 +1,4 @@ -version: '3' +version: '3' # This is a deployment config for portainer. It pulls from the github repo. volumes: postgres_data: diff --git a/dc-swarm.yml b/dc-swarm.yml new file mode 100644 index 0000000..ada8024 --- /dev/null +++ b/dc-swarm.yml @@ -0,0 +1,54 @@ +version: '3.8' # Newer Docker Compose version. This is a deployment config for portainer with docker swarm. It pulls from the github repo. + +volumes: + postgres_data: + driver: local + +services: + postgres: + image: postgres:latest + volumes: + - postgres_data:/var/lib/postgresql/data + environment: + POSTGRES_USER: Ash + POSTGRES_PASSWORD: Ketchum + POSTGRES_DB: pokeappdb + healthcheck: + test: ["CMD-SHELL", "pg_isready -U Ash"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + + redis: + image: redis:latest + ports: + - target: 6379 + published: 6379 + protocol: tcp + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + + pokeapp: + build: . + ports: + - target: 5000 + published: 5000 + protocol: tcp + environment: + SECRET_KEY: pokemon + DATABASE_URL: postgresql://Ash:Ketchum@postgres:5432/pokeappdb + REDIS_URL: redis://redis:6379/0 + depends_on: + - postgres + - redis + command: /app/start-pokeapp.sh + deploy: + replicas: 3 + update_config: + parallelism: 1 + delay: 10s \ No newline at end of file