forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-init.sh
More file actions
91 lines (80 loc) · 2.52 KB
/
Copy pathdocker-init.sh
File metadata and controls
91 lines (80 loc) · 2.52 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
MYSQLDIR=/var/lib/mysql
if [ ! -d "$MYSQLDIR" ]; then
echo "WARNING: Expected the directory $MYSQLDIR to exist."
exit 1
fi
service rsyslog start
if [ -z "$(ls -A $MYSQLDIR/mysql 2>/dev/null)" ]; then
can=$(date -r /mysql +%s)
now=$(date +%s)
age=$((($now - $can)/86400))
echo "NOTE: Database empty; populating it from canned snapshot ($age days old)"
echo " This will take a little while..."
cp -r /mysql/* $MYSQLDIR
fi
service mariadb start
if ! service mariadb status; then
echo "ERROR: MySQL didn't start. Here are some possible causes:"
echo "-------------------------------------------------------------------"
grep mysqld /var/log/syslog
echo "-------------------------------------------------------------------"
echo "Such errors are usually due to a corrupt or outdated database."
echo "Remove your local database and let the image install a clean copy."
exit 1
fi
if [ ! -f /root/src/ietf/settings_local.py ]; then
echo "Setting up a default settings_local.py ..."
cp /root/src/docker/settings_local.py /root/src/ietf/settings_local.py
fi
for sub in \
test/id \
test/staging \
test/archive \
test/rfc \
test/media \
test/wiki/ietf \
data/nomcom_keys/public_keys \
data/developers/ietf-ftp \
data/developers/ietf-ftp/bofreq \
data/developers/ietf-ftp/charter \
data/developers/ietf-ftp/conflict-reviews \
data/developers/ietf-ftp/internet-drafts \
data/developers/ietf-ftp/rfc \
data/developers/ietf-ftp/status-changes \
data/developers/ietf-ftp/yang/catalogmod \
data/developers/ietf-ftp/yang/draftmod \
data/developers/ietf-ftp/yang/ianamod \
data/developers/ietf-ftp/yang/invalmod \
data/developers/ietf-ftp/yang/rfcmod \
data/developers/www6s \
data/developers/www6s/staging \
data/developers/www6s/wg-descriptions \
data/developers/www6s/proceedings \
data/developers/www6/ \
data/developers/www6/iesg \
data/developers/www6/iesg/evaluation \
; do
dir="/root/src/$sub"
if [ ! -d "$dir" ]; then
echo "Creating dir $dir"
mkdir -p "$dir";
fi
done
python -m smtpd -n -c DebuggingServer localhost:2025 &
echo
if [ -z "$*" ]; then
echo "You can execute arbitrary commands now, e.g.,"
echo
echo " ietf/manage.py check && ietf/manage.py runserver 0.0.0.0:8000"
echo
echo "to start a development instance of the Datatracker."
echo
bash
else
echo "Executing \"$*\" and stopping container."
echo
bash -c "$*"
fi
service mariadb stop
service rsyslog stop