-
Notifications
You must be signed in to change notification settings - Fork 3
/
ccso
executable file
·55 lines (53 loc) · 2.03 KB
/
ccso
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
#!/usr/bin/env bash
cd $(dirname "$0")
case $1 in
build)
echo "Building ccso docker image"
set -x
docker build -t ccso -f Dockerfile .
;;
initdb)
echo "Initializing ccso database volume"
set -x
docker run -it --rm -v ccso:/opt/nameserv/db ccso /opt/nameserv/util/db/initdb
;;
shell)
echo "Launching bash shell in docker container"
set -x
docker run -it --rm -v ccso:/opt/nameserv/db ccso /bin/bash
;;
ph)
echo "Launching ph client in interactive mode"
echo "Don't forget to specify the server host with '-s hostname'"
set -x
docker run -it --rm ccso /opt/nameserv/bin/ph ${@:2}
;;
qi)
echo "Connecting to qi server in local admin mode"
set -x
docker run -it --rm -v ccso:/opt/nameserv/db ccso /opt/nameserv/bin/qi ${@:2}
;;
daemon)
# The service will pipe stdout over network so we don't want to echo anything extra
docker run -i --rm -a stdin -a stdout -v ccso:/opt/nameserv/db ccso /opt/nameserv/bin/qi -d -q
;;
install-service)
echo "Installing systemd network service files"
set -x
install systemd/ccso.socket /etc/systemd/system/ccso.socket
install systemd/[email protected] /etc/systemd/system/[email protected]
systemctl enable ccso.socket
systemctl start ccso.socket
;;
*)
echo "Unrecognized command, must be one of the following:"
echo " build : Build the docker container"
echo " initdb : Initialize the ccso database inside of a volume"
echo " shell : Launch a bash shell into the container"
echo " ph : Launch the ph client"
echo " qi : Launch the qi server in local hero mode"
echo " daemon : Launch the qi server in daemon mode (for connecting to inetd)"
echo " install-service : Install the systemd service files"
exit 1
;;
esac