diff --git a/README.md b/README.md index 491d4a859bcc2c1bf31636ab004f30169cd7a48d..499992a5d5f8c9a614f17f7a267f68f8c962d8bd 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ docker exec -ti ldv-specification python manage.py migrate --settings ldvspec.se ### Start developing - Copy the `ldvspec.example.env`, rename it to `ldvspec.env` and fill in the variables. The variables should match the `local.py` settings which are coherent with the `docker-compose-local.yml` setup. +- Run the docker build for the base image of the Dockerfile + > docker build -f Dockerfile.base -t git.astron.nl:5000/astron-sdc/ldv-specification/base:latest . +- Run the docker-compose build for the local environment from folder `lvdspec` (_Note_: the path from which you build the docker-compose matters here!) + > docker-compose -f ./docker/docker-compose-local.yml build - Run `docker-compose -f docker-compose-local.yml up -d` with the following compose file to spin up a new Postgres container, celery worker and rabbitMQ. - Run the following python commands to start developing - migrate diff --git a/ldvspec/docker/docker-compose-local.yml b/ldvspec/docker/docker-compose-local.yml index 4eb901f4d35736429178947c82a6c5c8dc2b8006..6f354f3c09496d62eb39cd40a594d327c6495410 100644 --- a/ldvspec/docker/docker-compose-local.yml +++ b/ldvspec/docker/docker-compose-local.yml @@ -1,9 +1,6 @@ version: '3.4' networks: ldv_network: - traefik_proxy: - external: - name: traefik_proxy default: driver: bridge @@ -12,14 +9,15 @@ services: image: postgres:14 container_name: ldv-spec-postgres ports: - - "5433:5432" + - "5433:5433" networks: - - traefik_proxy - ldv_network env_file: - ../ldvspec.env volumes: - ldv-spec-db:/var/lib/postgresql/data + command: + - -p 5433 restart: always rabbitmq: @@ -33,6 +31,9 @@ services: ldv-specification-background: container_name: ldv-specification-background image: git.astron.nl:5000/astron-sdc/ldv-specification:${LDVSPEC_VERSION:-latest} + build: + context: .. + dockerfile: ./Dockerfile networks: - ldv_network depends_on: @@ -40,8 +41,11 @@ services: environment: CELERY_BROKER_URL: amqp://guest@rabbitmq:5672 DJANGO_SETTINGS_MODULE: 'ldvspec.settings.local' + DATABASE_HOST_SERVER: ldv-spec-db env_file: - ../ldvspec.env + volumes: + - ../:/src/ command: celery -A ldvspec worker -l INFO restart: always diff --git a/ldvspec/ldvspec.env b/ldvspec/ldvspec.env deleted file mode 100755 index 356d0d57e452b1bb69cba5dfb7715242ab5b25dd..0000000000000000000000000000000000000000 --- a/ldvspec/ldvspec.env +++ /dev/null @@ -1,11 +0,0 @@ -DEBUG=True -POSTGRES_PASSWORD=secret -POSTGRES_USER=postgres -POSTGRES_DB=ldv-spec-db -DATABASE_HOST=ldv-spec-db -DATABASE_PORT=5433 -DATABASE_NAME=ldv-spec-db -DATABASE_USER=postgres -DATABASE_PASSWORD=secret -ATDB_HOST=https://sdc-dev.astron.nl:5554/atdb/ -CELERY_BROKER_URL=amqp://guest@localhost:5672 diff --git a/ldvspec/ldvspec/settings/local.py b/ldvspec/ldvspec/settings/local.py index 97827532c7bf836be7e16ddf63bec56fd461c1dd..6b02c10d0bd136c73ff6edbbc9d104f4a26c1524 100644 --- a/ldvspec/ldvspec/settings/local.py +++ b/ldvspec/ldvspec/settings/local.py @@ -1,3 +1,5 @@ +import os + from ldvspec.settings.base import * DEV = True @@ -8,11 +10,11 @@ CORS_ORIGIN_ALLOW_ALL = True DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'USER': 'postgres', - 'PASSWORD': 'secret', - 'NAME': 'ldv-spec-db', - 'HOST': 'localhost', - 'PORT': '5433', + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'USER': os.getenv("POSTGRES_USER", "postgres"), + 'PASSWORD': os.getenv("POSTGRES_PASSWORD", "secret"), + 'NAME': os.getenv("DATABASE_NAME", "ldv-spec-db"), + 'HOST': os.getenv("DATABASE_HOST_SERVER", "localhost"), + 'PORT': os.getenv("DATABASE_PORT", "5433") }, -} \ No newline at end of file +}