diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 795e29dd5c..d487346c8d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,33 +1,24 @@ // 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-docker-compose +// README at: https://github.com/devcontainers/templates/tree/main/src/python { - "name": "Care", - "dockerComposeFile": [ - "../docker-compose.yaml", - "../docker-compose.local.yaml" - ], + "name": "Care", "hostRequirements": { "cpus": 4 }, - "waitFor": "onCreateCommand", - "service": "backend", - "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", - "postCreateCommand": "python manage.py migrate && python manage.py collectstatic --noinput && python manage.py load_dummy_data", - "postAttachCommand": { - "server": "python manage.py runserver" - }, - "customizations": { - "vscode": { - "extensions": [ - "ms-python.python" - ] - } - }, - "portsAttributes": { - "8000": { - "label": "Application", - "onAutoForward": "openPreview" + "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm", + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/node:1": {}, + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers-contrib/features/pipenv:2": {}, + "ghcr.io/devcontainers-contrib/features/direnv:1": {}, + "ghcr.io/devcontainers-contrib/features/apt-get-packages:1": { + "packages": "build-essential,libjpeg-dev,zlib1g-dev,libpq-dev,gettext,wget,curl,gnupg", + "preserve_apt_list": false } }, - "forwardPorts": [9000] + "postCreateCommand": "echo 'eval \"$(direnv hook bash)\"' >> ~/.bashrc && cp .env.example .env", + "postAttachCommand": "make up", + "forwardPorts": [8000, 9000, 4000] } diff --git a/.env.example b/.env.example new file mode 100644 index 0000000000..091bea02fd --- /dev/null +++ b/.env.example @@ -0,0 +1,20 @@ +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres +POSTGRES_HOST=db +POSTGRES_DB=care +POSTGRES_PORT=5432 +DATABASE_URL=postgres://postgres:postgres@localhost:5433/care +REDIS_URL=redis://localhost:6380 +CELERY_BROKER_URL=redis://localhost:6380/0 + +FIDELIUS_URL=http://localhost:8092 + +DJANGO_DEBUG=False + +BUCKET_REGION=ap-south-1 +BUCKET_KEY=key +BUCKET_SECRET=secret +BUCKET_ENDPOINT=http://localhost:4566 +BUCKET_EXTERNAL_ENDPOINT=http://localhost:4566 +FILE_UPLOAD_BUCKET=patient-bucket +FACILITY_S3_BUCKET=facility-bucket diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 41484c2e8d..e9a27996a6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -23,3 +23,8 @@ updates: directory: "/" schedule: interval: "weekly" + + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/.github/workflows/test-base.yml b/.github/workflows/test-base.yml index e295ac88c9..b58e829aa0 100644 --- a/.github/workflows/test-base.yml +++ b/.github/workflows/test-base.yml @@ -30,7 +30,15 @@ jobs: files: docker-compose.yaml,docker-compose.local.yaml - name: Start services - run: docker compose -f docker-compose.yaml -f docker-compose.local.yaml up -d --wait --no-build + run: | + docker compose \ + -f docker-compose.yaml \ + -f docker-compose.local.yaml \ + up -d --wait ||\ + docker compose \ + -f docker-compose.yaml \ + -f docker-compose.local.yaml \ + logs - name: Check migrations run: make checkmigration diff --git a/README.md b/README.md index ce601d095b..c4ac20362f 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ [![Cookiecutter Django](https://img.shields.io/badge/built%20with-Cookiecutter%20Django-ff69b4.svg)](https://github.com/pydanny/cookiecutter-django/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Chat](https://img.shields.io/badge/-Join%20us%20on%20slack-7b1c7d?logo=slack)](https://slack.coronasafe.in/) +[![Open in Dev Containers](https://img.shields.io/static/v1?label=&message=Open%20in%20Dev%20Containers&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/coronasafe/care) This is the backend for care. an open source platform for managing patients, health workers, and hospitals. diff --git a/docker-compose.yaml b/docker-compose.yaml index 7959c927d3..11cfcc0a9c 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -12,12 +12,16 @@ services: - ./docker/.prebuilt.env volumes: - postgres-data:/var/lib/postgresql/data + ports: + - "5433:5432" redis: image: redis/redis-stack-server:6.2.6-v10 restart: unless-stopped volumes: - redis-data:/data + ports: + - "6380:6379" localstack: image: localstack/localstack:latest @@ -37,6 +41,8 @@ services: fidelius: image: khavinshankar/fidelius:latest restart: unless-stopped + ports: + - "8092:8090" volumes: postgres-data: