feat: update database path configuration and improve entrypoint script for SQLite handling
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
*/db.sqlite3
|
*/db.sqlite3
|
||||||
|
*/db/db.sqlite3
|
||||||
*/logs/
|
*/logs/
|
||||||
*/static/
|
*/static/
|
||||||
|
|||||||
@@ -72,6 +72,12 @@ curl -sS http://127.0.0.1:5555/api/v1/auth/cie/session/<state>
|
|||||||
docker compose down -v
|
docker compose down -v
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If the stack was started before June 17, 2026 DB path fix, also remove legacy SQLite files that were created outside named volumes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm -f federation_authority/db.sqlite3 provider/db.sqlite3 relying_party/db.sqlite3
|
||||||
|
```
|
||||||
|
|
||||||
## Logs
|
## Logs
|
||||||
```bash
|
```bash
|
||||||
docker compose logs -f
|
docker compose logs -f
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ services:
|
|||||||
DJANGO_SECRET_KEY: ${FEDERATION_AUTHORITY_SECRET_KEY:-visione-cie-authority-local-dev}
|
DJANGO_SECRET_KEY: ${FEDERATION_AUTHORITY_SECRET_KEY:-visione-cie-authority-local-dev}
|
||||||
DJANGO_ALLOWED_HOSTS: ${CIE_AUTH_ALLOWED_HOSTS:-*}
|
DJANGO_ALLOWED_HOSTS: ${CIE_AUTH_ALLOWED_HOSTS:-*}
|
||||||
DJANGO_TRUST_ANCHOR: ${DJANGO_TRUST_ANCHOR:-http://federation-authority:8000}
|
DJANGO_TRUST_ANCHOR: ${DJANGO_TRUST_ANCHOR:-http://federation-authority:8000}
|
||||||
|
DJANGO_DB_PATH: /app/federation_authority/db/db.sqlite3
|
||||||
LOAD_FIXTURE_ON_EMPTY_DB: ${FEDERATION_AUTHORITY_LOAD_FIXTURE_ON_EMPTY_DB:-true}
|
LOAD_FIXTURE_ON_EMPTY_DB: ${FEDERATION_AUTHORITY_LOAD_FIXTURE_ON_EMPTY_DB:-true}
|
||||||
expose:
|
expose:
|
||||||
- "8000"
|
- "8000"
|
||||||
@@ -28,6 +29,7 @@ services:
|
|||||||
DJANGO_ALLOWED_HOSTS: ${CIE_AUTH_ALLOWED_HOSTS:-*}
|
DJANGO_ALLOWED_HOSTS: ${CIE_AUTH_ALLOWED_HOSTS:-*}
|
||||||
DJANGO_TRUST_ANCHOR: ${DJANGO_TRUST_ANCHOR:-http://federation-authority:8000}
|
DJANGO_TRUST_ANCHOR: ${DJANGO_TRUST_ANCHOR:-http://federation-authority:8000}
|
||||||
DJANGO_PROVIDER_ISSUER: ${DJANGO_PROVIDER_ISSUER:-http://provider:8002/oidc/op}
|
DJANGO_PROVIDER_ISSUER: ${DJANGO_PROVIDER_ISSUER:-http://provider:8002/oidc/op}
|
||||||
|
DJANGO_DB_PATH: /app/provider/db/db.sqlite3
|
||||||
LOAD_FIXTURE_ON_EMPTY_DB: ${PROVIDER_LOAD_FIXTURE_ON_EMPTY_DB:-true}
|
LOAD_FIXTURE_ON_EMPTY_DB: ${PROVIDER_LOAD_FIXTURE_ON_EMPTY_DB:-true}
|
||||||
expose:
|
expose:
|
||||||
- "8002"
|
- "8002"
|
||||||
@@ -53,6 +55,7 @@ services:
|
|||||||
DJANGO_RP_SHARED_SECRET: ${DJANGO_RP_SHARED_SECRET:-change-me-for-local-dev}
|
DJANGO_RP_SHARED_SECRET: ${DJANGO_RP_SHARED_SECRET:-change-me-for-local-dev}
|
||||||
DJANGO_RP_DEFAULT_PROVIDER: ${DJANGO_RP_DEFAULT_PROVIDER:-http://provider:8002/oidc/op}
|
DJANGO_RP_DEFAULT_PROVIDER: ${DJANGO_RP_DEFAULT_PROVIDER:-http://provider:8002/oidc/op}
|
||||||
DJANGO_RP_BASE_URL: ${DJANGO_RP_BASE_URL:-http://relying-party:8001}
|
DJANGO_RP_BASE_URL: ${DJANGO_RP_BASE_URL:-http://relying-party:8001}
|
||||||
|
DJANGO_DB_PATH: /app/relying_party/db/db.sqlite3
|
||||||
LOAD_FIXTURE_ON_EMPTY_DB: ${RELYING_PARTY_LOAD_FIXTURE_ON_EMPTY_DB:-true}
|
LOAD_FIXTURE_ON_EMPTY_DB: ${RELYING_PARTY_LOAD_FIXTURE_ON_EMPTY_DB:-true}
|
||||||
expose:
|
expose:
|
||||||
- "8001"
|
- "8001"
|
||||||
|
|||||||
+4
-3
@@ -3,12 +3,13 @@ set -eu
|
|||||||
|
|
||||||
APP_DIR="$1"
|
APP_DIR="$1"
|
||||||
PORT="$2"
|
PORT="$2"
|
||||||
|
DB_PATH="${DJANGO_DB_PATH:-$APP_DIR/db/db.sqlite3}"
|
||||||
|
|
||||||
cd "$APP_DIR"
|
cd "$APP_DIR"
|
||||||
|
|
||||||
mkdir -p logs static
|
mkdir -p logs static "$(dirname "$DB_PATH")"
|
||||||
|
|
||||||
if [ ! -f "$APP_DIR/db.sqlite3" ] && [ "${LOAD_FIXTURE_ON_EMPTY_DB:-true}" = "true" ]; then
|
if [ ! -f "$DB_PATH" ] && [ "${LOAD_FIXTURE_ON_EMPTY_DB:-true}" = "true" ]; then
|
||||||
TMP_DUMP="$(mktemp)"
|
TMP_DUMP="$(mktemp)"
|
||||||
python /app/scripts/rewrite_dumps.py dumps/example.json "$TMP_DUMP"
|
python /app/scripts/rewrite_dumps.py dumps/example.json "$TMP_DUMP"
|
||||||
python manage.py migrate
|
python manage.py migrate
|
||||||
@@ -22,7 +23,7 @@ fi
|
|||||||
# Collect them into STATIC_ROOT so the explicit /static/ URL can serve them.
|
# Collect them into STATIC_ROOT so the explicit /static/ URL can serve them.
|
||||||
python manage.py collectstatic --noinput
|
python manage.py collectstatic --noinput
|
||||||
|
|
||||||
if grep -aEq '127\.0\.0\.1|provider:8002' "$APP_DIR/db.sqlite3"; then
|
if grep -aEq '127\.0\.0\.1|provider:8002' "$DB_PATH"; then
|
||||||
echo "Refusing to start: bootstrap data still contains internal/local URLs" >&2
|
echo "Refusing to start: bootstrap data still contains internal/local URLs" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ DJAGGER_DOCUMENT = {
|
|||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
'NAME': os.getenv('DJANGO_DB_PATH', os.path.join(BASE_DIR, 'db', 'db.sqlite3')),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ DATABASES = {
|
|||||||
# },
|
# },
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
'NAME': os.getenv('DJANGO_DB_PATH', os.path.join(BASE_DIR, 'db', 'db.sqlite3')),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ DJAGGER_DOCUMENT = {
|
|||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
'NAME': os.getenv('DJANGO_DB_PATH', os.path.join(BASE_DIR, 'db', 'db.sqlite3')),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ DATABASES = {
|
|||||||
# },
|
# },
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
'NAME': os.getenv('DJANGO_DB_PATH', os.path.join(BASE_DIR, 'db', 'db.sqlite3')),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ DJAGGER_DOCUMENT = {
|
|||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
'NAME': os.getenv('DJANGO_DB_PATH', os.path.join(BASE_DIR, 'db', 'db.sqlite3')),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ DATABASES = {
|
|||||||
# },
|
# },
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
'NAME': os.getenv('DJANGO_DB_PATH', os.path.join(BASE_DIR, 'db', 'db.sqlite3')),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user