@@ -9,12 +9,18 @@ This script is used to deploy/undeploy NGINX Declarative API using docker-compos
99=== Usage:\n\n
1010$0 [options]\n\n
1111=== Options:\n\n
12- -h\t\t\t- This help\n
13- -c [start|stop|build]\t- Deployment command\n\n
12+ -h\t\t\t\t- This help\n
13+ -c [start|stop|build]\t\t- Deployment command\n
14+ -a <port>\t\t\t- Custom port for NGINX Declarative API (default: 5000)\n
15+ -d <port>\t\t\t- Custom port for Developer Portal (default: 5001)\n
16+ -r <port>\t\t\t- Custom port for Redis (default: 6379)\n\n
1417=== Examples:\n\n
15- Deploy NGINX Declarative API:\t$0 -c start\n
16- Remove NGINX Declarative API:\t$0 -c stop\n
17- Build docker images:\t\t$0 -c build\n
18+ Deploy NGINX Declarative API:\t\t\t$0 -c start\n
19+ Deploy with custom Declarative API port:\t$0 -c start -a 8080\n
20+ Deploy with custom DevPortal port:\t\t$0 -c start -d 8081\n
21+ Deploy with all custom ports:\t\t\t$0 -c start -a 8080 -d 8081 -r 6380\n
22+ Remove NGINX Declarative API:\t\t\t$0 -c stop\n
23+ Build docker images:\t\t\t\t$0 -c build\n
1824"
1925
2026echo -e $BANNER 2>&1
@@ -30,8 +36,14 @@ nginx_dapi_start() {
3036USERNAME=` whoami`
3137export USERID=` id -u $USERNAME `
3238export USERGROUP=` id -g $USERNAME `
39+ export DAPI_PORT=${DAPI_PORT:- 5000}
40+ export DEVPORTAL_PORT=${DEVPORTAL_PORT:- 5001}
41+ export REDIS_PORT=${REDIS_PORT:- 6379}
3342
3443echo " -> Deploying NGINX Declarative API"
44+ echo " NGINX Declarative API port: $DAPI_PORT "
45+ echo " Developer Portal port: $DEVPORTAL_PORT "
46+ echo " Redis port: $REDIS_PORT "
3547COMPOSE_HTTP_TIMEOUT=240 docker-compose -p $PROJECT_NAME -f $DOCKER_COMPOSE_YAML up -d --remove-orphans
3648}
3749
@@ -71,7 +83,7 @@ COMPOSE_HTTP_TIMEOUT=240 docker-compose -p $PROJECT_NAME -f $DOCKER_COMPOSE_YAML
7183DOCKER_COMPOSE_YAML=" docker-compose.yaml"
7284PROJECT_NAME=" nginx-dapi"
7385
74- while getopts ' hc:' OPTION
86+ while getopts ' hc:a:d:r: ' OPTION
7587do
7688 case " $OPTION " in
7789 h)
8092 c)
8193 ACTION=$OPTARG
8294 ;;
95+ a)
96+ DAPI_PORT=$OPTARG
97+ ;;
98+ d)
99+ DEVPORTAL_PORT=$OPTARG
100+ ;;
101+ r)
102+ REDIS_PORT=$OPTARG
103+ ;;
83104 esac
84105done
85106
86- if [ -z " ${ACTION} " ] || [[ ! " ${ACTION} " == + (start| stop| build) ]]
107+ if [ -z " ${ACTION} " ] || [[ ! " ${ACTION} " =~ ^ (start| stop| build)$ ]]
87108then
88109 usage
89110fi
0 commit comments