In this tutorial, we are going to be deploying GlitchTip on docker on an AWS VPS running a Ubuntu 18.04 server.
Requirements
Before you get started, please install
- Docker
- Docker-compose
Get the docker compose file
Create a directory in your root directory
$ cd ~ $ mkdir glitchtip $ cd glitchtip
Next, create a file called "docker-compose.yml" in the current directory. I will be using nano which comes as a default in my server, you can also use vim
$ nano docker-compose.yml
In this file, copy and paste the docker-compose commands from here. It looks like this at the time of writing this article
version: "3.8"
x-environment:
&default-environment
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
SECRET_KEY: change_me # best to run openssl rand -hex 32
PORT: 8000
EMAIL_URL: consolemail:// # Example smtp://email:password@smtp_url:port https://glitchtip.com/documentation/install#configuration
GLITCHTIP_DOMAIN: https://app.glitchtip.com # Change this to your domain
DEFAULT_FROM_EMAIL: email@glitchtip.com # Change this to your email
CELERY_WORKER_AUTOSCALE: "1,3" # Scale between 1 and 3 to prevent excessive memory usage. Change it or remove to set it to the number of cpu cores.
CELERY_WORKER_MAX_TASKS_PER_CHILD: "10000"
x-depends_on:
&default-depends_on
- postgres
- redis
services:
postgres:
image: postgres:15
environment:
POSTGRES_HOST_AUTH_METHOD: "trust" # Consider removing this and setting a password
restart: unless-stopped
volumes:
- pg-data:/var/lib/postgresql/data
redis:
image: redis
restart: unless-stopped
web:
image: glitchtip/glitchtip
depends_on: *default-depends_on
ports:
- "8000:8000"
environment: *default-environment
restart: unless-stopped
volumes:
- uploads:/code/uploads
worker:
image: glitchtip/glitchtip
command: ./bin/run-celery-with-beat.sh
depends_on: *default-depends_on
environment: *default-environment
restart: unless-stopped
volumes:
- uploads:/code/uploads
migrate:
image: glitchtip/glitchtip
depends_on: *default-depends_on
command: "./manage.py migrate"
environment: *default-environment
volumes:
pg-data:
uploads:
On line 5, endeavor to change your SECRET_KEY to something more secure.
Also under the x-environment section at the top of the file, you can add more environment variables to GlitchTip such as `GLITCHTIP_MAX_EVENT_LIFE_DAYS`, `REDIS_URL`, `DATABASE_URL` and others.
Check out the list of environment variables here, under the Configurations subheading.
For our case, we will leave it as it is.
Next, save the file and type
$ docker-compose up -d
to create the application at port 8000.
Open your browser and go to `your_ip_address:8000`. You should see the GlitchTip login screen