All posts

2 tips on self-hosting GlitchTip


I just deployed GlitchTip on my own VPS. While it's relatively painless, there are 2 important additions:

  1. Health-checking: without a health check, GlitchTip would be offline for a few seconds during a deployment. This is because Dokploy (or whatever platform you are using) wouldn't be able to do a blue-green/rolling deployment. The downtime is not acceptable.
  2. Using SMTP SSL: We should simply use SSL everywhere.

Health-checking

Since GlitchTip is using Docker Compose, the health-checking mechanism should be set in the compose.yaml file.

GlitchTip has the health check endpoint at /_health. Its Docker image doesn't support curl. Therefore, we have to use Python instead. The addition to your compose.yaml is the healthcheck session:

... other parts ...
  web:
    image: glitchtip/glitchtip:6
    depends_on: *default-depends_on
    ports:
      - "8000:8000"
    environment:
      <<: *default-environment
      SERVER_ROLE: all_in_one
    restart: unless-stopped
    volumes:
      - uploads:/code/uploads
    healthcheck:
      test:
        [
          "CMD",
          "python",
          "-c",
          "import urllib.request; urllib.request.urlopen('http://localhost:8000/_health/')"
        ]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
... other parts ...

Using SMTP SSL

To use the SMTP SSL, you will need to modify the URL scheme to smtp+ssl and use the SSL port of SMTP, which is 465.

Also, don't forget to set the DEFAULT_FROM_EMAIL environment variable.

Here's how it should look like:

x-environment: &default-environment
  ... other parts ...
  EMAIL_URL: smtp+ssl://<email>:<password>@smtp.mailgun.org:465
  DEFAULT_FROM_EMAIL: <from_email>
  ... other parts ...

I use Mailgun, which supports SMTP. SendGrid supports it too.


That's it. Now you have a no-downtime self-hosted GlitchTip with a secure email mechanism!

Superintendent is a SQL workspace for CSVs and databases, for you and your AI agent.

Join thousands of people who wrangle data faster than they ever thought possible.