forked from ietf-tools/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
54 lines (46 loc) · 1.81 KB
/
start.sh
File metadata and controls
54 lines (46 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
echo "Creating /test directories..."
for sub in \
/test/id \
/test/staging \
/test/archive \
/test/rfc \
/test/media \
/test/wiki/ietf \
; do
if [ ! -d "$sub" ]; then
echo "Creating dir $sub"
mkdir -p "$sub";
fi
done
echo "Fixing permissions..."
chmod -R 777 ./
echo "Ensure all requirements.txt packages are installed..."
pip --disable-pip-version-check --no-cache-dir install -r requirements.txt
echo "Creating data directories..."
chmod +x ./app-create-dirs.sh
./app-create-dirs.sh
if [ -n "$PGHOST" ]; then
echo "Altering PG search path..."
psql -U django -h $PGHOST -d datatracker -v ON_ERROR_STOP=1 -c '\x' -c 'ALTER USER django set search_path=datatracker,public;'
fi
echo "Starting memcached..."
/usr/bin/memcached -d -u root
echo "Running Datatracker checks..."
./ietf/manage.py check
# Migrate, adjusting to what the current state of the underlying database might be:
# On production, the blobdb tables are in a separate database. Manipulate migration
# history to ensure that they're created for the sandbox environment that runs it
# all from a single database.
echo "Ensuring blobdb relations exist..."
/usr/local/bin/python ./ietf/manage.py migrate --settings=settings_local --fake blobdb zero
if ! /usr/local/bin/python ./ietf/manage.py migrate --settings=settings_local blobdb; then
# If we are restarting a sandbox, the migration may already have run and re-running
# it will fail. Assume that happened and fake it.
/usr/local/bin/python ./ietf/manage.py migrate --settings=settings_local --fake blobdb
fi
# Now run the migrations for real
echo "Running Datatracker migrations..."
/usr/local/bin/python ./ietf/manage.py migrate --settings=settings_local
echo "Starting Datatracker..."
./ietf/manage.py runserver 0.0.0.0:8000 --settings=settings_local