diff --git a/cicd/docker-compose/production.yml b/cicd/docker-compose/production.yml index f536913..3184050 100644 --- a/cicd/docker-compose/production.yml +++ b/cicd/docker-compose/production.yml @@ -26,6 +26,9 @@ services: networks: db-network: §PROJECT_BUILDNAME§-network: + nginx-network: + aliases: + - §PROJECT_BUILDNAME§.§ENVIRONMENT_TYPE§.webserver links: - mongo:database volumes: @@ -65,6 +68,9 @@ services: networks: db-network: §PROJECT_BUILDNAME§-network: + nginx-network: + name: + nginx-network volumes: diff --git a/cicd/nginx/docker-compose.yml b/cicd/nginx/docker-compose.yml new file mode 100644 index 0000000..163710d --- /dev/null +++ b/cicd/nginx/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3" +services: + nginx: + image: nginx:1.16 + ports: + - "80:80" + - "443:443" + networks: + - nginx-network + restart: always + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + + +networks: + nginx-network: + name: + nginx-network diff --git a/cicd/nginx/nginx.conf b/cicd/nginx/nginx.conf new file mode 100644 index 0000000..49cd2b7 --- /dev/null +++ b/cicd/nginx/nginx.conf @@ -0,0 +1,32 @@ +worker_processes 1; + +events { worker_connections 1024; } + +http { + client_max_body_size 5M; + + server { + listen 80; + server_name www.ifattidinapoli.it preproduction.ifattidinapoli.it default_server; + + location / { + proxy_pass http://fdn2.production.webserver/; + proxy_redirect off; + proxy_set_header Host $host; + } + + } + + ; server { + ; listen 80; + ; server_name test.ifattidinapoli.it; + + ; location / { + ; proxy_pass http://fdn2.test.webserver/; + ; proxy_redirect off; + ; proxy_set_header Host $host; + ; } + + ; } + +} diff --git a/scripts/core.sh b/scripts/core.sh index 77fb162..cac0f63 100755 --- a/scripts/core.sh +++ b/scripts/core.sh @@ -22,6 +22,7 @@ usage() { echo " -u: Unit tests locally" 1>&2; echo " -d: Run debug vesion locally" 1>&2; echo " -p: Publish (requires a version)" 1>&2; + echo " -X: Staging Deploy (requires a version)" 1>&2; echo " -x: Production Deploy (requires a version)" 1>&2; echo " -t: Software version, this will be used for the docker tag (default: local)" 1>&2; echo " -v: Verbose" 1>&2; @@ -31,7 +32,8 @@ usage() { UNIT_MODE=0 DEBUG_MODE=0 PUBLISH_MODE=0 -DEPLOY_MODE=0 +DEPLOY_TEST_MODE=0 +DEPLOY_PROD_MODE=0 SELECTED_MODES=0 TAG="local" @@ -50,8 +52,12 @@ while getopts "t:hvudpx" o; do PUBLISH_MODE=1 SELECTED_MODES+=1 ;; + X) + DEPLOY_TEST_MODE=1 + SELECTED_MODES+=1 + ;; x) - DEPLOY_MODE=1 + DEPLOY_PROD_MODE=1 SELECTED_MODES+=1 ;;