Commit Graph

31 Commits

Author SHA1 Message Date
Klaas van Schelven
e346f8d5c2 Fix useradd in Dockerfile*
exposed while trying to release 2.0.0
2025-09-16 10:55:29 +02:00
Klaas van Schelven
25b7f7c0bc Merge pull request #178 from bugsink/non-root-docker
non-root Docker
2025-09-02 13:01:21 +02:00
Klaas van Schelven
42ba5a71fa Docker: bugsink-show-version on-start 2025-08-02 21:25:33 +02:00
Klaas van Schelven
488d0190bb Docker: use a fixed UID (14237) for the bugsink user
* Rebuilding the image will not accidentally assign a different UID to `bugsink`
  this would be "extremely annoying" in the context of bind-mounts and volumes.
* Ensures predictable ownership for bind-mounts and Docker volumes at build time.
* Avoids collisions with existing host accounts

Considerations for 14237:

* well below the 65535 limit, keeping it compatible with default subuid/subgid mappings.
* Positioned above 1000 to steer clear of standard system and regular user ranges.
* Not so large that older filesystems or tooling (e.g., simple NFS exports) might have issues.

See #176
2025-07-31 11:08:15 +02:00
Klaas van Schelven
48cf7e8e90 Docker.fromwheel: more completely _from wheel_
Before this commit, the COPY command was still used to copy-over 2 files from
the working dir. Alhtough this was probably fine in practice (docker build
typically happens from a checked out state that matches the wheel you're
docker-building) it's not what's on the tin ("from wheel") and it opens up
the possiblity of subtle bugs (file mismatches when building from a different
state). Better prevent those.
2025-07-30 22:33:10 +02:00
Klaas van Schelven
53753bc904 non-root docker: create bugsink-owned /data dir
without it, won't even build (/data creation happened during build
b/c migrations triggered it when the settings were loaded)

See #176
2025-07-30 17:09:25 +02:00
Klaas van Schelven
7905542474 Run Docker gunicorn as non-root (bugsink) user
WIP; does not anser the question of /data/ ownership

See #176
2025-07-30 16:52:58 +02:00
Klaas van Schelven
ab7ad72376 Default worker-count in Docker: min(cpu_count, 4) instead of 1
As per discussion with @sekrause on #101

Briefly: recent reduction is a good idea, but 1 is probably too
little.
2025-05-18 11:18:54 +02:00
Klaas van Schelven
7f2e4b786b Default worker-count in Docker: 1 instead of 10
My reasoning is twofold:

1. a count of 1 is actually probably "enough for many setups" because ingestion
   is very fast anyway (just store the file); while the lower memory-footprint
   that comes with having fewer workers means that adoption of Bugsink will be
   easier.

2. tuning the variable is going to be less annoying if there's no default that
   might override "in the wrong direction" (i.e. the interaction between
   `WEB_CONCURRENCY` and `GUNICORN_CMD_ARGS`)

See #101 (where the concept of customizability was discussed, though not the
present idea of chaning the default).
2025-05-18 09:15:43 +02:00
Klaas van Schelven
ef630ded50 Make number of Gunicorn workers configurable in Docker setup
Fix #101

It becomes configurable by passing an environment-var someting like so
to your `docker run` (or equivalent).

GUNICORN_CMD_ARGS="--workers=123"
2025-05-17 22:17:28 +02:00
Klaas van Schelven
232d2d969d Add HEALTHCHECK command to Dockerfile*
See #98
2025-05-15 16:38:48 +02:00
Klaas van Schelven
be2b5df725 Add working-dir based Dockerfile
Many thanks to @anime-shed's input!
Closes #68
2025-04-04 17:32:01 +02:00
Klaas van Schelven
786a97aaa0 Rename Dockerfile to Dockerfile.fromwheel
See #68 for discussion (which is summarized at the top of the Dockerfile)
2025-04-04 11:41:45 +02:00
Klaas van Schelven
a383aee6c0 Dockerfile: pip install "psycopg[binary]"
needed for testing with the postgres DB backend

