{"id":29480880,"url":"https://github.com/gogolivan/docker-swarm-stacks","last_synced_at":"2025-07-14T23:11:54.311Z","repository":{"id":304670670,"uuid":"1007631495","full_name":"gogolivan/docker-swarm-stacks","owner":"gogolivan","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-14T13:44:49.000Z","size":82,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-14T17:36:13.254Z","etag":null,"topics":["docker-swarm","grafana","grafana-loki","grafana-tempo","kafka","keycloak","localstack","mongodb","n8n","portainer","postgres","prometheus","redis","temporal","terraform","traefik"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gogolivan.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-24T09:39:20.000Z","updated_at":"2025-07-06T21:46:34.000Z","dependencies_parsed_at":"2025-07-14T17:36:38.918Z","dependency_job_id":"f9eda75b-ec53-4037-ab4c-178af0734fcc","html_url":"https://github.com/gogolivan/docker-swarm-stacks","commit_stats":null,"previous_names":["gogolivan/docker-swarm-stacks"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/gogolivan/docker-swarm-stacks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogolivan%2Fdocker-swarm-stacks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogolivan%2Fdocker-swarm-stacks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogolivan%2Fdocker-swarm-stacks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogolivan%2Fdocker-swarm-stacks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gogolivan","download_url":"https://codeload.github.com/gogolivan/docker-swarm-stacks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogolivan%2Fdocker-swarm-stacks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265366219,"owners_count":23753474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-swarm","grafana","grafana-loki","grafana-tempo","kafka","keycloak","localstack","mongodb","n8n","portainer","postgres","prometheus","redis","temporal","terraform","traefik"],"created_at":"2025-07-14T23:11:46.403Z","updated_at":"2025-07-14T23:11:54.301Z","avatar_url":"https://github.com/gogolivan.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Docker Swarm Stacks\n:toc:\n:toclevels: 2\n\nThis project is intended to help developers quickly deploy backing services commonly used during the development cycle.\n\nIt contains *Terraform* modules for deploying *Docker* stacks into a *Swarm* cluster. See \u003c\u003cautomated-setup\u003e\u003e\n\nIt is always possible to run all stacks manually using the `docker stack deploy` command. See \u003c\u003cmanual-setup\u003e\u003e.\n\n== Prerequisites\n\n- https://www.docker.com/[Docker]\n\n- https://developer.hashicorp.com/terraform[Terraform]\n\n- https://aws.amazon.com/cli/[AWS CLI]\n\n- https://go.dev/[Go]\n\n\n[source, text, title=~/.aws/config]\n----\n[profile localstack]\nregion=us-east-1\noutput=json\nendpoint_url = http://localhost:4566\n----\n\n[source, text, title=~/.aws/credentials]\n----\n[localstack]\naws_access_key_id=test\naws_secret_access_key=test\n----\n\n=== Recommendations\n==== Plugins\n===== IntelliJ IDEA\n- https://plugins.jetbrains.com/plugin/7808-terraform-and-hcl[Terraform and HCL]\n- https://plugins.jetbrains.com/bundles/5-go-bundle[Go bundle]\n\n===== Visual Studio Code\n- https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker[Docker]\n- https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform[HashiCorp Terraform]\n- https://marketplace.visualstudio.com/items?itemName=golang.Go[Go]\n\n== Getting started\n[source,shell]\n----\ndocker swarm init --task-history-limit=0\n----\n\n[[automated-setup]]\n== Automated Setup\n\nUse Terraform to provision Docker Swarm cluster, deploy stacks, and manage resources.\n\nService deployments and replica counts are controlled dynamically using the *Terraform* `replicas` map\nvariable, defined in link:variables.tf[`variables.tf`], which specifies how many instances of each service should run.\n\n[source,shell]\n----\nterraform init\n----\n\n=== Plan\n\n[source,shell]\n----\nterraform plan\n----\n\n=== Deploy\n\n[source,shell]\n----\nterraform apply\n----\n\n=== Destroy\n\n[source,shell]\n----\nterraform destroy\n----\n\n[IMPORTANT]\n====\nThe default configuration contains placeholder values.\nCreate a *variables.tfvars* file to override these with real secrets for not local deployment.\n====\n\n=== Modules\n==== Docker Swarm Stack\nManages _Docker Stack_ deployment with secrets and dynamic service replicas.\n\n_Terraform_ resource updates relies on the stack _Compose_ file or stack config change.\n\n[[manual-setup]]\n== Manual Setup\n\nManually provision Docker Swarm cluster and manage resources. See \u003c\u003cstacks\u003e\u003e.\n\nThe required number of service instances must be configured using environment variables.\n\n[[stacks]]\n== Stacks\n\n.Stacks\n[frame=none,%autowidth]\n|===\n|Stack |URL | Compose file | Services | Environment Variables\n\n|\u003c\u003ctraefik\u003e\u003e | http://localhost:8080 +\nhttp://localhost/whoami | link:docker-compose.traefik.yml[] | Traefik +\nwhoami |\n\n|\u003c\u003cnginx\u003e\u003e | http://localhost:7233 | link:docker-compose.nginx.yml[] | NGINX |\n\n|\u003c\u003cportainer\u003e\u003e | http://localhost:9000 +\nhttp://localhost/portainer | link:docker-compose.portainer.yml[] | Portainer CE +\nPortainer Agent |\n\n|\u003c\u003cpostgres\u003e\u003e | http://localhost:5432 | link:docker-compose.postgres.yml[] | Postgres | POSTGRES_REPLICAS\n\n|\u003c\u003cmongo\u003e\u003e | http://localhost:27017 | link:docker-compose.mongo.yml[] | Mongo | MONGO1_REPLICAS +\nMONGO2_REPLICAS +\nMONGO3_REPLICAS +\nMONGO_INIT_REPLICAS\n\n|\u003c\u003credis\u003e\u003e | http://localhost:6379 | link:docker-compose.redis.yml[] | Redis | REDIS_REPLICAS\n\n|\u003c\u003cinfluxdb\u003e\u003e | http://localhost:8086 | link:docker-compose.influxdb.yml[] | InfluxDB 2 | INFLUXDB_REPLICAS\n\n|\u003c\u003cneo4j\u003e\u003e | http://localhost:7474 +\nhttp://localhost:7687 | link:docker-compose.neo4j.yml[] | Neo4j | NEO4J_REPLICAS\n\n|\u003c\u003ckeycloak\u003e\u003e | http://localhost/keycloak/auth/ | link:docker-compose.keycloak.yml[] | Keycloak | KEYCLOAK_REPLICAS\n\n|\u003c\u003ckafka\u003e\u003e | http://localhost:9092 | link:docker-compose.kafka.yml[] | Kafka | KAFKA_REPLICAS\n\n|\u003c\u003cmaildev\u003e\u003e | http://localhost:1080 | link:docker-compose.maildev.yml[] | MailDev | MAILDEV_REPLICAS\n\n|\u003c\u003ctemporal\u003e\u003e | http://localhost:8081/temporal/ | link:docker-compose.temporal.yml[] | Temporal History +\nTemporal Matching +\nTemporal Frontend\nTemporal Worker\nTemporal UI | TEMPORAL_REPLICAS\n\n|\u003c\u003cn8n\u003e\u003e | http://localhost:5678 | link:docker-compose.n8n.yml[] | n8n | N8N_REPLICAS\n\n|\u003c\u003clocalstack\u003e\u003e | http://localhost:4566 | link:docker-compose.localstack.yml[] | S3 +\nIAM +\nSTS | LOCALSTACK_REPLICAS\n\n|\u003c\u003cprometheus\u003e\u003e | http://localhost:9090 | link:docker-compose.prometheus.yml[] | Prometheus | PROMETHEUS_REPLICAS\n\n|\u003c\u003cgrafana\u003e\u003e | http://localhost:3000 +\nhttp://localhost:3100 +\nhttp://localhost:3200 | link:docker-compose.grafana.yml[] | Grafana +\nLoki +\nTempo +\nPromtail | GRAFANA_REPLICAS\n\n|===\n\n[[traefik]]\n=== https://traefik.io/traefik[Traefik]\nReverse Proxy\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.traefik.yml traefik\n----\n\n==== Whoami\nTiny Go webserver that prints OS information and HTTP request to output, ideal for testing.\n\n[[nginx]]\n=== https://nginx.org[NGINX]\nReverse Proxy\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.nginx.yml nginx\n----\n\n[[portainer]]\n=== https://www.portainer.io/[Portainer]\nContainer Management\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.portainer.yml portainer\n----\n\n[[postgres]]\n=== https://www.postgresql.org/[PostgreSQL]\nRelational Database\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.postgres.yml postgres\n----\n\n==== Secrets\n\n[source,shell]\n----\necho \"postgres\" | docker secret create postgres-user -\n----\n\n[source,shell]\n----\necho \"postgres\" | docker secret create postgres-password -\n----\n\n[[mongo]]\n=== https://www.mongodb.com/[MongoDB]\nNo SQL Document Database\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.mongo.yml mongo\n----\n\n==== Secrets\n\n[source,shell]\n----\nopenssl rand -base64 756 | docker secret create mongo-keyfile -\n----\n\n[source,shell]\n----\necho \"mongo\" | docker secret create mongo-username -\n----\n\n[source,shell]\n----\necho \"mongo\" | docker secret create mongo-password -\n----\n\n[[redis]]\n=== https://redis.io/[Redis]\nIn memory data store\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.redis.yml redis\n----\n\n==== Secrets\n\n[source,shell]\n----\necho \"redis\" | docker secret create redis-username -\n----\n\n[source,shell]\n----\necho \"redis\" | docker secret create redis-password -\n----\n\n[[influxdb]]\n=== https://www.influxdata.com/[InfluxDB]\nTime Series Database\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.influxdb.yml influxdb\n----\n\n==== Secrets\n\n[source,shell]\n----\necho \"influxdb\" | docker secret create influxdb-username -\n----\n\n[source,shell]\n----\necho \"influxdb\" | docker secret create influxdb-password -\n----\n\n[[neo4j]]\n=== https://neo4j.com/[Neo4j]\nGraph Database\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.neo4j.yml neo4j\n----\n\n==== Secrets\n\n[source,shell]\n----\necho \"neo4j/your_password\" | docker secret create neo4j-auth -\n----\n\n[[keycloak]]\n=== https://www.keycloak.org/[Keycloak]\nIdentity and Access Management\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.keycloak.yml keycloak\n----\n\nA *test* realm and *admin* user with password *admin* is automatically from `./config/keycloak/import`.\n\n==== Secrets\n\n[source,shell]\n----\necho \"keycloak\" | docker secret create keycloak-admin-username -\n----\n\n[source,shell]\n----\necho \"keycloak\" | docker secret create keycloak-admin-password -\n----\n\n[[kafka]]\n=== https://kafka.apache.org/[Kafka]\nMessaging system streaming platform\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.kafka.yml kafka\n----\n\n[[maildev]]\n=== https://github.com/maildev/maildev[MailDev]\nSMTP Server\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.maildev.yml maildev\n----\n\n==== Secrets\n\n[source,shell]\n----\necho \"maildev\" | docker secret create maildev-username -\n----\n\n[source,shell]\n----\necho \"maildev\" | docker secret create maildev-password -\n----\n\n[[temporal]]\n=== https://temporal.io/[Temporal]\nExecution platform\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.temporal.yml temporal\n----\n\n[[n8n]]\n=== https://n8n.io/[n8n]\nWorkflow automation\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.n8n.yml n8n\n----\n\n[[localstack]]\n=== https://www.localstack.cloud/[LocalStack]\nLocal AWS Services\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.localstack.yml localstack\n----\n\n[[prometheus]]\n=== https://prometheus.io/[Prometheus]\nMonitoring and alerting toolkit\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.prometheus.yml prometheus\n----\n\n[[grafana]]\n=== https://grafana.com/[Grafana]\nObservability\n\n[source,shell]\n----\ndocker stack deploy --resolve-image changed -c docker-compose.grafana.yml grafana\n----\n\n\n== Testing\nhttps://terratest.gruntwork.io/docs/getting-started/quick-start/[Terratest]\n\n[source,shell]\n----\ncd test \u0026\u0026 go test -v\n----\n\n== Conventions\n- Compose file name `docker-compose.\u003cstack\u003e.yml`\n- *Docker Compose* file order `x-templates`, `services`, `networks`, `volumes`, `secrets` and `deploy`\n- Use `example.com` (RFC 2606 reserved for testing and documentation)\n- Terraform *main.tf* order `data`, `locals`, `resource`, `module`\n\n== Aliases\n\n**Zsh** (`~/.zshrc`)\n\n[source,text]\n----\n# Docker aliases\nalias d='docker'\nalias dc='docker compose'\n\n# Terraform aliases\nalias tf='terraform'\nalias tfi='terraform init'\nalias tfp='terraform plan'\nalias tfa='terraform apply'\nalias tfd='terraform destroy'\nalias tfs='terraform show'\nalias tfv='terraform validate'\n----","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgogolivan%2Fdocker-swarm-stacks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgogolivan%2Fdocker-swarm-stacks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgogolivan%2Fdocker-swarm-stacks/lists"}