323 lines
8.0 KiB
Markdown
323 lines
8.0 KiB
Markdown
glicthtip 2.4.5 on debian 12 bookworm
|
|
=======================================
|
|
|
|
|
|
## python 3.13
|
|
this is probably unecessary
|
|
```shell
|
|
apt update && apt upgrade -y
|
|
apt install wget build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev -y
|
|
wget https://www.python.org/ftp/python/3.13.1/Python-3.13.1.tar.xz
|
|
tar -xvf Python-3.13.1.tar.xz
|
|
cd Python-3.13.1
|
|
./configure --enable-optimizations
|
|
make altinstall
|
|
# make it default
|
|
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.13 1
|
|
```
|
|
|
|
## system packages
|
|
|
|
```shell
|
|
apt install -y acl build-essential libpq-dev libsasl2-dev libssl-dev nginx nodejs postgresql redis-server
|
|
|
|
```
|
|
|
|
## postgresql
|
|
|
|
```shell
|
|
su - postgres
|
|
postgres@:~$ psql
|
|
postgres=# CREATE DATABASE glitchtip WITH ENCODING 'UTF8' TEMPLATE template0;
|
|
postgres=# CREATE USER glitchtip WITH ENCRYPTED PASSWORD '<PGSQL_PASSWORD>';
|
|
postgres=# GRANT ALL PRIVILEGES ON DATABASE glitchtip TO glitchtip;
|
|
postgres=# ALTER DATABASE glitchtip OWNER TO "glitchtip";
|
|
postgres=# \c glitchtip
|
|
postgres=# ALTER SCHEMA public OWNER TO "glitchtip";
|
|
```
|
|
|
|
## glitchtip
|
|
|
|
```shell
|
|
su -
|
|
useradd -m -s /bin/bash glitchtip
|
|
mkdir /opt/glitchtip
|
|
chown glitchtip:glitchtip /opt/glitchtip
|
|
su - glitchtip
|
|
```
|
|
### frontend
|
|
```shell
|
|
cd /opt/glitchtip
|
|
git clone https://gitlab.com/glitchtip/glitchtip-frontend.git
|
|
cd /opt/glitchtip/glitchtip-frontend
|
|
git checkout tags/v4.2.5
|
|
npm install
|
|
npm run build-prod
|
|
```
|
|
|
|
### backend
|
|
```shell
|
|
cd /opt/glitchtip
|
|
git clone https://gitlab.com/glitchtip/glitchtip-backend.git
|
|
cd /opt/glitchtip/glitchtip-backend
|
|
git checkout tags/v4.2.5
|
|
python3 -m venv .venv
|
|
source .venv/bin/activate
|
|
pip install --upgrade setuptools pip wheel cython uv
|
|
uv sync
|
|
```
|
|
|
|
#### set the env variables
|
|
https://glitchtip.com/documentation/install#configuration
|
|
|
|
```shell
|
|
vim .env
|
|
```
|
|
|
|
```ini
|
|
DATABASE_HOST="127.0.0.1"
|
|
DATABASE_PORT="5432"
|
|
DATABASE_PASSWORD="<PGSQL_PASSWORD>"
|
|
DATABASE_NAME="glitchtip"
|
|
DATABASE_USER="glitchtip"
|
|
SECRET_KEY="<yourrandomlygeneratedsecretkey>"
|
|
REDIS_HOST="127.0.0.1"
|
|
EMAIL_URL="smtp://glitchtip@yourdomain.net"
|
|
DEFAULT_FROM_EMAIL="glitchtip@yourdomain.net"
|
|
GLITCHTIP_DOMAIN="http://your.domain.tld"
|
|
ENABLE_USER_REGISTRATION="FALSE"
|
|
ENABLE_ORGANIZATION_CREATION="TRUE"
|
|
#DEBUG="TRUE" # uncomment for debuging
|
|
```
|
|
|
|
|
|
#### migrate db
|
|
```shell
|
|
cd /opt/glitchtip/glitchtip-backend
|
|
source .venv/bin/activate
|
|
export $(cat .env | xargs)
|
|
./manage.py migrate
|
|
```
|
|
|
|
#### collect static
|
|
```shell
|
|
ln -s /opt/glitchtip/glitchtip-frontend/dist/glitchtip-frontend/browser dist
|
|
mkdir /opt/glitchtip/glitchtip-backend/{static,media}
|
|
./manage.py collectstatic
|
|
```
|
|
|
|
#### super user
|
|
```shell
|
|
cd /opt/glitchtip/glitchtip-backend
|
|
source .venv/bin/activate
|
|
export $(cat .env | xargs)
|
|
./manage.py createsuperuser --email "${DEFAULT_FROM_EMAIL}"
|
|
```
|
|
|
|
### services
|
|
|
|
#### gunicorn
|
|
|
|
```shell
|
|
mkdir /opt/glitchtip/runtime
|
|
vim /opt/glitchtip/gunicon.py
|
|
```
|
|
|
|
```ini
|
|
pidfile = "/opt/glitchtip/runtime/pid"
|
|
bind = "unix:/opt/glitchtip/runtime/socket"
|
|
proc_name = "glitchtip"
|
|
worker_tmp_dir = "/dev/shm"
|
|
workers = 3
|
|
accesslog = "/opt/glitchtip/gunicorn_access.log"
|
|
errorlog = "/opt/glitchtip/gunicorn_error.log"
|
|
loglevel = "debug"
|
|
```
|
|
|
|
#### systemd service
|
|
```shell
|
|
su -
|
|
vim /etc/systemd/system/glitchtip.service
|
|
```
|
|
```ini
|
|
[Unit]
|
|
Description=glitchtip daemon
|
|
After=network.target
|
|
|
|
[Service]
|
|
PIDFile=/opt/glitchtip/runtime/pidfile
|
|
EnvironmentFile=/opt/glitchtip/glitchtip-backend/.env
|
|
User=glitchtip
|
|
Group=glitchtip
|
|
RuntimeDirectory=glitchtip
|
|
WorkingDirectory=/opt/glitchtip/glitchtip-backend
|
|
ExecStart=/opt/glitchtip/glitchtip-backend/.venv/bin/gunicorn glitchtip.wsgi --config /opt/glitchtip/gunicorn.py
|
|
ExecReload=/bin/kill -s HUP $MAINPID
|
|
ExecStop=/bin/kill -s TERM $MAINPID
|
|
PrivateTmp=true
|
|
Restart=always
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
```shell
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl start glitchtip
|
|
sudo journalctl -u glitchtip
|
|
sudo systemctl enable glitchtip
|
|
```
|
|
|
|
## nginx
|
|
|
|
### letsencrypt
|
|
because of the mess with python 3.13 i use special venv for certbot
|
|
```shell
|
|
cd /root
|
|
python3.11 -m venv certbot-venv
|
|
source certbot-venv/bin/activate
|
|
pip install certbot
|
|
systemctl stop nginx
|
|
./certbot-venv/bin/certbot certonly --standalone -d your.domin.tld --cert-name your.domin.tld
|
|
systemctl start nginx
|
|
deactivate
|
|
mkdir -p /etc/nginx/ssl/certs/your.domain.tld
|
|
openssl dhparam -out /etc/nginx/ssl/certs/your.domain.tld/dhparam.pem 2048
|
|
# renewing
|
|
# touch /var/spool/cron/crontabs/root
|
|
# crontab -l > mycron
|
|
# echo "0 3 * * * certbot renew --pre-hook 'systemctl stop nginx' --post-hook 'systemctl start nginx' --cert-name $_domain" >> mycron
|
|
# crontab mycron
|
|
# rm mycron
|
|
```
|
|
|
|
### vhost
|
|
```shell
|
|
vim /etc/nginx/sites-available/your.domain.tld.conf
|
|
```
|
|
|
|
```nginx
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name your.domain.tld;
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen [::]:443 ssl http2;
|
|
listen 443 ssl http2;
|
|
server_name your.domain.tld;
|
|
access_log /var/log/nginx/your.domain.tld.access.log;
|
|
error_log /var/log/nginx/your.domain.tld.error.log;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/your.domain.tld/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/your.domain.tld/privkey.pem;
|
|
ssl_dhparam /etc/nginx/ssl/certs/your.domain.tld/dhparam.pem;
|
|
|
|
add_header Strict-Transport-Security max-age=15768000;
|
|
|
|
root /opt/glitchtip/glitchtip-backend/static/;
|
|
index index.html;
|
|
|
|
client_max_body_size 20M;
|
|
|
|
location / {
|
|
#alias /opt/glitchtip/glitchtip-backend/static/;
|
|
try_files $uri $uri/ /index.html;
|
|
expires 1h;
|
|
add_header Pragma public;
|
|
add_header Cache-Control "public";
|
|
}
|
|
|
|
location ~ /\.git {
|
|
deny all;
|
|
}
|
|
|
|
location /static/ {
|
|
root /opt/glitchtip/glitchtip-backend/;
|
|
}
|
|
|
|
location /media/ {
|
|
alias /opt/glitchtip/glitchtip-backend/media/;
|
|
}
|
|
|
|
location ~ ^/(api|admin|_health|rest-auth)/ {
|
|
proxy_pass http://unix:/opt/glitchtip/runtime/socket;
|
|
#proxy_redirect off;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
```
|
|
|
|
```shell
|
|
ln -s /etc/nginx/sites-available/your.domain.tld.conf /etc/nginx/sites-enabled/
|
|
nginx -t
|
|
systemctl restart nginx
|
|
```
|
|
|
|
## Celery
|
|
|
|
```shell
|
|
vim /etc/systemd/system/glitchtip-celery-beat.service
|
|
```
|
|
```ini
|
|
[Unit]
|
|
Description=glitchtip celery beat
|
|
After=network.target
|
|
|
|
[Service]
|
|
EnvironmentFile=/opt/glitchtip/glitchtip-backend/.env
|
|
User=glitchtip
|
|
Group=glitchtip
|
|
RuntimeDirectory=glitchtip
|
|
WorkingDirectory=/opt/glitchtip/glitchtip-backend
|
|
ExecStart=/opt/glitchtip/glitchtip-backend/.venv/bin/celery --app "glitchtip" beat --loglevel info --pidfile=/opt/glitchtip/runtime/celery-beat.pid --logfile=/opt/glitchtip/celery-beat.log --schedule /opt/glitchtip/celerybeat-schedule
|
|
|
|
PrivateTmp=true
|
|
Restart=always
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
```shell
|
|
vim /etc/systemd/system/glitchtip-celery-worker.service
|
|
```
|
|
```ini
|
|
[Unit]
|
|
Description=glitchtip celery worker
|
|
After=network.target
|
|
|
|
[Service]
|
|
EnvironmentFile=/opt/glitchtip/glitchtip-backend/.env
|
|
User=glitchtip
|
|
Group=glitchtip
|
|
RuntimeDirectory=glitchtip
|
|
WorkingDirectory=/opt/glitchtip/glitchtip-backend
|
|
ExecStart=/opt/glitchtip/glitchtip-backend/.venv/bin/celery --app "glitchtip" worker --loglevel info --pidfile=/opt/glitchtip/runtime/celery-worker.pid --logfile=/opt/glitchtip/celery-worker.log
|
|
PrivateTmp=true
|
|
Restart=always
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
```shell
|
|
systemctl daemon-reload
|
|
systemctl enable glitchtip-celery-beat glitchtip-celery-worker
|
|
systemctl start glitchtip-celery-beat glitchtip-celery-worker
|
|
```
|
|
|
|
## sources
|
|
|
|
- https://glitchtip.com/documentation/install#installing-without-docker
|
|
- https://www.mindbaz.com/technologie-email/tuto-installer-glitchtip-pour-votre-gestion-d-erreur/
|
|
- https://www.linkedin.com/pulse/glitchtip-installing-without-docker-armagan-yaman
|
|
- https://guides.lw1.at/how-to-install-glitchtip-without-docker/
|
|
- https://soufianebouchaara.com/deploying-self-hosted-glitchtip-for-error-tracking-sentry-alternative/
|
|
- |