diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..b44518ca --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,24 @@ +FROM mcr.microsoft.com/devcontainers/python:1-3.8-bookworm + +ENV PYTHONUNBUFFERED 1 + +# Install additional OS packages. +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + libffi-dev \ + libfreetype6-dev \ + libjpeg-dev \ + libwebp-dev \ + libpng-dev \ + liblcms2-dev \ + zlib1g-dev \ + libmemcached-dev \ + libsasl2-dev \ + inkscape \ + xmlsec1 + +# Install our requirements now, as they rarely change. +COPY constraints.txt requirements.txt /tmp/pip-tmp/ +RUN pip3 install -U pip \ + && pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt -c /tmp/pip-tmp/constraints.txt \ + && rm -rf /tmp/pip-tmp \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..765fda53 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,33 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile +{ + "name": "Conference Website", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspace", + + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + // "ghcr.io/devcontainers/features/python:1": { + // "installTools": true, + // "version": "3.12" + // } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [8000], + + // Uncomment the next line to run commands after the container is created. + "postCreateCommand": ".devcontainer/post-create.sh", + + // Ensure the workspace directory is marked as safe for git operations. + "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // NOTE: Need to use "root" when using rootless docker on linux. + "remoteUser": "root", + "containerUser": "root" +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 00000000..ee03c10f --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,45 @@ +# Docker Compose setup for developing Symposion/Registrasion/RegiDesk + +services: + app: + build: + context: .. + dockerfile: .devcontainer/Dockerfile + + environment: + DATABASE_URL: postgres://postgres:postgres@db:5432/postgres + DJANGO_SECRET_KEY: 5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B + STRIPE_PUBLIC_KEY: 5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B + STRIPE_SECRET_KEY: 5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B + GCS_BUCKET: 5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B + GOOGLE_APPLICATION_CREDENTIALS: /dev/null + SYMPOSION_DEV_MODE: LAPTOP + SYMPOSION_APP_DEBUG: 1 + + volumes: + - ../:/workspace:cached + + # Overrides default command so things don't shut down after the process ends. + command: sleep infinity + + # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. + network_mode: service:db + + # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) + + db: + image: postgres:latest + restart: unless-stopped + volumes: + - postgres-data:/var/lib/postgresql/data + environment: + POSTGRES_USER: postgres + POSTGRES_DB: postgres + POSTGRES_PASSWORD: postgres + + # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) + +volumes: + postgres-data: \ No newline at end of file diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100755 index 00000000..ecdce07f --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,6 @@ +#!/usr/bin/bash + +pip install --user -r requirements.txt -c constraints.txt +pip install --user -c constraints.txt -e vendor/registrasion +pip install --user -c constraints.txt -e vendor/registripe +pip install --user -c constraints.txt -e vendor/regidesk \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 2353264e..266e0f3e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8-buster as symposion_base +FROM python:3.8-bookworm as symposion_base RUN set -ex \ && apt-get update @@ -14,8 +14,9 @@ RUN set -ex \ libmemcached-dev \ libsasl2-dev \ inkscape \ + xmlsec1 \ ' \ - && apt-get install -y git xmlsec1 \ + && apt-get install -y git \ && apt-get install -y $buildDeps --no-install-recommends \ && rm -rf /var/lib/apt/lists/* diff --git a/docker/deploy_with_sqlite.sh b/docker/deploy_with_sqlite.sh index 4505fefd..c5c42cee 100755 --- a/docker/deploy_with_sqlite.sh +++ b/docker/deploy_with_sqlite.sh @@ -3,7 +3,7 @@ /usr/local/bin/python /app/symposion_app/manage.py migrate /usr/local/bin/python /app/symposion_app/manage.py loaddata /app/symposion_app/fixtures/{conference,sites,sitetree,flatpages}.json /usr/local/bin/python /app/symposion_app/manage.py create_review_permissions -/usr/local/bin/python /app/symposion_app/manage.py loaddata /app/symposion_app/fixtures/????/*.json +/usr/local/bin/python /app/symposion_app/manage.py loaddata /app/symposion_app/fixtures/sessions/*.json #/usr/local/bin/python /app/symposion_app/manage.py populate_inventory if [ -e /configs/auth/auth.json ]; then diff --git a/requirements.txt b/requirements.txt index 9a1d1c56..80e6abe1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,6 +15,7 @@ django-waffle==2.0.0 # database mysqlclient==2.0.1 +psycopg2==2.8.6 # For testing django-nose==1.4.7 diff --git a/vendor/regidesk/requirements.txt b/vendor/regidesk/requirements.txt index 165a9dc3..b4f84da1 100644 --- a/vendor/regidesk/requirements.txt +++ b/vendor/regidesk/requirements.txt @@ -1,4 +1,4 @@ -django-countries>=6.1.3 +django-countries==7.3.2 requests>=2.24.0 pypng pyqrcode diff --git a/vendor/registripe/requirements.txt b/vendor/registripe/requirements.txt index b522cc4b..0510f789 100644 --- a/vendor/registripe/requirements.txt +++ b/vendor/registripe/requirements.txt @@ -1,4 +1,4 @@ -django-countries>=6.1.3 +django-countries==7.3.2 pinax-stripe==4.4.0 requests>=2.24.0 stripe==2.55.0