-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmxprotocol-server
More file actions
executable file
·50 lines (39 loc) · 1.92 KB
/
Copy pathmxprotocol-server
File metadata and controls
executable file
·50 lines (39 loc) · 1.92 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
#!/bin/bash
PARENT_PATH=$(dirname $0)
SERVICE_NAME=mxprotocol-server
if [ $(basename $0) != $SERVICE_NAME ]; then
echo "wrong service $(basename $0)"
exit
fi
if [ "$1" = "-h" ]; then
echo "Usage : "$SERVICE_NAME" [local_database|remote_database <remote_data_server>|create_image|build]"
echo ""
echo "Commands : "
echo " local_database Start docker container with local database"
echo " remote_database <remote_data_server> Start docker container with remote database"
echo " create_image Create docker image for LPWAN-app-server"
echo " build Command for building the code, only run in docker container"
echo ""
exit
fi
if [ "$1" = "remote_database" ] && [ $# -eq 2 ]; then
"$PARENT_PATH"/m2m/scripts/docker/generate-docker-compose remote $2
docker-compose -f "$PARENT_PATH"/docker-compose.yml up -d --remove-orphans
docker-compose exec $SERVICE_NAME bash --init-file "$PARENT_PATH"/m2m/scripts/compile/develop-compile
elif [ "$*" = "local_database" ]; then
"$PARENT_PATH"/m2m/scripts/docker/generate-docker-compose local
docker-compose -f "$PARENT_PATH"/docker-compose.yml up -d --remove-orphans
docker-compose exec $SERVICE_NAME bash --init-file "$PARENT_PATH"/m2m/scripts/compile/develop-compile
elif [ "$*" = "create_image" ]; then
"$PARENT_PATH"/m2m/scripts/docker/generate-docker-compose image
mv "$PARENT_PATH"/docker-compose.yml "$PARENT_PATH"/docker-compose-create-image.yml
read -p "Insert docker hub username: " DOCKER_HUB_USERNAME
read -p "Insert docker hub password: " DOCKER_HUB_PASSWORD
read -p "Insert docker hub repository: " DOCKER_HUB_REPOSITORY
"$PARENT_PATH"/m2m/scripts/image/generateAndPushDockerImage $DOCKER_HUB_USERNAME $DOCKER_HUB_PASSWORD $DOCKER_HUB_REPOSITORY
elif [ "$*" = "build" ]; then
"$PARENT_PATH"/m2m/scripts/compile/develop-compile
else
"$PARENT_PATH"/$SERVICE_NAME -h
exit
fi