'recommended' setup: point slightly less strongly in this direction

I'm personally a big fan of the single-server setup, but the reality is that a lot of
people like Docker, and we don't want to scare people away from the Docker setup either
(especially since it's pretty good these days)
This commit is contained in:
Klaas van Schelven
2024-12-02 14:56:28 +01:00
parent ccd0db8701
commit 7849cf27b5
3 changed files with 16 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
# Generated using bugsink-create-conf --template=recommended
# This is the configuration for the recommended setup for Bugsink in production.
# Generated using bugsink-create-conf --template=singleserver
# This is the configuration for the singleserver setup for Bugsink in production.
from bugsink.settings.default import * # noqa
from bugsink.utils import deduce_allowed_hosts, eat_your_own_dogfood
@@ -9,8 +9,9 @@ SECRET_KEY = "{{ secret_key }}"
# Note: the recommended setup uses a reverse proxy (i.e. Nginx) in front of the Django server. This is why we trust the
# X-Forwarded-Proto and X-Real-IP headers. If you do not use a reverse proxy, you should remove these settings.
# Note: the singleserver production setup uses a reverse proxy (i.e. Nginx) in front of the Django server. This is why
# we trust the X-Forwarded-Proto and X-Real-IP headers. If you do not use a reverse proxy, you should remove these
# settings.
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') # Note: slightly redundant, Gunicorn also does this.
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
@@ -20,8 +21,8 @@ USE_X_REAL_IP = True
# X_FORWARDED_FOR_PROXY_COUNT = 1
# In the recommended setup, the database is SQLite. The single (unix) user is named `bugsink` and we put the database in
# its home directory:
# In the singleserver production setup, the database is SQLite. The single (unix) user is named `bugsink` and we put
# the database in its home directory:
DATABASES["default"]["NAME"] = '{{ base_dir }}/db.sqlite3'
DATABASES["snappea"]["NAME"] = '{{ base_dir }}/snappea.sqlite3'
@@ -37,7 +38,7 @@ eat_your_own_dogfood(SENTRY_DSN)
TIME_ZONE = 'UTC' # alternatively, e.g. 'Europe/Amsterdam'
# In the recommended (production) setup, we use Snappea for background tasks.
# In the singleserver production setup, we use Snappea for background tasks.
SNAPPEA = {
"TASK_ALWAYS_EAGER": False,
"NUM_WORKERS": 4,
@@ -80,8 +81,8 @@ BUGSINK = {
"SINGLE_TEAM": False,
"TEAM_CREATION": CB_MEMBERS, # who can create new teams. default: members, which means "any member of the site"
# In the recommended setup, we do not digest events immediately, but instead offload this to Snappea. This ensures a
# more response and reliable server when there are peak loads in the events.
# In the singleserver production setup, we do not digest events immediately, but instead offload this to Snappea.
# This ensures a more response and reliable server when there are peak loads in the events.
"DIGEST_IMMEDIATELY": False,
# "MAX_EVENT_SIZE": _MEBIBYTE,

View File

@@ -10,13 +10,13 @@ def main():
parser = argparse.ArgumentParser(description="Create a configuration file.")
parser.add_argument("--output-file", "-o", help="Output file", default="bugsink_conf.py")
parser.add_argument(
"--template", help="Template to use; recommended or local", choices=["recommended", "local", "docker"],
"--template", help="Template to use", choices=["singleserver", "local", "docker"],
required=True)
parser.add_argument("--port", help="Port to use in BASE_URL ; default is 8000", type=int, default=8000)
parser.add_argument("--host", help="Host to use in BASE_URL ; default is localhost", default="localhost")
parser.add_argument(
"--base-dir", help="base dir for databases, snappea, and ingestion store ('recommended' template only)",
"--base-dir", help="base dir for databases, snappea, and ingestion store ('singleserver' template only)",
default="/home/bugsink")
args = parser.parse_args()
@@ -24,8 +24,8 @@ def main():
print("Output file already exists; please remove it first")
sys.exit(1)
if args.base_dir != "/home/bugsink" and args.template != "recommended":
print("The base-dir option is only used in the 'recommended' template")
if args.base_dir != "/home/bugsink" and args.template != "singleserver":
print("The base-dir option is only used in the 'singleserver' template")
sys.exit(1)
secret_key = get_random_secret_key()

View File

@@ -7,7 +7,7 @@ from pathlib import Path
from django.utils.log import DEFAULT_LOGGING
# We have a single file for our default settings, and expect (if they use the recommended setup) the end-users to
# We have a single file for our default settings, and expect (if they use the singleserver setup) the end-users to
# configure their setup using a single bugsink_conf.py also. To be able to have (slightly) different settings for e.g.
# logging for various commands, we expose a variable I_AM_RUNNING that can be used to determine what command is being
# run. We use (potentially fragile) sys.argv checks to determine what command is being run. For now "it works, don't
@@ -102,7 +102,7 @@ MIDDLEWARE = [
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# NOTE: _most_ useful while building Bugsink; in the recommended production setup the timings/counts of this
# NOTE: _most_ useful while building Bugsink; in the singleserver production setup the timings/counts of this
# middleware are not logged to a visible location; and this feature is undocumented. However, it _could_ prove
# useful in such contexts too, so I'm not going to put it behind a conditional.
'bugsink.middleware.PerformanceStatsMiddleware',