Closed sfpurdy closed 1 year ago
Many thanks for your contribution. We'll review the changes and respond in due course. However, we'll likely to ask to amend this PR or submit a new one as he Docker changes are in conflict with the upcoming new version we're planning to release shortly. We'll revert back shortly. Again, thank you so much.
Many thanks for your contribution. We'll review the changes and respond in due course. However, we'll likely to ask to amend this PR or submit a new one as he Docker changes are in conflict with the upcoming new version we're planning to release shortly. We'll revert back shortly. Again, thank you so much.
Okay, sounds good. I can update this PR once you publish the changes.
Thanks for your patience. The changes are now push to the repo. Could you please review as agreed and revert back?
Thanks for your patience. The changes are now push to the repo. Could you please review as agreed and revert back?
Yup, I'll review and update this PR.
Changes
Admin Credentials
Added the ability to set admin credentials using environment variables so they don't have to be set once everything is running. This allows for unattended deployments such as in CI/CD pipelines.
bin/celery-entry.sh
flask install
command.enferno/commands.py
install
commandPostgreSQL Connection Dropping
There was an error that caused the PostgreSQL connection to drop when the cached connection goes stale. The fix to the error required the
pool_pre_ping=True
configuration to be passed to SQL Alchemy per the SQLAlchemy Documentation. This fix uses theSQLALCHEMY_ENGINE_OPTIONS
option of theflask-sqlalchemy
module to set thepool_pre_ping
configuration as outlined in the Module Docsenferno/tasks/__init__.py
celery.conf.update({'database_engine_options': cfg.SQLALCHEMY_ENGINE_OPTIONS})
to set the valueenferno/settings.py
SQLALCHEMY_ENGINE_OPTIONS
that defaults toTrue
Redis Configuration
The existing configs for Redis were not working when running in Docker Compose. This adds configuration items to fix the issue and make the naming a bit more consistent.
enferno/settings.py
REDIS_URL_BASE
to use for the other value defaultsREDIS_BROKER_DB
configuration to set the database used in the default value forcelery_broker_url
REDIS_DB
configuration to set the database used in the default value forREDIS_URL
REDIS_RESULT_DB
configuration to set the database used in the default value forresult_backend
celery_broker_url
andresult_backend
using the new Redis hostname and port values by default but still allowCELERY_BROKER_URL
to override it when setSESSION_DB_REDIS
to set the session DB used in the default value forSESSION_REDIS
SESSION_REDIS
string using the separate hostname, port, and newSESSION_DB_REDIS
values to ensure they are consistent but still allowSESSION_REDIS
to override it when setDockerfile
python:3.8.16-slim
becausenumpy
1.22.0 isn't supported on Python 3.7apt-get install
commandpython-pip
as it's not a package in the updated Docker imageexiftool
installation as that's a requirement based on this issuebuild-essential
as the uwgi package instructions require itREDIS_HOSTNAME
REDIS_PASSWORD
REDIS_PORT
REDIS_BROKER_DB
REDIS_DB
REDIS_RESULT_DB
SESSION_DB_REDIS
REDIS_CELERY_HOSTNAME
andREDIS_CELERY_PASSWORD
config itemsCELERY_RESULT_BACKEND
CELERY_BROKER_URL
SESSION_REDIS
and addedSESSION_DB_REDIS
env vars asREDIS_SESSION
is now built using the separate hostname and port values for the Redis serverPostgreSQL Service
postgres/Dockerfile
)postgresql-14-postgis-3
package during the Docker build stage so it doesn't need to be added laterDocker Compose Changes
Adds the ability to run in a Docker Swarm cluster as well as incorporating changes to run more effectively using Docker Compose.
docker-compose.override.yml
docker-compose up -d
). Using it here so the local, development specific settings aren't run in a Docker Swarm contextnginx
service using a profile so it doesn't run by defaultdocker-compose.yml
nginx
service section to the override file as it's not usually needed during local development or in a Docker Swarm/opt/postgres/data
directory as that is a bit more user-friendly than mapping local volumes.env
filecommand
for thecelery
service as the-A
flag has to be set at the global command levellinks
fields as those are automatically setup when running in Docker Compose so specifying them in thelinks
field is redundantdocker-compose.swarm.yml
image
tags and volumes to run in a Docker Swarm clusterCOMPOSE_REGISTRY
environment variable for setting the URL for the private Docker Registry to use to store and fetch imagesMiscellaneous Changes
enferno/admin/models.py
enferno/admin/templates/admin/actors.html
formTitle
return statement, changingthis.translations.newActr_
tothis.translations.newActor_
import-data/create-labels.sql
.env-sample
SESSION_REDIS
,CELERY_BROKER_URL
, andCELERY_RESULT_BACKEND
as using the separate values for Redis hostname and such make things a bit more consistent; left an explanation for when it might be good to uncomment them for use