From 08a9f6e3f61e98b84809a2937aba9c6705257741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Thu, 21 Dec 2023 22:25:30 +0100 Subject: [PATCH] doc: document sentry in deployment docs --- README.md | 2 +- docs/deploy.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a70a1f..e76a396 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,6 @@ La Chariotte is a web application to handle grouped orders. - [Public server](https://chariotte.fr) - [Online documentation](https://docs.chariotte.fr) -This project has been initially developped and published by [Hashbang](https:// +This project has been initially developed and published by [Hashbang](https:// hashbang.fr/) under an [Affero GPLv3](LICENSE) license, and is now maintained and developed by a team of volunteers. diff --git a/docs/deploy.md b/docs/deploy.md index 7f1723a..3864bde 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -50,6 +50,61 @@ en/latest/), managed by AlwaysData. The production settings are stored in `~/ la_chariotte/prod_settings.py`, and the secrets are defined in the admin console. +Here are the settings, with some comments that might be useful. + +```python title="prod_settings.py" +SECRET_KEY = "YOUR SECRET KEY HERE, used to hash the passwords. CHANGE IT." + +# We're connecting to a psql server, AD manages the access and the backups. +DATABASES = { + "default": { + "ENGINE": "django.db.backends.postgresql", + "NAME": "chariotte_prod", + "USER": "chariotte_prod", + "PASSWORD": "", + "HOST": "host", + } +} + +ALLOWED_HOSTS = ["chariotte.fr",] +DEBUG = False + +# We're sending mails using AD infrastructure +EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +EMAIL_FROM = 'notification@chariotte.fr' +EMAIL_HOST = 'smtp-chariotte.alwaysdata.net' +EMAIL_PORT = 587 +EMAIL_HOST_USER = 'notification@chariotte.fr' +EMAIL_HOST_PASSWORD = "XXX" +EMAIL_USE_TLS = True + +DEFAULT_FROM_EMAIL = os.getenv( + "DJANGO_DEFAULT_FROM_EMAIL", "La Chariotte " +) + +CONTACT_MAIL = "contact@chariotte.fr" + +# We're collecting the static files on this specific folder. +STATIC_ROOT = "/home/chariotte/static/" +``` + +We're using sentry (sentry.io) to be alerted when an error happens on the server + +```python title="prod_settings.py" +import sentry_sdk + +sentry_sdk.init( + dsn="PUT YOUR DSN HERE", + # Set traces_sample_rate to 1.0 to capture 100% + # of transactions for performance monitoring. + traces_sample_rate=1.0, + # Set profiles_sample_rate to 1.0 to profile 100% + # of sampled transactions. + # We recommend adjusting this value in production. + profiles_sample_rate=1.0, +) +``` + ### The different sites In the AD console, here are the defined sites: