-
Notifications
You must be signed in to change notification settings - Fork 23
/
boot.sh
executable file
·65 lines (50 loc) · 2.18 KB
/
boot.sh
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
#!/usr/bin/env bash
set -eu
if [[ "$*" =~ nis || $# == 0 ]]; then
# we run the setup only if ncc is run
./setup.sh
fi
# we rebuild and remove existing container every time.
# The benefits: upgrades are automatic after the git pull
docker build --rm=false -t mynem_image .
docker ps -a | grep mynem_container > /dev/null && docker rm mynem_container
# determine which custom configs to mount
set -x
config_mounts=""
# nis.config-user.properties.sample servant.config.properties.sample supervisord.conf.sample
# - nis
config_file=$PWD/custom-configs/nis.config-user.properties
[[ -f $config_file ]] && config_mounts="$config_mounts -v $config_file:/package/nis/config-user.properties"
# - ncc
config_file=$PWD/custom-configs/ncc.config-user.properties
[[ -f $config_file ]] && config_mounts="$config_mounts -v $config_file:/package/ncc/config-user.properties"
# - servant
config_file=$PWD/custom-configs/servant.config.properties
[[ -f $config_file ]] && config_mounts="$config_mounts -v $config_file:/servant/config.properties"
# - supervisord
config_file=$PWD/custom-configs/supervisord.conf
[[ -f $config_file ]] && config_mounts="$config_mounts -v $config_file:/etc/supervisord.conf"
mkdir -p $PWD/nem/ncc
mkdir -p $PWD/nem/nis
chown -R 1000 nem
docker run --restart always --name mynem_container -v ${PWD}/nem:/home/nem/nem $config_mounts -t -d -p 7777:7777 -p 7778:7778 -p 7880:7880 -p 7890:7890 -p 8989:8989 mynem_image
set +x
if [[ "$*" =~ nis || $# == 0 ]]; then
echo "Starting NIS"
./supervisorctl.sh start nis
fi
if [[ "$*" =~ ncc ]]; then
echo -e "\e[32mStarting NCC, which will be available at http://localhost:8989\e[39m"
./supervisorctl.sh start ncc
fi
echo "All done, here are the services running:"
echo -e "\e[34m"
./supervisorctl.sh status
echo -e "\e[39m"
echo
echo -e "\e[32m--------------------------------------------------------------------------------"
echo "You can control both services named 'ncc' and 'nis' with the script ./service.sh"
echo "run ./service.sh without argument to get help"
echo
echo "You can access the supervisord control shell with ./supervisorctl.sh"
echo -e "--------------------------------------------------------------------------------\e[39m"