diff --git a/lib/main.dart b/lib/main.dart index a03c8ff4..dca6595e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -76,11 +76,8 @@ void main() async { await SentryFlutter.init( (options) { - options.dsn = 'https://642fadfae16a4308a73ae2db1181654a@bugs.plezy.app/1'; - options.sendDefaultPii = true; + options.dsn = 'https://6a1a6ef8c72140099b2798973c1bfb2f@bugs.plezy.app/1'; options.tracesSampleRate = 0; - options.anrEnabled = true; - options.anrTimeoutInterval = const Duration(seconds: 5); options.attachStacktrace = true; options.enableAutoSessionTracking = false; options.beforeSend = _beforeSend; diff --git a/lib/screens/settings/settings_screen.dart b/lib/screens/settings/settings_screen.dart index 3ae7cf7a..e4aa66d1 100644 --- a/lib/screens/settings/settings_screen.dart +++ b/lib/screens/settings/settings_screen.dart @@ -996,13 +996,25 @@ class _SettingsScreenState extends State with FocusableTab { ListTile( leading: const AppIcon(Symbols.error_rounded, fill: 1), title: const Text('Test Sentry'), - subtitle: const Text('Send a test error to Bugsink'), + subtitle: const Text('Send a test error'), trailing: const AppIcon(Symbols.chevron_right_rounded, fill: 1), onTap: () { - Sentry.captureException(Exception('Sentry test from settings')); + throw Exception("Example exception"); showSnackBar(context, 'Test error sent to Sentry'); }, ), + if (kDebugMode) + ListTile( + leading: const AppIcon(Symbols.timer_rounded, fill: 1), + title: const Text('Test ANR'), + subtitle: const Text('Block the main thread for 10 seconds'), + trailing: const AppIcon(Symbols.chevron_right_rounded, fill: 1), + onTap: () { + showSnackBar(context, 'Blocking main thread...'); + final end = DateTime.now().add(const Duration(seconds: 10)); + while (DateTime.now().isBefore(end)) {} + }, + ), ], ), ); diff --git a/server/Caddyfile b/server/Caddyfile index f15c7c58..dd440e18 100644 --- a/server/Caddyfile +++ b/server/Caddyfile @@ -3,12 +3,5 @@ ice.plezy.app { } bugs.plezy.app { - handle /api/* { - reverse_proxy rustrak:8080 { - header_up X-Real-IP {remote_host} - } - } - handle { - reverse_proxy rustrak-ui:3000 - } + reverse_proxy glitchtip:8000 } diff --git a/server/Dockerfile b/server/Dockerfile index 1e09cc01..179682b8 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.22-alpine AS build WORKDIR /src COPY go.mod go.sum ./ RUN go mod download -COPY . . +COPY main.go . RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /relay . FROM scratch diff --git a/server/deploy.sh b/server/deploy.sh new file mode 100755 index 00000000..4e184e59 --- /dev/null +++ b/server/deploy.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +REMOTE="root@212.132.75.249" +SSH_KEY="$HOME/.ssh/id_edde" +REMOTE_DIR="/opt/plezy-relay" +SSH="ssh -i $SSH_KEY $REMOTE" + +cd "$SCRIPT_DIR" + +echo "Syncing files to $REMOTE:$REMOTE_DIR..." +rsync -avz --exclude='plezy-relay' --exclude='plezy-server-linux-amd64' \ + -e "ssh -i $SSH_KEY" \ + . "$REMOTE:$REMOTE_DIR/" + +echo "Deploying..." +$SSH "cd $REMOTE_DIR && docker compose up -d --build" + +echo "Done." diff --git a/server/docker-compose.yml b/server/docker-compose.yml index 8ab7e1b7..3baf58a7 100644 --- a/server/docker-compose.yml +++ b/server/docker-compose.yml @@ -18,47 +18,41 @@ services: - caddy_data:/data - caddy_config:/config - rustrak-db: + glitchtip-db: image: postgres:16-alpine restart: unless-stopped environment: - POSTGRES_USER: ${RUSTRAK_POSTGRES_USER} - POSTGRES_PASSWORD: ${RUSTRAK_POSTGRES_PASSWORD} - POSTGRES_DB: ${RUSTRAK_POSTGRES_DB} + POSTGRES_DB: glitchtip + POSTGRES_USER: ${GLITCHTIP_POSTGRES_USER} + POSTGRES_PASSWORD: ${GLITCHTIP_POSTGRES_PASSWORD} volumes: - - rustrak_data:/var/lib/postgresql/data + - glitchtip_data:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${RUSTRAK_POSTGRES_USER}"] + test: ["CMD-SHELL", "pg_isready -U ${GLITCHTIP_POSTGRES_USER}"] interval: 5s timeout: 5s retries: 5 - rustrak: - image: abians7/rustrak-server:latest + glitchtip: + image: glitchtip/glitchtip restart: unless-stopped depends_on: - rustrak-db: + glitchtip-db: condition: service_healthy environment: - DATABASE_URL: postgres://${RUSTRAK_POSTGRES_USER}:${RUSTRAK_POSTGRES_PASSWORD}@rustrak-db/${RUSTRAK_POSTGRES_DB} - RUSTRAK_LOG: ${RUSTRAK_LOG} - SESSION_SECRET: ${RUSTRAK_SESSION_SECRET} - CREATE_SUPERUSER: ${RUSTRAK_SUPERUSER} + DATABASE_URL: postgres://${GLITCHTIP_POSTGRES_USER}:${GLITCHTIP_POSTGRES_PASSWORD}@glitchtip-db/glitchtip + SECRET_KEY: ${GLITCHTIP_SECRET_KEY} + GLITCHTIP_DOMAIN: https://bugs.plezy.app + DEFAULT_FROM_EMAIL: noreply@plezy.app + GLITCHTIP_MAX_EVENT_LIFE_DAYS: 90 + SERVER_ROLE: all_in_one + ENABLE_USER_REGISTRATION: "false" + VALKEY_URL: "" expose: - - "8080" - - rustrak-ui: - image: abians7/rustrak-ui:latest - restart: unless-stopped - depends_on: - - rustrak - environment: - RUSTRAK_API_URL: http://rustrak:8080 - expose: - - "3000" + - "8000" volumes: logs: caddy_data: caddy_config: - rustrak_data: + glitchtip_data: