Created
May 23, 2024 13:29
-
-
Save spencerldixon/f6f79c435cb37f13a7c98120bba1d589 to your computer and use it in GitHub Desktop.
Kamal Boilerplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: wordsweeper | |
image: spencerldixon/wordsweeper | |
servers: | |
web: | |
hosts: | |
- 78.47.88.46 | |
labels: | |
traefik.http.routers.domain.rule: Host(`wordsweeper.fun`, `www.wordsweeper.fun`) | |
traefik.http.routers.domain.entrypoints: websecure | |
traefik.http.routers.domain.tls.certresolver: letsencrypt | |
options: | |
network: "private" | |
cmd: "./bin/rails server" | |
registry: | |
username: spencerldixon | |
password: | |
- KAMAL_REGISTRY_PASSWORD | |
# Inject ENV variables into containers (secrets come from .env). | |
# Remember to run `kamal env push` after making changes! | |
env: | |
clear: | |
HOSTNAME: wordsweeper.fun | |
DB_HOST: 78.47.88.46 | |
RAILS_SERVE_STATIC_FILES: true | |
RAILS_LOG_TO_STDOUT: true | |
secret: | |
- RAILS_MASTER_KEY | |
- POSTGRES_PASSWORD | |
accessories: | |
db: | |
image: postgres:15 | |
host: 78.47.88.46 | |
port: 5432 | |
env: | |
clear: | |
POSTGRES_USER: "wordsweeper" | |
POSTGRES_DB: "wordsweeper_production" | |
secret: | |
- POSTGRES_PASSWORD | |
files: | |
- db/production.sql:/docker-entrypoint-initdb.d/setup.sql | |
directories: | |
- data:/var/lib/postgresql/data | |
# Configure custom arguments for Traefik | |
traefik: | |
options: | |
publish: | |
- "443:443" | |
volume: | |
- "/letsencrypt/acme.json:/letsencrypt/acme.json" | |
network: "private" | |
args: | |
entryPoints.web.address: ":80" | |
entryPoints.websecure.address: ":443" | |
entryPoints.web.http.redirections.entryPoint.to: websecure | |
entryPoints.web.http.redirections.entryPoint.scheme: https | |
entryPoints.web.http.redirections.entrypoint.permanent: true | |
entrypoints.websecure.http.tls: true | |
entrypoints.websecure.http.tls.domains[0].main: "wordsweeper.fun" | |
entrypoints.websecure.http.tls.domains[1].main: "www.wordsweeper.fun" | |
certificatesResolvers.letsencrypt.acme.email: "[email protected]" | |
certificatesResolvers.letsencrypt.acme.storage: "/letsencrypt/acme.json" | |
certificatesResolvers.letsencrypt.acme.httpchallenge: true | |
certificatesResolvers.letsencrypt.acme.httpchallenge.entrypoint: web | |
healthcheck: | |
interval: 5s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You will also need to ssh into the server and do these before deploying:
For SSL:
For Active Storage:
For connecting services over the same Docker network: