Forked from Sun1ive/docker + nginx + nodejs + pm2 + mongo.txt
Created
July 23, 2019 09:59
-
-
Save CrazyAdmin/e76f373b2d017227c4a3fa3050803f06 to your computer and use it in GitHub Desktop.
Revisions
-
Sun1ive revised this gist
Jun 13, 2018 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,9 +50,10 @@ services: # нужно изменить внешний (первый) порт на открытый например(1337) # нужно изменить внутренний (второй) порт на 443 если SSL ports: - "80:80" - "443:443" api: image: node:10 restart: always volumes: - ./myapp:/usr/app -
Sun1ive revised this gist
Jun 13, 2018 . 1 changed file with 32 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,39 @@ # NGINX CONFIG server { listen 80 default_server; listen [::]:80 default_server; return 301 https://$host$request_uri; } server { listen 443 ssl default_server; listen [::]:443 ssl default_server; ssl on; ssl_certificate ssl/fullchain.pem; ssl_certificate_key ssl/privkey.pem; root /var/www/example.com; index index.html; server_name www.sunlive.pro sunlive.pro; location / { proxy_pass http://app:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_redirect off; proxy_buffers 8 32k; proxy_buffer_size 64k; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; } } # Docker-compose.yml -
Sun1ive renamed this gist
May 14, 2018 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -42,6 +42,16 @@ services: volumes: - ./myapp:/usr/app command: /bin/bash -c "cd /usr/app && npm i -g pm2 && npm i && npm start" mongoDB: image: mongo restart: always environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: example MONGO_INITDB_DATABASE: testdb ports: - "3001:27017" ##### pm2 ##### #process.yml @@ -58,6 +68,7 @@ apps: } #stop all containers: docker kill $(docker ps -q) -
Sun1ive renamed this gist
May 14, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Sun1ive revised this gist
May 13, 2018 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ version: '3.2' services: web: image: nginx restart: always volumes: # default.conf - ./config:/etc/nginx/conf.d @@ -38,6 +38,7 @@ services: - "1337:443" api: image: node:latest restart: always volumes: - ./myapp:/usr/app command: /bin/bash -c "cd /usr/app && npm i -g pm2 && npm i && npm start" -
Sun1ive revised this gist
May 13, 2018 . 1 changed file with 16 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ server { index index.html; location / { proxy_pass http://api:8081; } } @@ -40,7 +40,21 @@ services: image: node:latest volumes: - ./myapp:/usr/app command: /bin/bash -c "cd /usr/app && npm i -g pm2 && npm i && npm start" ##### pm2 ##### #process.yml apps: - script : './src/index.js' name : 'API' exec_mode: 'cluster' instances: 1 watch: true (?) #package.json "scripts": { "start": "pm2-runtime process.yml" } #stop all containers: -
Sun1ive revised this gist
May 12, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,6 +29,7 @@ services: image: nginx restart: on-failure volumes: # default.conf - ./config:/etc/nginx/conf.d - ./ssl:/etc/nginx/ssl # нужно изменить внешний (первый) порт на открытый например(1337) -
Sun1ive revised this gist
May 12, 2018 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,6 @@ # NGINX CONFIG server { #нжинкс слушает порты и прокисрует на докер контейнер listen 80 default_server; listen [::]:80 default_server; return 301 https://$host$request_uri; -
Sun1ive revised this gist
May 10, 2018 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ # NGINX CONFIG server { #nginx слушает внутренний порт локальной машины #можно тут любой свободный хуярить listen 80 default_server; listen [::]:80 default_server; return 301 https://$host$request_uri; @@ -30,10 +32,10 @@ services: volumes: - ./config:/etc/nginx/conf.d - ./ssl:/etc/nginx/ssl # нужно изменить внешний (первый) порт на открытый например(1337) # нужно изменить внутренний (второй) порт на 443 если SSL ports: - "1337:443" api: image: node:latest volumes: -
Sun1ive revised this gist
May 7, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -55,3 +55,4 @@ docker rmi $(docker images -q) https://letsencrypt.org/docs/certificates-for-localhost/ #ssl for domain https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 https://oxozle.com/2018/01/21/nastrojka-ssl-let-s-encrypt-v-nginx-na-ubuntu -
Sun1ive revised this gist
May 7, 2018 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,6 +40,16 @@ services: - ./myapp:/usr/app command: /bin/bash -c "cd /usr/app && npm i && npm start" #stop all containers: docker kill $(docker ps -q) #remove all containers docker rm $(docker ps -a -q) #remove all docker images docker rmi $(docker images -q) #ssl #ssl for localhost https://letsencrypt.org/docs/certificates-for-localhost/ -
Sun1ive revised this gist
May 2, 2018 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,8 @@ services: volumes: - ./config:/etc/nginx/conf.d - ./ssl:/etc/nginx/ssl # нужно изменить внешний (первый) порт на открытый # нужно изменить внутренний (второй) порт на 443 если SSL ports: - "80:80" api: -
Sun1ive revised this gist
May 2, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,6 +30,7 @@ services: volumes: - ./config:/etc/nginx/conf.d - ./ssl:/etc/nginx/ssl # тут нужно изменить внешний порт на открытый ports: - "80:80" api: -
Sun1ive revised this gist
May 2, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ server { listen 80 default_server; listen [::]:80 default_server; return 301 https://$host$request_uri; } server { listen 443 ssl default_server; -
Sun1ive revised this gist
May 2, 2018 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,13 @@ server { listen 80 default_server; listen [::]:80 default_server; } server { listen 443 ssl default_server; listen [::]:443 ssl default_server; ssl on; ssl_certificate ssl/example.com.crt; ssl_certificate_key ssl/example.com.key; server_name example.com; root /var/www/example.com; @@ -22,6 +28,7 @@ services: restart: on-failure volumes: - ./config:/etc/nginx/conf.d - ./ssl:/etc/nginx/ssl ports: - "80:80" api: -
Sun1ive revised this gist
May 2, 2018 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,4 +28,10 @@ services: image: node:latest volumes: - ./myapp:/usr/app command: /bin/bash -c "cd /usr/app && npm i && npm start" #ssl #ssl for localhost https://letsencrypt.org/docs/certificates-for-localhost/ #ssl for domain https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 -
Sun1ive created this gist
Apr 22, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ # NGINX CONFIG server { listen 80 default_server; listen [::]:80 default_server; server_name example.com; root /var/www/example.com; index index.html; location / { proxy_pass http://api:3000; } } # Docker-compose.yml version: '3.2' services: web: image: nginx restart: on-failure volumes: - ./config:/etc/nginx/conf.d ports: - "80:80" api: image: node:latest volumes: - ./myapp:/usr/app command: /bin/bash -c "cd /usr/app && npm i && npm start"