This commit is contained in:
Administrator 2022-08-13 14:59:00 +03:00
commit 47f71fb20f
5 changed files with 113 additions and 0 deletions

18
.deploy/deploy-dev.yaml Normal file
View File

@ -0,0 +1,18 @@
version: "3.6"
services:
nginx:
image: nginx
volumes:
- ./nginx_dev:/etc/nginx
ports:
- "80:80"
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: any
placement:
constraints: [node.role == manager]
update_config:
parallelism: 1
order: start-first

18
.deploy/deploy-prod.yaml Normal file
View File

@ -0,0 +1,18 @@
version: "3.6"
services:
nginx:
image: nginx
volumes:
- ./nginx_prod:/etc/nginx
ports:
- "80:80"
deploy:
mode: replicated
replicas: 2
restart_policy:
condition: any
placement:
constraints: [node.role == manager]
update_config:
parallelism: 1
order: start-first

24
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,24 @@
stages:
- deploy-dev
- deploy-prod
deploy-dev:
stage: deploy-dev
tags:
- demo
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: on_success
- when: manual
script:
- docker stack deploy -c ./.deploy/deploy-dev.yaml infra
deploy-prod:
stage: deploy-prod
tags:
- main
only:
- master
when: manual
script:
- docker stack deploy -c ./.deploy/deploy-prod.yaml infra

22
nginx_dev/nginx.conf Normal file
View File

@ -0,0 +1,22 @@
events {}
http {
client_max_body_size 50m;
server {
listen 80;
server_name dev.develop.sprinthub.ru www.dev.develop.sprinthub.ru;
location / {
proxy_pass http://dev.develop.sprinthub.ru:1235/;
}
}
server {
listen 80;
server_name swarmpit.develop.sprinthub.ru www.swarmpit.develop.sprinthub.ru;
location / {
proxy_pass http://dev.develop.sprinthub.ru:888/;
}
}
}

31
nginx_prod/nginx.conf Normal file
View File

@ -0,0 +1,31 @@
events {}
http {
client_max_body_size 50m;
server {
listen 80;
server_name dev.sprinthub.ru www.dev.sprinthub.ru;
location / {
proxy_pass http://dev.sprinthub.ru:1235/;
}
}
server {
listen 80;
server_name gitlab.sprinthub.ru www.gitlab.sprinthub.ru;
location / {
proxy_pass http://dev.sprinthub.ru:1234/;
}
}
server {
listen 80;
server_name swarmpit.sprinthub.ru www.swarmpit.sprinthub.ru;
location / {
proxy_pass http://dev.sprinthub.ru:888/;
}
}
}