File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed
Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2- # Initialize a PostgreSQL database: run migrations and load initial data.
32set -e
43
5- /venv/bin/grader-service-migrate -f /app/grader_service_config.py
4+ echo " Initialize a PostgreSQL database: run migrations and load initial data."
5+
6+ /app/.venv/bin/grader-service-migrate -f /app/grader_service_config.py
67# Try to load the initial data. This will fail on the first error (e.g. if the data already exists)
78# and roll back the transaction.
8- psql -v ON_ERROR_STOP=1 -h postgres -U postgres -d grader --single-transaction -f /app/data_only.sql
9+ if ! psql -v ON_ERROR_STOP=1 -h postgres -U postgres -d grader --single-transaction -f /app/data_only.sql; then
10+ echo " Initial data import failed; probably the database already exists and contains the data."
11+ fi
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2- # Initialize an sqlite database: run migrations and load initial data.
32set -e
43
4+ echo " Initialize an sqlite database: run migrations and load initial data."
5+
56grader-service-migrate -f /app/grader_service_config.py
67# Insert some initial data into the database. The import will fail if the data already
78# has been inserted, so we ignore errors and just continue.
8- sqlite3 /app/service_dir/grader.db < /app/data_only.sql || true
9+ # Note: For debugging, remove the stderr redirection: `2>/dev/null`.
10+ if ! sqlite3 /app/service_dir/grader.db < /app/data_only.sql 2> /dev/null; then
11+ echo " Initial data import failed; probably the database already exists and contains the data."
12+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e
3+
14echo " Populate docker volume"
25
3- cp -r /local_service_dir/. /volume_service_dir
6+ cp -r /local_service_dir/. /volume_service_dir
You can’t perform that action at this time.
0 commit comments