Bugsink - Deploy with Kamal

16th June 2025 – 545 words

For my personal projects, I used to use Sentry-hosted, but it usually dropped some events if there were a bad bot. I also don’t want to pay for a couple of errors of my side projects. So I found Bugsink as an alternative. Already using kamal for deploying the Rails apps, so I thought it would be a good idea to use it for Bugsink as well, as the integration with HTTPS/SSL with Kamal-Proxy is straigt forward.

Kamal

bundle init
bundle add kamal
# make sure it's kamal >= 2
bundle
kamal init
touch .env
echo ".env" >> .gitignore
echo ".env" >> .dockerignore
echo config >> .dockerignore
echo ".kamal/secrets" >> .dockerignore
echo .git >> .dockerignore

There are a couple of ways to get secrets into Kamal - Simplest: hardcode in .kamal/secrets, next simplest, little saver: put in .env and always run kamal with: dotenv kamal ..

In the second case, your .kamal/secrets will look like this:

KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
SECRET_KEY=$SECRET_KEY
CREATE_SUPERUSER=$CREATE_SUPERUSER

Put the real stuff in .env then.

Docker registry

If you have Gitlab, they provide free Registry for now. Go there, create an Access Token with read_repository and write_repository permissions, and copy the token as KAMAL_REGISTRY_PASSWORD

Dockerfile

Kamal in “App”-mode always needs a local Dockerfile - You COULD use a remote image, but you would need to manually add the service-label, otherwise Kamal won’t be able to find it. So just make a very easy Dockerfile:

FROM bugsink/bugsink:latest
# or use specific versions:
# FROM bugsink/bugsink:1.61

Kamal config

config/deploy.yml

service: bugsink
image: YourUserName/bugsink

volumes:
  - "bugsink_storage:/app/storage"

servers:
  web:
    - 1.2.3.4

proxy:
  ssl: true
  # make sure the DNS record resolves to the web server - as Kamal will start
  # issuing certificates with Let's Encrypt right away
  host: bugsink.YourCompany.com
  app_port: 8000

  healthcheck:
    path: /
    interval: 2

env:
  clear:
    PORT: 8000
    DATABASE_PATH: "/app/storage/bugsink_production.sqlite3"
    BEHIND_HTTPS_PROXY: 'true'
    SECURE_PROXY_SSL_HEADER: 'https'
    BASE_URL: 'https://bugsink.YourCompany.com'
    SITE_TITLE: 'Bugsink YourCompany'
    ALLOWED_HOSTS: '*'
    #EMAIL_HOST: "your.smtp.com"
    #DEFAULT_FROM_EMAIL: "bot@yourCompany.de"
  secret:
    - SECRET_KEY
    - CREATE_SUPERUSER
    # set in Env + .kamal/secrets
    #- EMAIL_HOST_PASSWORD
    #- EMAIL_HOST_USER
  secret:
    - SECRET_KEY
    - CREATE_SUPERUSER

registry:
  server: registry.gitlab.com
  username: YourGitlabUsername
  password:
    - KAMAL_REGISTRY_PASSWORD

builder:
  arch: amd64

Thats it! Create a commit in the repo (that’s kamal’s Image tag), then deploy:

dotenv kamal deploy

If you later just need to change some configs via ENV, just reboot the app:

dotenv kamal app boot --version=SHAOFYOURGITCOMMIT