Spaces:
Paused
Paused
BPEL Bot commited on
Commit ·
fe45848
1
Parent(s): e30049f
Run from writable runtime directory
Browse files- docker-entrypoint.sh +11 -12
docker-entrypoint.sh
CHANGED
|
@@ -28,12 +28,7 @@ elif [[ "$DB_URL" == sqlite:///* ]]; then
|
|
| 28 |
fi
|
| 29 |
|
| 30 |
if [[ -n "$DB_PATH" ]]; then
|
| 31 |
-
|
| 32 |
-
mkdir -p "$DB_DIR"
|
| 33 |
-
if [[ ! -f "$DB_PATH" ]]; then
|
| 34 |
-
log "Initializing SQLite database at $DB_PATH"
|
| 35 |
-
otree resetdb --noinput
|
| 36 |
-
fi
|
| 37 |
fi
|
| 38 |
|
| 39 |
SCHEME=$(printf '%s' "$DB_URL" | cut -d: -f1)
|
|
@@ -42,11 +37,15 @@ log "Database scheme detected: ${SCHEME:-unknown}"
|
|
| 42 |
export DATABASE_URL="$DB_URL"
|
| 43 |
|
| 44 |
PORT="${PORT:-8000}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
log "Starting oTree prodserver on 0.0.0.0:${PORT}"
|
| 46 |
-
cd /app
|
| 47 |
-
log "Creating compatibility SQLite file at $(pwd)/db.sqlite3"
|
| 48 |
-
python - <<'PY'
|
| 49 |
-
import sqlite3
|
| 50 |
-
sqlite3.connect('db.sqlite3').close()
|
| 51 |
-
PY
|
| 52 |
exec otree prodserver1of2 0.0.0.0:${PORT}
|
|
|
|
| 28 |
fi
|
| 29 |
|
| 30 |
if [[ -n "$DB_PATH" ]]; then
|
| 31 |
+
log "SQLite compatibility path requested: $DB_PATH"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
fi
|
| 33 |
|
| 34 |
SCHEME=$(printf '%s' "$DB_URL" | cut -d: -f1)
|
|
|
|
| 37 |
export DATABASE_URL="$DB_URL"
|
| 38 |
|
| 39 |
PORT="${PORT:-8000}"
|
| 40 |
+
log "Preparing runtime workspace"
|
| 41 |
+
RUNTIME_DIR=${OTREE_RUNTIME_DIR:-/tmp/otree-app}
|
| 42 |
+
rm -rf "$RUNTIME_DIR"
|
| 43 |
+
mkdir -p "$RUNTIME_DIR"
|
| 44 |
+
cp -a /app/. "$RUNTIME_DIR"/
|
| 45 |
+
|
| 46 |
+
cd "$RUNTIME_DIR"
|
| 47 |
+
log "Working directory: $(pwd)"
|
| 48 |
+
touch db.sqlite3 || true
|
| 49 |
+
|
| 50 |
log "Starting oTree prodserver on 0.0.0.0:${PORT}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
exec otree prodserver1of2 0.0.0.0:${PORT}
|