Streamlined dev vs prod config management

This commit is contained in:
2025-04-24 13:21:00 +01:00
parent c6f5375af8
commit f760727d9e
10 changed files with 39 additions and 32 deletions

View File

@@ -0,0 +1,14 @@
{
debug
auto_https off
local_certs
}
localhost {
reverse_proxy invenio-rdm:5000
encode gzip
log {
format console
level DEBUG
}
}

View File

@@ -2,7 +2,7 @@
admin off admin off
} }
localhost { invenio.i-form.ie {
reverse_proxy invenio-rdm:5000 reverse_proxy invenio-rdm:5000
encode gzip encode gzip
} }

View File

@@ -11,7 +11,7 @@ services:
- "8443:443" - "8443:443"
volumes: volumes:
- caddy_data:/data - caddy_data:/data
- ./caddy:/etc/caddy - ./caddy/${INVENIO_ENV}:/etc/caddy
restart: unless-stopped restart: unless-stopped
labels: labels:
- "io.containers.autoupdate=registry" - "io.containers.autoupdate=registry"

View File

@@ -1,14 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [[ "$*" == *--dev* ]]; then if [[ "$*" == *--dev* ]]; then
echo "Configuring env in development mode"
ENV_FILE="invenio_dev.env" ENV_FILE="invenio_dev.env"
else else
ENV_FILE="invenio.env" echo "Configuring env in production mode"
ENV_FILE="invenio_prod.env"
fi fi
aws secretsmanager get-secret-value --secret-id Invenio | \ aws secretsmanager get-secret-value --secret-id Invenio | \
jq -r '.SecretString | fromjson | to_entries | .[] | .key + "=\"" + .value + "\""' > secrets.env jq -r '.SecretString | fromjson | to_entries | .[] | .key + "=\"" + .value + "\""' > secrets.env
cat "$ENV_FILE" secrets.env > .env cat ./env/invenio.env "./env/$ENV_FILE" secrets.env > .env
echo "Environment set up using $ENV_FILE" echo "Environment set up using $ENV_FILE"

7
env/invenio.env vendored Normal file
View File

@@ -0,0 +1,7 @@
INVENIO_S3_ENDPOINT_URL=https://s3.eu-west-1.amazonaws.com
INVENIO_S3_REGION_NAME=eu-west-1
INVENIO_S3_BUCKET_NAME=i-form-invenio
INVENIO_THEME_LOGO=custom_assets/I-Form_logo.webp
INVENIO_THEME_FRONTPAGE_TITLE="I-Form Invenio Data Repository"
INVENIO_THEME_SITENAME="I-Form Repository"
INVENIO_THEME_FRONTPAGE_SUBTITLE="An Invenio data repository for the I-Form research group."

5
env/invenio_dev.env vendored Normal file
View File

@@ -0,0 +1,5 @@
INVENIO_APP_ALLOWED_HOSTS=["invenio.i-form.ie", "localhost", "localhost:5000", "127.0.0.1", "127.0.0.1:5000", "0.0.0.0", "0.0.0.0:5000"]
INVENIO_SITE_UI_URL=https://localhost:5000
INVENIO_SITE_API_URL=https://localhost:5000/api
FLASK_ENV=development
INVENIO_ENV=development

5
env/invenio_prod.env vendored Normal file
View File

@@ -0,0 +1,5 @@
INVENIO_APP_ALLOWED_HOSTS=["invenio.i-form.ie"]
INVENIO_SITE_UI_URL=https://invenio.i-form.ie
INVENIO_SITE_API_URL=https://invenio.i-form.ie/api
FLASK_ENV=production
INVENIO_ENV=production

View File

@@ -1,11 +0,0 @@
INVENIO_APP_ALLOWED_HOSTS=["invenio.i-form.ie"]
INVENIO_S3_ENDPOINT_URL="https://s3.eu-west-1.amazonaws.com"
INVENIO_S3_REGION_NAME="eu-west-1"
INVENIO_S3_BUCKET_NAME="i-form-invenio"
INVENIO_THEME_LOGO="custom_assets/I-Form_logo.webp"
INVENIO_THEME_FRONTPAGE_TITLE="I-Form Invenio Data Repository"
INVENIO_THEME_SITENAME="I-Form Repository"
INVENIO_THEME_FRONTPAGE_SUBTITLE="An Invenio data repository for the I-Form research group."
INVENIO_SITE_UI_URL="https://invenio.i-form.ie"
INVENIO_SITE_API_URL="https://invenio.i-form.ie/api"
INVENIO_ENV="production"

View File

@@ -1,14 +0,0 @@
INVENIO_APP_ALLOWED_HOSTS=["invenio.i-form.ie", "localhost", "localhost:5000", "127.0.0.1", "127.0.0.1:5000", "0.0.0.0", "0.0.0.0:5000"]
INVENIO_S3_ENDPOINT_URL="https://s3.eu-west-1.amazonaws.com"
INVENIO_S3_REGION_NAME="eu-west-1"
INVENIO_S3_BUCKET_NAME="i-form-invenio"
INVENIO_THEME_LOGO="custom_assets/I-Form_logo.webp"
INVENIO_THEME_FRONTPAGE_TITLE="I-Form Invenio Data Repository"
INVENIO_THEME_SITENAME="I-Form Repository"
INVENIO_THEME_FRONTPAGE_SUBTITLE="An Invenio data repository for the I-Form research group."
INVENIO_SITE_UI_URL="https://localhost:5000"
INVENIO_SITE_API_URL="https://localhost:5000/api"
INVENIO_FORCE_HTTPS=false
INVENIO_APP_ENABLE_SECURE_HEADERS=False
FLASK_ENV="development"
INVENIO_ENV="development"

View File

@@ -79,8 +79,8 @@ cleanup-versions:
rm -f "versions/${tag#backup-}.txt" rm -f "versions/${tag#backup-}.txt"
done done
deploy: deploy *args:
#!/usr/bin/env bash ./env.sh {{args}}
docker compose up -d --wait docker compose up -d --wait
docker compose exec -it worker setup.sh docker compose exec -it worker setup.sh