Skip to content

Instantly share code, notes, and snippets.

@avinashjoshi
Created October 13, 2024 23:54
Show Gist options
  • Save avinashjoshi/cc495b2e2e500a3dbaf595b9ac3b05b1 to your computer and use it in GitHub Desktop.
Save avinashjoshi/cc495b2e2e500a3dbaf595b9ac3b05b1 to your computer and use it in GitHub Desktop.
Kamal 1.0
# file: config/deploy.staging.yml
# Command to generate basic auth credentials: htpasswd -nbB user1 password123
servers:
web:
hosts:
- x.x.x.x
labels:
traefik.http.routers.web.entrypoints: web
traefik.http.routers.web.rule: Host(`staging.example.com`)
traefik.http.routers.websecure.entrypoints: websecure
traefik.http.routers.websecure.rule: Host(`staging.example.com`)
traefik.http.routers.websecure.tls: true
traefik.http.routers.websecure.tls.certresolver: letsencrypt
traefik.http.routers.websecure.middlewares: auth
traefik.http.middlewares.auth.basicauth.users: user1:$2y$05$92btHqGrYZo5XRMS5XN9.eol1wEuLkMLWGju9zkfpbbcZ/aMuAfv6,user2:$2y$05$3E/KCNA00Fi3JcgnOn5x2ej5H2QEt1RuNkyvkvRM3KujDR3b6OqSC
env:
clear:
RAILS_ENV: staging
# file: config/deploy.yml
service: app
image: repo/image
registry:
username: username
password:
- KAMAL_REGISTRY_PASSWORD
env:
secret:
- GIT_SHA
- RAILS_MASTER_KEY
- DATABASE_HOST
- DATABASE_PASSWORD
ssh:
user: ec2-user
builder:
multiarch: false
cache:
type: gha
traefik:
options:
publish:
- "443:443"
volume:
- "/letsencrypt/acme.json:/letsencrypt/acme.json"
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
certificatesResolvers.letsencrypt.acme.email: "avinash@cravd.com"
certificatesResolvers.letsencrypt.acme.storage: "/letsencrypt/acme.json"
certificatesResolvers.letsencrypt.acme.httpchallenge: true
certificatesResolvers.letsencrypt.acme.httpchallenge.entrypoint: web
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment