WIP: spike: add devcontainers #74

Draft
Luke-Watts wants to merge 3 commits from spike/add-devcontainers into main
Owner

What

This PR adds Dev Container support to the Makerspace Leiden CRM project, providing a pre-configured, consistent development environment that works across VS Code, Dev Containers CLI, and Docker.

Why

To lower the barrier to contribution by eliminating manual setup. New contributors can start developing with just Docker installed—no need to manually configure Python, dependencies, databases, or tooling.

Changes

File Change
.devcontainer/Dockerfile Python 3.13 container with uv, git, build-essential
.devcontainer/devcontainer.json VS Code config: port forwarding (8000/8080), extensions, settings
.devcontainer/postCreateCommand.sh Auto-setup: installs deps, pre-commit, runs migrations, creates admin user
.devcontainer/README.md Comprehensive usage guide for all container workflows
CONTRIBUTING.md Added Dev Container as recommended setup path
README.md Added Dev Container badge and Quick Start guide
INSTALL.md Updated repository URL reference
.claude/settings.local.json Permissions for CI/tooling access

Dev Container Features

  • Zero-install: Only Docker required on host machine
  • Consistent environment: Same setup for all developers (Python 3.13, uv, all deps)
  • Auto-configured:
    • Dependencies installed via uv sync
    • Pre-commit hooks installed
    • Database migrations run
    • Default admin user created (admin/admin123)
    • Demo data loaded (optional via LOAD_DEMO_DATA=true)
  • Ports forwarded: 8000 (Django), 8080 (alternative)
  • VS Code extensions: Python, Pylance, Black, Ruff, Django, GitLens, SQLTools
  • Workspace settings: Format on save, organizers, rulers at 88/120 cols

Usage

VS Code

  1. Clone repo → Open in VS Code → "Reopen in Container"
  2. Wait for setup (~2-3 min first run)
  3. Open http://localhost:8000 → Login: admin/admin123

Dev Containers CLI

devcontainer up --workspace-folder . --remove-existing-container

Docker

docker build -t msl-crm -f .devcontainer/Dockerfile .
docker run -it -v $(pwd):/workspace -p 8000:8000 msl-crm

Checks

All CI tests passing (1m36s - 1m38s)

## What This PR adds **Dev Container** support to the Makerspace Leiden CRM project, providing a pre-configured, consistent development environment that works across VS Code, Dev Containers CLI, and Docker. ## Why To lower the barrier to contribution by eliminating manual setup. New contributors can start developing with just Docker installed—no need to manually configure Python, dependencies, databases, or tooling. ## Changes | File | Change | |------|--------| | `.devcontainer/Dockerfile` | Python 3.13 container with uv, git, build-essential | | `.devcontainer/devcontainer.json` | VS Code config: port forwarding (8000/8080), extensions, settings | | `.devcontainer/postCreateCommand.sh` | Auto-setup: installs deps, pre-commit, runs migrations, creates admin user | | `.devcontainer/README.md` | Comprehensive usage guide for all container workflows | | `CONTRIBUTING.md` | Added Dev Container as recommended setup path | | `README.md` | Added Dev Container badge and Quick Start guide | | `INSTALL.md` | Updated repository URL reference | | `.claude/settings.local.json` | Permissions for CI/tooling access | ## Dev Container Features - **Zero-install**: Only Docker required on host machine - **Consistent environment**: Same setup for all developers (Python 3.13, uv, all deps) - **Auto-configured**: - Dependencies installed via `uv sync` - Pre-commit hooks installed - Database migrations run - Default admin user created (`admin`/`admin123`) - Demo data loaded (optional via `LOAD_DEMO_DATA=true`) - **Ports forwarded**: 8000 (Django), 8080 (alternative) - **VS Code extensions**: Python, Pylance, Black, Ruff, Django, GitLens, SQLTools - **Workspace settings**: Format on save, organizers, rulers at 88/120 cols ## Usage ### VS Code 1. Clone repo → Open in VS Code → "Reopen in Container" 2. Wait for setup (~2-3 min first run) 3. Open `http://localhost:8000` → Login: `admin`/`admin123` ### Dev Containers CLI ```bash devcontainer up --workspace-folder . --remove-existing-container ``` ### Docker ```bash docker build -t msl-crm -f .devcontainer/Dockerfile . docker run -it -v $(pwd):/workspace -p 8000:8000 msl-crm ``` ## Checks ✅ All CI tests passing (1m36s - 1m38s)
spike: add devcontainers
All checks were successful
Verify Pull Request / tests (pull_request) Successful in 1m38s
3205ffc85c
Luke-Watts changed title from spike: add devcontainers to WIP spike: add devcontainers 2026-05-29 13:18:48 +02:00
Luke-Watts changed title from WIP spike: add devcontainers to WIP: spike: add devcontainers 2026-05-29 13:18:57 +02:00
docs: update stale git repo reference
All checks were successful
Verify Pull Request / tests (pull_request) Successful in 1m36s
96dea73fad
Contributor

My admin user could not be automatically created. I get the following output in the console:

