From 2b1d9aaf5f8ad71bb82e06bb528f27ea9b52179b Mon Sep 17 00:00:00 2001 From: Giulio Martinelli Date: Thu, 7 Mar 2024 17:36:24 -0300 Subject: [PATCH] fix expose and readme --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++-- docker-compose.yml | 17 ++++++++++------- 2 files changed, 53 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 007c3ca..ec16c94 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,52 @@ configure o caminho do projeto node.js ./docker/.env.docker.local NODEJS_VOLUMES_FILES=/home/user/my_project_nodejs ``` +## SSL -## Histórico +configure o caminho de onde se encontra o certificado ./docker/.env.docker.local + +``` +NGINX_VOLUMES_NGINX_SSL_CERTS=/home/user/my_certs +``` + +Retire os comentarios ./docker-compose.yml + +``` +- "${NGINX_SSL_PORT}:443" +``` + +``` +- "${NGINX_VOLUMES_NGINX_SSL_CERTS}:/etc/nginx/certs" +``` + +Retire os comentarios ./docker/nginx/nginx.conf +``` + server { + listen 443 ssl; + server_name localhost; + + ssl_certificate /etc/nginx/certs/localhost.crt; + ssl_certificate_key /etc/nginx/certs/localhost.key; + + location / { + proxy_pass http://nodejs; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } +``` + + + +## Histórico +* 0.0.2 + * correção portas e configuração correta expose das portas. + * suporte SSL nginx. * 0.0.1 - * Work in progress + * Inicio projeto. ## Meta diff --git a/docker-compose.yml b/docker-compose.yml index 19dd7f9..f5890f8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: - ./docker/.env.docker.local working_dir: /usr/src/app ports: - - "${NODEJS_PORT}:${NODEJS_PORT}" + - "${NODEJS_PORT}:3000" depends_on: - mysql - mongo @@ -20,11 +20,14 @@ services: nginx: image: nginx:${NGINX_VERSION} ports: - - "${NGINX_PORT}:${NGINX_PORT}" - - "${NGINX_SSL_PORT}:${NGINX_SSL_PORT}" + - "${NGINX_PORT}:80" + #- "${NGINX_SSL_PORT}:443" + expose: + - ${NGINX_PORT} + - ${NGINX_SSL_PORT} volumes: - "${NGINX_VOLUMES_NGINX_CONF}:/etc/nginx/nginx.conf" - - "${NGINX_VOLUMES_NGINX_SSL_CERTS}:/etc/nginx/certs" + #- "${NGINX_VOLUMES_NGINX_SSL_CERTS}:/etc/nginx/certs" command: ["nginx", "-g", "daemon off;"] depends_on: - nodejs @@ -41,7 +44,7 @@ services: MYSQL_PASSWORD: ${MYSQL_PASSWORD} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} ports: - - "${MYSQL_PORT}:${MYSQL_PORT}" + - "${MYSQL_PORT}:3306" expose: - ${MYSQL_PORT} volumes: @@ -57,7 +60,7 @@ services: MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USERNAME} MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD} ports: - - "${MONGO_PORT}:${MONGO_PORT}" + - "${MONGO_PORT}:27017" expose: - ${MONGO_PORT} volumes: @@ -67,4 +70,4 @@ services: volumes: api-mysql: - api-mongo: \ No newline at end of file + api-mongo: