Merge pull request 'error-tracking' (#2) from miklo/comfy:error-tracking into main

Reviewed-on: mtyton/comfy#2
main
mtyton 2023-07-16 11:08:51 +00:00
commit f30b392a5a
10 zmienionych plików z 142 dodań i 6 usunięć

Wyświetl plik

@ -46,6 +46,8 @@ COPY --chown=wagtail:wagtail . .
# Use user "wagtail" to run the build commands below and the server itself.
USER wagtail
RUN mkdir -p /app/media
# Collect static files.
RUN python manage.py collectstatic --noinput --clear

Wyświetl plik

@ -16,6 +16,18 @@ import os
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
# -> GlitchTip error reporting
sentry_sdk.init(
integrations=[DjangoIntegration()],
auto_session_tracking=False,
traces_sample_rate=0
)
SENTRY_ENVIRONMENT = os.environ.get("SENTRY_ENVIRONMENT", '')
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

Wyświetl plik

@ -3,6 +3,7 @@ from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-s7hlfa-#n7-v0#&-0ko3(efe+@^d@ie1_1-633e&jb1rh$)j1p"

Wyświetl plik

@ -7,10 +7,12 @@ ALLOWED_HOSTS = [
"localhost",
"0.0.0.0",
"127.0.0.1",
"artel.citizen4.eu",
"artel.tepewu.pl"
]
CSRF_TRUSTED_ORIGINS = [
"https://0.0.0.0", "http://0.0.0.0",
"https://localhost", "http://localhost",
"https://artel.tepewu.pl"
"https://artel.tepewu.pl",
"https://artel.citizen4.eu",
]

Wyświetl plik

@ -12,6 +12,8 @@ from wagtail.documents import urls as wagtaildocs_urls
from search import views as search_views
handler404 = 'artel.views.my_custom_page_not_found_view'
urlpatterns = [
path("django-admin/", admin.site.urls),
path("admin/", include(wagtailadmin_urls)),

Wyświetl plik

@ -0,0 +1,11 @@
from django.conf import settings
from django.http import HttpResponseNotFound
from sentry_sdk import capture_message
def my_custom_page_not_found_view(*args, **kwargs):
if settings.SENTRY_ENVIRONMENT != 'production':
capture_message("Page not found!", level="error")
# return any response here, e.g.:
return HttpResponseNotFound("Not found")

Wyświetl plik

@ -23,7 +23,7 @@ services:
user: "${UID}:${GID}"
restart: always
ports:
- "8001:8000"
- "8000:8000"
volumes:
- ./:/app
environment:

Wyświetl plik

@ -0,0 +1,93 @@
version: "3.8"
services:
db:
image: postgres
restart: always
environment:
- POSTGRES_ROOT_PASSWORD=${POSTGRES_ROOT_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- db:/var/lib/postgresql/data
networks:
- internal
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
comfy:
image: comfy
user: "${UID}:${GID}"
restart: always
ports:
- "8000"
volumes:
- media:/app/media
- static:/app/static
environment:
- SECRET_KEY=${SECRET_KEY}
- DATABASE_URL=${DATABASE_URL}
- DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE}
- SENTRY_DSN=${SENTRY_DSN}
- SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT}
- EMAIL_HOST=${EMAIL_HOST}
- EMAIL_HOST_USER=${EMAIL_HOST_USER}
- EMAIL_HOST_PASSWORD=${EMAIL_HOST_PASSWORD}
- EMAIL_PORT=${EMAIL_PORT}
- EMAIL_USE_TLS=${EMAIL_USE_TLS}
- DEFAULT_FROM_EMAIL=${DEFAULT_FROM_EMAIL}
depends_on:
- db
networks:
- internal
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
web:
image: nginx
restart: always
volumes:
- nginx:/etc/nginx/conf.d
- static:/opt/services/comfy/static
- media:/opt/services/comfy/media
ports:
- "80"
environment:
- NGINX_HOST=${NGINX_HOST}
- NGINX_PORT=${NGINX_PORT}
networks:
- internal
- web
deploy:
resources:
limits:
cpus: '1.0'
memory: 256M
labels:
- "traefik.enable=true"
- "traefik.docker.network=web"
- "traefik.http.routers.artel.rule=Host(`${NGINX_HOST}`)"
- "traefik.http.routers.artel.entrypoints=websecure"
- "traefik.http.services.artel.loadbalancer.server.port=80"
- "traefik.http.routers.artel.tls=true"
- "traefik.http.routers.artel.tls.certresolver=ovh"
volumes:
db:
media:
static:
nginx:
networks:
internal:
web:
external:
name: web

Wyświetl plik

@ -11,9 +11,10 @@ services:
context: ./
user: "${UID}:${GID}"
ports:
- "8000:8000"
- "8001:8000"
volumes:
- ./:/app
# - ./:/app
- media:/app/media
environment:
- SECRET_KEY
- DATABASE_URL
@ -30,6 +31,17 @@ services:
- POSTGRES_PASSWORD
- POSTGRES_DB
volumes:
- ../postgres/:/var/lib/postgresql
- db:/var/lib/postgresql/data
env_file:
- .env
adminer:
image: adminer
restart: always
ports:
- "8002:8080"
volumes:
media:
db:

Wyświetl plik

@ -8,4 +8,5 @@ phonenumbers==8.13.13
django-phonenumber-field==7.1.0
factory-boy==3.2.1
pdfkit==1.0.0
num2words==0.5.12
num2words==0.5.12
sentry-sdk==1.28.0