added media fixes, search, push updates, pwa, metrics. preparing release 1.0
CI / Go (build + vet + test) (push) Canceled after 0s
CI / Web (build + lint) (push) Canceled after 0s

This commit is contained in:
vantablackTea
2026-09-27 23:26:15 +03:00
parent 855a62755c
commit 6fc6d977bf
59 changed files with 6823 additions and 113 deletions
+9 -1
View File
@@ -4,6 +4,14 @@ MESSENGER_ENV=production
MESSENGER_ALLOWED_ORIGINS=https://msg.example.com
MESSENGER_JWT_SECRET=generate-a-long-random-string
# Web Push (optional): generate via `cd server && go run ./cmd/keygen`
MESSENGER_VAPID_PUBLIC_KEY=
MESSENGER_VAPID_PRIVATE_KEY=
MESSENGER_VAPID_SUBJECT=mailto:you@example.com
POSTGRES_USER=messenger
POSTGRES_PASSWORD=change-me
POSTGRES_DB=messenger
POSTGRES_DB=messenger
GRAFANA_ADMIN_USER=admin
GRAFANA_ADMIN_PASSWORD=admin
+35 -1
View File
@@ -11,6 +11,12 @@ services:
MESSENGER_ALLOWED_ORIGINS: ${MESSENGER_ALLOWED_ORIGINS:-}
MESSENGER_DATABASE_URL: postgres://${POSTGRES_USER:-messenger}:${POSTGRES_PASSWORD:-messenger}@postgres:5432/${POSTGRES_DB:-messenger}?sslmode=disable
MESSENGER_JWT_SECRET: ${MESSENGER_JWT_SECRET:?MESSENGER_JWT_SECRET must be set in .env}
MESSENGER_MEDIA_DIR: /data/media
MESSENGER_VAPID_PUBLIC_KEY: ${MESSENGER_VAPID_PUBLIC_KEY:-}
MESSENGER_VAPID_PRIVATE_KEY: ${MESSENGER_VAPID_PRIVATE_KEY:-}
MESSENGER_VAPID_SUBJECT: ${MESSENGER_VAPID_SUBJECT:-}
volumes:
- mediadata:/data
ports:
- "8080:8080"
depends_on:
@@ -34,5 +40,33 @@ services:
timeout: 3s
retries: 10
victoriametrics:
image: victoriametrics/victoria-metrics:latest
restart: unless-stopped
command:
- "--retentionPeriod=12"
volumes:
- vmdata:/victoria-metrics-data
ports:
- "127.0.0.1:8428:8428"
grafana:
image: grafana/grafana:latest
restart: unless-stopped
environment:
GF_SECURITY_ADMIN_USER: ${GRAFANA_ADMIN_USER:-admin}
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:-admin}
GF_USERS_ALLOW_SIGN_UP: "false"
volumes:
- grafanadata:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning
ports:
- "127.0.0.1:3000:3000"
depends_on:
- victoriametrics
volumes:
pgdata:
pgdata:
mediadata:
vmdata:
grafanadata:
@@ -0,0 +1,11 @@
apiVersion: 1
providers:
- name: messenger
orgId: 1
folder: Messenger
type: file
disableDeletion: false
updateIntervalSeconds: 30
options:
path: /etc/grafana/provisioning/dashboards
@@ -0,0 +1,130 @@
{
"annotations": { "list": [] },
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 1,
"panels": [
{
"datasource": { "type": "prometheus", "uid": "${DS_VICTORIAMETRICS}" },
"fieldConfig": {
"defaults": {
"custom": { "drawStyle": "line", "fillOpacity": 15, "lineWidth": 2, "showPoints": "never" },
"unit": "reqps"
},
"overrides": []
},
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 },
"id": 1,
"options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi" } },
"targets": [
{
"expr": "sum(rate(messenger_http_requests_total{status=~\"2..\"}[5m]))",
"legendFormat": "2xx",
"refId": "A"
},
{
"expr": "sum(rate(messenger_http_requests_total{status=~\"4..\"}[5m]))",
"legendFormat": "4xx",
"refId": "B"
},
{
"expr": "sum(rate(messenger_http_requests_total{status=~\"5..\"}[5m]))",
"legendFormat": "5xx",
"refId": "C"
}
],
"title": "HTTP requests per second",
"type": "timeseries"
},
{
"datasource": { "type": "prometheus", "uid": "${DS_VICTORIAMETRICS}" },
"fieldConfig": {
"defaults": {
"custom": { "drawStyle": "line", "fillOpacity": 10, "lineWidth": 2, "showPoints": "never" },
"unit": "s"
},
"overrides": []
},
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 0 },
"id": 2,
"options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi" } },
"targets": [
{
"expr": "histogram_quantile(0.95, sum(rate(messenger_http_request_duration_seconds_bucket[5m])) by (le))",
"legendFormat": "p95",
"refId": "A"
},
{
"expr": "histogram_quantile(0.50, sum(rate(messenger_http_request_duration_seconds_bucket[5m])) by (le))",
"legendFormat": "p50",
"refId": "B"
}
],
"title": "Request latency",
"type": "timeseries"
},
{
"datasource": { "type": "prometheus", "uid": "${DS_VICTORIAMETRICS}" },
"fieldConfig": {
"defaults": { "custom": { "drawStyle": "line", "fillOpacity": 15, "lineWidth": 2, "showPoints": "never" } },
"overrides": []
},
"gridPos": { "h": 8, "w": 8, "x": 0, "y": 8 },
"id": 3,
"options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "single" } },
"targets": [
{ "expr": "messenger_ws_connections", "legendFormat": "connections", "refId": "A" }
],
"title": "WebSocket connections",
"type": "timeseries"
},
{
"datasource": { "type": "prometheus", "uid": "${DS_VICTORIAMETRICS}" },
"fieldConfig": {
"defaults": { "custom": { "drawStyle": "line", "fillOpacity": 10, "lineWidth": 2, "showPoints": "never" } },
"overrides": []
},
"gridPos": { "h": 8, "w": 8, "x": 8, "y": 8 },
"id": 4,
"options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi" } },
"targets": [
{ "expr": "go_goroutines", "legendFormat": "goroutines", "refId": "A" },
{ "expr": "process_resident_memory_bytes / 1024 / 1024", "legendFormat": "RSS MiB", "refId": "B" }
],
"title": "Runtime",
"type": "timeseries"
},
{
"datasource": { "type": "prometheus", "uid": "${DS_VICTORIAMETRICS}" },
"fieldConfig": {
"defaults": {
"custom": { "drawStyle": "line", "fillOpacity": 15, "lineWidth": 2, "showPoints": "never" },
"unit": "reqps"
},
"overrides": []
},
"gridPos": { "h": 8, "w": 8, "x": 16, "y": 8 },
"id": 5,
"options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi" } },
"targets": [
{
"expr": "topk(8, sum(rate(messenger_http_requests_total[5m])) by (path))",
"legendFormat": "{{path}}",
"refId": "A"
}
],
"title": "Top endpoints",
"type": "timeseries"
}
],
"refresh": "30s",
"schemaVersion": 39,
"tags": ["messenger"],
"templating": { "list": [] },
"time": { "from": "now-1h", "to": "now" },
"timepicker": {},
"timezone": "",
"title": "Messenger",
"uid": "messenger-main",
"version": 1
}
@@ -0,0 +1,9 @@
apiVersion: 1
datasources:
- name: VictoriaMetrics
type: prometheus
access: proxy
url: http://victoriametrics:8428
isDefault: true
editable: false