diff --git a/INSTALL.md b/INSTALL.md index 12c5608..04c8cfc 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -36,4 +36,7 @@ system. 3. Tweak this file as necessary (see comments in the file) 2. $ run docker-compose up (keep this terminal open, and open a second one for subsequent commands) 3. Create a first superuser (administrator): -$ docker-compose exec pterois poetry run python manage.py createsuperuser \ No newline at end of file +$ docker-compose exec pterois poetry run python manage.py createsuperuser +4. Create a few species before running the first import (see below) +5. Run the first import: +6. $ docker-compose exec pterois poetry run python manage.py import_observations \ No newline at end of file diff --git a/README.md b/README.md index 9afe5ba..7cfe7fc 100644 --- a/README.md +++ b/README.md @@ -25,4 +25,10 @@ See [INSTALL.md](INSTALL.md). ## Pterois instances in the wild - [LIFE RIPARIAS Early Alert](https://alert.riparias.be) (Targets riparian invasive species in Belgium) -- [Pterois demo instance](https://pterois-demo.niconoe.eu/) (Always in sync with the `devel` branch of this repository) \ No newline at end of file +- [Pterois demo instance](https://pterois-demo.niconoe.eu/) (Always in sync with the `devel` branch of this repository) + +TODO next Docker: + +- Polish documentation +- Add more steps (create species, run first import, etc.) +- Push images to dockerhub \ No newline at end of file diff --git a/djangoproject/local_settings_docker.template.py b/djangoproject/local_settings_docker.template.py index 4f51198..ac238ac 100644 --- a/djangoproject/local_settings_docker.template.py +++ b/djangoproject/local_settings_docker.template.py @@ -39,8 +39,8 @@ ), # Languages available in the interface. Subset of the languages in `LANGUAGES`. # A Gbif.org account is necessary to automatically download observations via the `import_observations` command "GBIF_DOWNLOAD_CONFIG": { - "USERNAME": "niconoe2", - "PASSWORD": "ITAots!12", + "USERNAME": "aaaa", + "PASSWORD": "bbbb", "COUNTRY_CODE": "BE", # Only download observations from this country "MINIMUM_YEAR": 2000, # Observations must be from this year or later }, diff --git a/djangoproject/local_settings_docker_base.py b/djangoproject/local_settings_docker_base.py index a42a3a1..a89b389 100644 --- a/djangoproject/local_settings_docker_base.py +++ b/djangoproject/local_settings_docker_base.py @@ -16,10 +16,9 @@ # Redis configuration for django-rq RQ_QUEUES = { "default": { - "HOST": "localhost", + "HOST": "redis", "PORT": 6379, "DB": 0, - # "PASSWORD": "some-password", "DEFAULT_TIMEOUT": 360, }, } @@ -27,4 +26,7 @@ ALLOWED_HOSTS = ["0.0.0.0", "localhost"] STATIC_URL = "/static/" -STATIC_ROOT = BASE_DIR / "staticfiles" \ No newline at end of file +STATIC_ROOT = BASE_DIR / "staticfiles" + +CSRF_TRUSTED_ORIGINS = ["http://localhost:1337"] +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') diff --git a/docker-compose.yml b/docker-compose.yml index 0884a14..4be0f74 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,4 @@ version: '3' -# TODO: add/configure Redis services: nginx: @@ -18,12 +17,39 @@ services: - POSTGRES_PASSWORD=pteroisdb - POSTGRES_USER=pteroisdb - POSTGRES_DB=pteroisdb + healthcheck: + test: ['CMD-SHELL', 'psql -h localhost -U $${POSTGRES_USER} -c select 1 -d $${POSTGRES_DB}'] + interval: 5s + timeout: 5s + retries: 5 + redis: + image: redis:7.0.12 + expose: + - 6379 pterois: image : pterois:1.0 expose: - 8000 depends_on: - - db + db: + condition: service_healthy + redis: + condition: service_started + + volumes: + - static_volume:/app/staticfiles + - type: bind + source: ./local_settings_docker.py + target: /app/djangoproject/local_settings_docker.py + read_only: true + rqworker: + image: pterois:1.0 + entrypoint: poetry run python manage.py rqworker default + depends_on: + db: + condition: service_healthy + redis: + condition: service_started volumes: - static_volume:/app/staticfiles - type: bind