See #21, #61
2025-03-17 15:56:36 +01:00
Klaas van Schelven
488b52ea04 prestart command (simplying the throwaway Docker install) 2024-11-06 09:38:54 +01:00
Klaas van Schelven
8594fa2b50 Remove EXPOSE from Dockerfile
it doesn't actually take runtime vars ('-e') into account
https://stackoverflow.com/questions/50178013/docker-expose-using-run-time-environment-variables

we'll just recommend '-p xxxx:xxxx' instead
2024-10-09 10:11:53 +02:00
Klaas van Schelven
4fb14df090 Docker: Port configurable as an env variable 2024-10-03 22:11:50 +02:00
Klaas van Schelven
26276a4a01 Check-before-migrate
do the fast thing, and the read-only thing, first
2024-10-02 23:10:04 +02:00
Klaas van Schelven
83834b8e4b git commit -m "Dockerfile: don't complain about migrations, just migrate
Our goal with having Docker in the first place is to make it easy to
deploy the application. 'just migrating' is a good idea for that goal
in general, but the more so because running migration commands when
the container isn't running yet, while the container refuses to run
without them having run putch you in a catch-22.

(the above may not be strictly true when you run with a database that's
external to your image, i.e. with mysql, because then you can use 'run'
rather than 'exec', but even that feels a bit 'wrongish', because run
starts a container that is then left around for `docker ps -a` to see)

for sqlite containers it's even more pressing, because the writes-to-db
go to different databases for each of the incantations of run (including
server-start). Even if I get this to work (I can't find the solution
in 15 minutes) it will be so clunky to be unworkable.

Theoretical concerns about not migrating on-server-start (but rather,
as part of some CI/CD script or something) will have take take a back-seat
to the reasoning above... if they even hold up at all).
2024-10-02 22:58:42 +02:00
Klaas van Schelven
2e70197825 Add check_migrations command
this way, at least in the Docker setup, you'll get a meaningful error when you
try to start up a half-baked server
2024-09-09 15:31:14 +02:00
Klaas van Schelven
67cfbb58d7 Use 'monofy' package now that it is extracted 2024-09-04 22:54:27 +02:00
Klaas van Schelven
b1baa529d4 Use '&&' and '|||' in server-unified syntax 2024-08-29 08:39:34 +02:00
Klaas van Schelven
4c38473865 server-unified: generalize for serial/parallel approach that is not django-specific 2024-08-29 08:34:06 +02:00
Klaas van Schelven
4e613a943e Port 8000 as the default port _everywhere_
This is more canonical with stuff 'elsewhere on the internet'

we already did it behind-the-scenes for 'recommended gunicorn', so the
harmonization is in having the same default for the rest.
2024-08-28 15:21:00 +02:00
Klaas van Schelven
14ffbb7a48 Docker: configurable using env vars 2024-08-28 12:37:13 +02:00
Klaas van Schelven
98b08cb2e3 Run PYTHONUNBUFFERED
'for good measure'; I've seen this before and remembered it (i.e. I have not
actually observed a need for it this time).

https://stackoverflow.com/a/59812588/339144
2024-08-27 21:57:02 +02:00
Klaas van Schelven
f6c43d4d6d bugsink-server-unified: run in Docker 2024-08-27 21:53:13 +02:00
Klaas van Schelven
e4174d1e64 mysqlclient out of requirements.txt
just install it where we need it, namely in the Docker image
2024-08-27 09:50:31 +02:00
Klaas van Schelven
f20104770e Docker from wheel, not sourcecode
this way we reuse all the thinking we did when getting the Python wheels in order.
* what to include/exclude
* setting up the scripts
2024-08-27 09:48:39 +02:00
Klaas van Schelven
200ea5eb84 Docker image: Ubuntu -> python-slim
* I'd rather harmonize with "the docker way" than with my own recommended setup
* slim: expectation is that this is smaller (not checked)
* this is a 2-stage build (slim has no gcc, needed for mysql)
* PEP668 does not apply here ("externally managed"), which leads to
* better ergonomics: no env/bin/some-command
2024-08-27 09:04:42 +02:00
Klaas van Schelven
d00d007306 Dockerfile(s): the afternoon's progress 2024-08-26 20:37:55 +02:00