[4/4] Creating default admin user...
Creating admin user (username: admin, password: admin123)
WARNING -- no local configs. You propably want to copy makerspaceleiden/debug.py to local.py & tweak it !!
⚠ Could not create admin user

When I run the failing script manually, I get this:
image

On my machine, it was fixed by removing the first argument "admin", and then the username is just the email address "admin@makerspaceleiden.nl". I don't know why it doesn't work otherwise though, as my IntelliSense also just says there's 3 parameters (4 if you include self): username, email and password. Maybe there's some version discrepancy somewhere?

My admin user could not be automatically created. I get the following output in the console: ``` [4/4] Creating default admin user... Creating admin user (username: admin, password: admin123) WARNING -- no local configs. You propably want to copy makerspaceleiden/debug.py to local.py & tweak it !! ⚠ Could not create admin user ``` When I run the failing script manually, I get this: ![image](/attachments/1d1128db-c58b-4c46-9089-357ae95553f4) On my machine, it was fixed by removing the first argument "admin", and then the username is just the email address "admin@makerspaceleiden.nl". I don't know why it doesn't work otherwise though, as my IntelliSense also just says there's 3 parameters (4 if you include `self`): username, email and password. Maybe there's some version discrepancy somewhere?
259 KiB
Contributor

the dev container also keeps needing to reconnect for me, as it appears Podman hangs a lot when I try to run this project.

I use Podman instead of Docker as I didn't want to violate the docker desktop licensing rules. I have run other containers before that work fine.

the dev container also keeps needing to reconnect for me, as it appears Podman hangs a lot when I try to run this project. I use Podman instead of Docker as I didn't want to violate the docker desktop licensing rules. I have run other containers before that work fine.
Author
Owner

We can probably strip out the admin user creation in the postCreateCommand.sh as we already create one during the loaddemo.sh script.

Credentials for this user are,
username: admin@admin.nl
password: 1234

We can probably strip out the admin user creation in the postCreateCommand.sh as we already create one during the loaddemo.sh script. Credentials for this user are, username: admin@admin.nl password: 1234
Author
Owner

@Ference-Nieuwkerk wrote in #74 (comment):

My admin user could not be automatically created. I get the following output in the console:

[4/4] Creating default admin user...
Creating admin user (username: admin, password: admin123)
WARNING -- no local configs. You propably want to copy makerspaceleiden/debug.py to local.py & tweak it !!
⚠ Could not create admin user

When I run the failing script manually, I get this: image

On my machine, it was fixed by removing the first argument "admin", and then the username is just the email address "admin@makerspaceleiden.nl". I don't know why it doesn't work otherwise though, as my IntelliSense also just says there's 3 parameters (4 if you include self): username, email and password. Maybe there's some version discrepancy somewhere?

Can you confirm the steps you took to get to this output?

@Ference-Nieuwkerk wrote in https://code.makerspaceleiden.nl/msl/intranet/pulls/74#issuecomment-430: > My admin user could not be automatically created. I get the following output in the console: > > ```text > [4/4] Creating default admin user... > Creating admin user (username: admin, password: admin123) > WARNING -- no local configs. You propably want to copy makerspaceleiden/debug.py to local.py & tweak it !! > ⚠ Could not create admin user > ``` > > When I run the failing script manually, I get this: [![image](/attachments/1d1128db-c58b-4c46-9089-357ae95553f4)](/msl/intranet/attachments/1d1128db-c58b-4c46-9089-357ae95553f4) > > On my machine, it was fixed by removing the first argument "admin", and then the username is just the email address "admin@makerspaceleiden.nl". I don't know why it doesn't work otherwise though, as my IntelliSense also just says there's 3 parameters (4 if you include `self`): username, email and password. Maybe there's some version discrepancy somewhere? Can you confirm the steps you took to get to this output?
Author
Owner

@Ference-Nieuwkerk wrote in #74 (comment):

I use Podman instead of Docker as I didn't want to violate the docker desktop licensing rules.

To my knowledge Docker Desktop is freely available for education, open source and non-commercial work. Do the logs either from the container or podman suggest a potential reason for the crashing?

I can't remember if you're on a MacOS, but if so I can recommend https://docs.orbstack.dev as an alternative.

@Ference-Nieuwkerk wrote in https://code.makerspaceleiden.nl/msl/intranet/pulls/74#issuecomment-431: > I use Podman instead of Docker as I didn't want to violate the docker desktop licensing rules. To my knowledge Docker Desktop is freely available for education, open source and non-commercial work. Do the logs either from the container or podman suggest a potential reason for the crashing? I can't remember if you're on a MacOS, but if so I can recommend https://docs.orbstack.dev as an alternative.
clean the stage
All checks were successful
Verify Pull Request / tests (pull_request) Successful in 1m38s
02729362ad
All checks were successful
Verify Pull Request / tests (pull_request) Successful in 1m38s
Required
Details
This pull request has changes conflicting with the target branch.
  • README.md
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin spike/add-devcontainers:spike/add-devcontainers
git switch spike/add-devcontainers
Sign in to join this conversation.
No reviewers
No labels
Draft
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
msl/intranet!74
No description provided.