-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-docker.sh
More file actions
executable file
·70 lines (64 loc) · 1.65 KB
/
Copy pathsetup-docker.sh
File metadata and controls
executable file
·70 lines (64 loc) · 1.65 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
#!/bin/bash
set -e
DIR=`dirname "$(readlink -f $0)"`
pushd "$DIR/docker"
trap popd EXIT
# setup config.php
if [[ ! -f config.php ]]
then
echo "creating configuration"
cp ../website/config.php.template config.php
sed 's/"localhost"/"db"/g' -i config.php
echo "please edit your website configuration"
datebefore=$(stat -c %y config.php)
"${EDITOR:-vi}" config.php
dateafter=$(stat -c %y config.php)
if [[ $datebefore = $dateafter ]]
then
# nothing changed
echo "editing canceled"
rm config.php
exit 0
fi
fi
# setup style.less
if [[ ! -f style.less ]]
then
echo "creating style"
cp style.less.template style.less
echo "please edit your website configuration"
datebefore=$(stat -c %y style.less)
"${EDITOR:-vi}" style.less
dateafter=$(stat -c %y style.less)
if [[ $datebefore = $dateafter ]]
then
# nothing changed
echo "editing canceled"
rm style.less
exit 0
fi
fi
# setup Apache ssmtp (email)
if [[ ! -f ssmtp.conf ]]
then
cp ssmtp.conf.template ssmtp.conf
echo "please enter your mailserver configuration"
datebefore=$(stat -c %y ssmtp.conf)
"${EDITOR:-vi}" ssmtp.conf
dateafter=$(stat -c %y ssmtp.conf)
if [[ $datebefore = $dateafter ]]
then
# nothing changed
echo "editing canceled"
rm ssmtp.conf
exit 0
fi
fi
# start docker-compose, run in background
echo "starting docker-compose"
docker-compose up -d --build
echo "-------------------------------------"
echo "system up"
echo "to stop, run "
echo " cd docker && docker-compose down"
echo "-------------------------------------"