new file mode 100644
@@ -0,0 +1,6 @@
+DJANGO_SETTINGS_MODULE = 'docker.settings'
+DEBUG = 1
+SECRET_KEY = 'replace-me'
+HOSTNAME = 'localhost'
+EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
+BASE_DIR = '/opt/layerindex'
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,63 @@
+{
+ "name": "Layerindex Web Development Container",
+ "dockerComposeFile": "docker-compose.yml",
+ "service": "app",
+ "workspaceFolder": "/opt/layerindex",
+ "postCreateCommand": "pip install ruff pytest && python3 manage.py migrate",
+ "remoteUser": "layers",
+ "forwardPorts": [
+ 8000
+ ],
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ // Python extensions, since this is a Python/Django project
+ "ms-python.python",
+ // Include Pylance for type checking
+ "ms-python.vscode-pylance",
+ // Debugging support
+ "ms-python.debugpy",
+ // Ruff linter
+ "charliermarsh.ruff",
+ // Beautiful syntax and scoped snippets for Django
+ "batisteo.vscode-django",
+ // SQL tools allowing to connect to the database
+ "mtxr.sqltools-driver-mysql"
+ ],
+ "settings": {
+ "terminal.integrated.defaultProfile.linux": "bash",
+ "python.defaultInterpreterPath": "/usr/bin/python3",
+ "remote.autoForwardPorts": false,
+ "sqltools.connections": [
+ {
+ "mysqlOptions": {
+ "authProtocol": "default",
+ "enableSsl": "Disabled"
+ },
+ "ssh": "Disabled",
+ "previewLimit": 50,
+ "server": "layersdb",
+ "port": 3306,
+ "driver": "MariaDB",
+ "name": "layersdb",
+ "database": "layersdb",
+ "username": "root",
+ "password": "testingpw"
+ }
+ ],
+ "editor.formatOnSaveMode": "modifications",
+ "[jsonc]": {
+ "editor.defaultFormatter": "vscode.json-language-features"
+ },
+ "[python]": {
+ "editor.defaultFormatter": "charliermarsh.ruff"
+ },
+ "python.testing.unittestEnabled": false,
+ "python.testing.pytestEnabled": true,
+ "editor.rulers": [
+ 80
+ ]
+ }
+ }
+ }
+}
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,56 @@
+services:
+ layersdb:
+ image: mariadb:lts
+ environment:
+ MARIADB_DATABASE: layersdb
+ MARIADB_ROOT_PASSWORD: testingpw
+ healthcheck:
+ test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
+ start_period: 10s
+ interval: 5s
+ timeout: 5s
+ retries: 5
+ command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --wait_timeout=28800 --max_allowed_packet=128M
+
+ layersrabbit:
+ image: rabbitmq:alpine
+ healthcheck:
+ test: rabbitmq-diagnostics -q ping
+ start_period: 10s
+ interval: 5s
+ timeout: 5s
+ retries: 5
+
+ app:
+ depends_on:
+ layersdb:
+ condition: service_healthy
+ layersrabbit:
+ condition: service_healthy
+ build: ..
+ image: yoctoproject/layerindex-web
+ working_dir: /opt/layerindex
+ volumes:
+ - ..:/opt/layerindex
+ - workdir:/opt/workdir
+ env_file:
+ - .env
+ command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
+
+ celery:
+ depends_on:
+ layersdb:
+ condition: service_healthy
+ layersrabbit:
+ condition: service_healthy
+ image: yoctoproject/layerindex-web
+ working_dir: /opt/layerindex
+ volumes:
+ - ..:/opt/layerindex:ro
+ - workdir:/opt/workdir
+ env_file:
+ - .env
+ command: /usr/local/bin/celery --workdir=/opt/layerindex --app layerindex.tasks worker --loglevel=INFO
+
+volumes:
+ workdir:
new file mode 100644
@@ -0,0 +1,50 @@
+VSCode + DevContainers Setup
+----------------------------
+
+If you already use VSCode and Docker, you can setup the local development
+environment using preconfigured DevContainers extension.
+
+Getting Started
+---------------
+
+1. Install Dev Containers extension (ms-vscode-remote.remote-containers)
+2. Open local clone of this repository in VSCode
+3. Click on "Reopen in Container" when prompted by VSCode
+4. Wait 1-2 minutes for VSCode to setup your DevContainer
+
+Once the DevContainer setup process is completed, you'll have access to:
+
+* Django development server running at http://localhost:8000
+* All Django database migrations applied
+* PyTest autodiscovery and debugger configured
+* Database client extension configured with the local server
+* Code linting and formatting with ruff
+* Command line git support with your SSH keys mounted in the container
+
+FAQ
+---
+
+1. How do I import master branch from the public instance?
+
+ Run the following command in the VSCode Terminal:
+
+ $ layerindex/tools/import_layers.py https://layers.openembedded.org
+
+
+2. How do I see emails sent by the development system?
+
+ Emails are logged to the standard output of the layerindex-web container.
+
+ To see the logs:
+
+ 1. Open the Command Palette: Ctrl+Shift+P / Cmd+Shift+P
+ 2. Type: "Remote Explorer: Focus on Dev Containers View"
+ 3. Right-click on the layerindex-web container
+ 4. Select "Show Container Log"
+
+
+3. How do I interact with Django's manage.py script?
+
+ Open a new terminal window in VSCode and type:
+
+ $ ./manage.py ...
\ No newline at end of file
This lowers the barrier of entry for new contributors by setting up a completely functional layerindex system from a clean repository. More on dev containers: https://containers.dev Signed-off-by: Piotr Buliński <piotr@qbee.io> --- .devcontainer/.env | 6 +++ .devcontainer/devcontainer.json | 63 ++++++++++++++++++++++++++++++++ .devcontainer/docker-compose.yml | 56 ++++++++++++++++++++++++++++ README.vscode | 50 +++++++++++++++++++++++++ 4 files changed, 175 insertions(+) create mode 100644 .devcontainer/.env create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yml create mode 100644 README.vscode