Compare commits
50 Commits
master
...
7e4b38e9da
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e4b38e9da | |||
| 97ac924c22 | |||
| f342e38fea | |||
| b4bf02cb14 | |||
| 0e3d0395d7 | |||
| 2da700990b | |||
| b3d731fb5e | |||
| c04cad9712 | |||
| fd030ea07e | |||
| 3adc86e8eb | |||
| 47fc79299e | |||
| a8018d7e37 | |||
| a721ab2f4f | |||
| ce85345584 | |||
| 2dea0a941c | |||
| 6f5594ade5 | |||
| 91007c85d8 | |||
| 34217290c1 | |||
| 07f05e7e94 | |||
| 462bcd7cce | |||
| 11b9cdcf02 | |||
| 59f1a17e53 | |||
| e3292ccd60 | |||
| 838e83cfc2 | |||
| 0f18439790 | |||
| 62606adab9 | |||
| b21186d2e9 | |||
| 69d4bde07e | |||
| 500d894e91 | |||
| 05571ceb34 | |||
| e0e7929741 | |||
| afb455dc28 | |||
| 3ebead084f | |||
| 674fb16aea | |||
| fbed4fb5b0 | |||
| 72ee47c543 | |||
| 9e05d2080a | |||
| e5c4f0104e | |||
| fbf7ba5ad8 | |||
| 2a19abe3bf | |||
| d7cfb08e57 | |||
| 94ae009b29 | |||
| 13d3ec50e9 | |||
| 7b5b62f46e | |||
| d07aaeb565 | |||
| 8a3ca5ea11 | |||
| 32e63e705c | |||
| 56bfb333e9 | |||
| 7c9041cf43 | |||
| 96de98c362 |
@@ -7,7 +7,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- common-infra-nginx-development
|
- common-infra-nginx-development
|
||||||
- configurator
|
- configurator
|
||||||
- minio-development
|
|
||||||
environment:
|
environment:
|
||||||
MINIO_SECRET_KEY: $MINIO_SECRET_KEY_DEV
|
MINIO_SECRET_KEY: $MINIO_SECRET_KEY_DEV
|
||||||
ports:
|
ports:
|
||||||
@@ -28,29 +27,8 @@ services:
|
|||||||
parallelism: 1
|
parallelism: 1
|
||||||
# order: stop-first
|
# order: stop-first
|
||||||
|
|
||||||
clickhouse:
|
|
||||||
image: clickhouse
|
|
||||||
networks:
|
|
||||||
- clickhouse-development
|
|
||||||
- common-infra-nginx-development
|
|
||||||
volumes:
|
|
||||||
- /sprint-data/clickhouse:/var/lib/clickhouse
|
|
||||||
environment:
|
|
||||||
CLICKHOUSE_PASSWORD: $CLICKHOUSE_PASSWORD_DEV
|
|
||||||
deploy:
|
|
||||||
mode: replicated
|
|
||||||
replicas: 1
|
|
||||||
restart_policy:
|
|
||||||
condition: any
|
|
||||||
placement:
|
|
||||||
constraints: [node.labels.stage == development]
|
|
||||||
update_config:
|
|
||||||
parallelism: 1
|
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:14-alpine3.19
|
image: postgres:14-alpine3.19
|
||||||
networks:
|
|
||||||
- postgres-development
|
|
||||||
volumes:
|
volumes:
|
||||||
- /sprint-data/postgres-data:/var/lib/postgresql/data
|
- /sprint-data/postgres-data:/var/lib/postgresql/data
|
||||||
environment:
|
environment:
|
||||||
@@ -77,8 +55,6 @@ services:
|
|||||||
|
|
||||||
mongo:
|
mongo:
|
||||||
image: mongo:6.0.2
|
image: mongo:6.0.2
|
||||||
networks:
|
|
||||||
- mongo-development
|
|
||||||
volumes:
|
volumes:
|
||||||
- /sprint-data/mongo:/data/db
|
- /sprint-data/mongo:/data/db
|
||||||
environment:
|
environment:
|
||||||
@@ -98,6 +74,29 @@ services:
|
|||||||
parallelism: 1
|
parallelism: 1
|
||||||
order: start-first
|
order: start-first
|
||||||
|
|
||||||
|
rabbitmq:
|
||||||
|
image: rabbitmq:3.10.7-management
|
||||||
|
volumes:
|
||||||
|
- /sprint-data/rabbitmq:/var/lib/rabbitmq
|
||||||
|
ports:
|
||||||
|
- published: 5672
|
||||||
|
target: 5672
|
||||||
|
mode: host
|
||||||
|
- published: 15672
|
||||||
|
target: 15672
|
||||||
|
mode: host
|
||||||
|
environment:
|
||||||
|
RABBITMQ_DEFAULT_PASS: $RABBITMQ_PASSWORD_DEV
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
restart_policy:
|
||||||
|
condition: any
|
||||||
|
placement:
|
||||||
|
constraints: [node.labels.stage == development]
|
||||||
|
update_config:
|
||||||
|
parallelism: 1
|
||||||
|
order: start-first
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine3.16
|
image: redis:alpine3.16
|
||||||
volumes:
|
volumes:
|
||||||
@@ -119,8 +118,6 @@ services:
|
|||||||
|
|
||||||
minio:
|
minio:
|
||||||
image: bitnami/minio:2022.10.8
|
image: bitnami/minio:2022.10.8
|
||||||
networks:
|
|
||||||
- minio-development
|
|
||||||
volumes:
|
volumes:
|
||||||
- minio_data:/data
|
- minio_data:/data
|
||||||
environment:
|
environment:
|
||||||
@@ -149,7 +146,7 @@ services:
|
|||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- /sprint-data:/sprint-data
|
- /sprint-data:/sprint-data
|
||||||
environment:
|
environment:
|
||||||
GITEA_INSTANCE_URL: https://gitea.chocomarsh.com/
|
GITEA_INSTANCE_URL: https://gitea.sprinthub.ru/
|
||||||
GITEA_RUNNER_REGISTRATION_TOKEN: $REGISTRATION_TOKEN
|
GITEA_RUNNER_REGISTRATION_TOKEN: $REGISTRATION_TOKEN
|
||||||
GITEA_RUNNER_NAME: dev
|
GITEA_RUNNER_NAME: dev
|
||||||
GITEA_RUNNER_LABELS: dev
|
GITEA_RUNNER_LABELS: dev
|
||||||
@@ -172,11 +169,3 @@ networks:
|
|||||||
external: true
|
external: true
|
||||||
configurator:
|
configurator:
|
||||||
external: true
|
external: true
|
||||||
clickhouse-development:
|
|
||||||
external: true
|
|
||||||
postgres-development:
|
|
||||||
external: true
|
|
||||||
mongo-development:
|
|
||||||
external: true
|
|
||||||
minio-development:
|
|
||||||
external: true
|
|
||||||
124
.deploy-infra/deploy-prod.yaml
Executable file → Normal file
124
.deploy-infra/deploy-prod.yaml
Executable file → Normal file
@@ -7,7 +7,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- common-infra-nginx
|
- common-infra-nginx
|
||||||
- configurator
|
- configurator
|
||||||
- minio
|
|
||||||
environment:
|
environment:
|
||||||
MINIO_SECRET_KEY: $MINIO_SECRET_KEY_PROD
|
MINIO_SECRET_KEY: $MINIO_SECRET_KEY_PROD
|
||||||
ports:
|
ports:
|
||||||
@@ -28,58 +27,8 @@ services:
|
|||||||
parallelism: 1
|
parallelism: 1
|
||||||
# order: start-first
|
# order: start-first
|
||||||
|
|
||||||
grafana:
|
|
||||||
image: grafana/grafana
|
|
||||||
networks:
|
|
||||||
- common-infra-nginx
|
|
||||||
- clickhouse
|
|
||||||
volumes:
|
|
||||||
- /sprint-data/grafana:/var/lib/grafana
|
|
||||||
environment:
|
|
||||||
GF_SERVER_ROOT_URL: https://grafana.chocomarsh.com
|
|
||||||
GF_CORS_ENABLED: "false"
|
|
||||||
GF_AUTH_DISABLE_LOGIN_FORM: "false"
|
|
||||||
GF_CORS_ALLOW_ORIGINS: "*"
|
|
||||||
GF_SECURITY_CONTENT_SECURITY_POLICY: "false"
|
|
||||||
deploy:
|
|
||||||
mode: replicated
|
|
||||||
replicas: 1
|
|
||||||
restart_policy:
|
|
||||||
condition: any
|
|
||||||
placement:
|
|
||||||
constraints: [node.labels.stage == production]
|
|
||||||
update_config:
|
|
||||||
parallelism: 1
|
|
||||||
|
|
||||||
clickhouse:
|
|
||||||
image: clickhouse
|
|
||||||
networks:
|
|
||||||
- clickhouse
|
|
||||||
volumes:
|
|
||||||
- /sprint-data/clickhouse:/var/lib/clickhouse
|
|
||||||
environment:
|
|
||||||
CLICKHOUSE_PASSWORD: $CLICKHOUSE_PASSWORD_PROD
|
|
||||||
deploy:
|
|
||||||
mode: replicated
|
|
||||||
replicas: 1
|
|
||||||
restart_policy:
|
|
||||||
condition: any
|
|
||||||
placement:
|
|
||||||
constraints: [node.labels.stage == production]
|
|
||||||
update_config:
|
|
||||||
parallelism: 1
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
memory: 2048M
|
|
||||||
cpus: '2.0'
|
|
||||||
reservations:
|
|
||||||
memory: 1024M
|
|
||||||
cpus: '1.0'
|
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:14-alpine3.19
|
image: postgres:14-alpine3.19
|
||||||
networks:
|
|
||||||
- postgres
|
|
||||||
volumes:
|
volumes:
|
||||||
- /sprint-data/postgres-data:/var/lib/postgresql/data
|
- /sprint-data/postgres-data:/var/lib/postgresql/data
|
||||||
environment:
|
environment:
|
||||||
@@ -111,8 +60,6 @@ services:
|
|||||||
|
|
||||||
mongo:
|
mongo:
|
||||||
image: mongo:6.0.2
|
image: mongo:6.0.2
|
||||||
networks:
|
|
||||||
- mongo
|
|
||||||
volumes:
|
volumes:
|
||||||
- /sprint-data/mongo:/data/db
|
- /sprint-data/mongo:/data/db
|
||||||
environment:
|
environment:
|
||||||
@@ -132,6 +79,29 @@ services:
|
|||||||
parallelism: 1
|
parallelism: 1
|
||||||
order: start-first
|
order: start-first
|
||||||
|
|
||||||
|
rabbitmq:
|
||||||
|
image: rabbitmq:3.10.7-management
|
||||||
|
volumes:
|
||||||
|
- /sprint-data/rabbitmq:/var/lib/rabbitmq
|
||||||
|
ports:
|
||||||
|
- published: 5672
|
||||||
|
target: 5672
|
||||||
|
mode: host
|
||||||
|
- published: 15672
|
||||||
|
target: 15672
|
||||||
|
mode: host
|
||||||
|
environment:
|
||||||
|
RABBITMQ_DEFAULT_PASS: $RABBITMQ_PASSWORD_PROD
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
restart_policy:
|
||||||
|
condition: any
|
||||||
|
placement:
|
||||||
|
constraints: [node.labels.stage == production]
|
||||||
|
update_config:
|
||||||
|
parallelism: 1
|
||||||
|
order: start-first
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine3.16
|
image: redis:alpine3.16
|
||||||
volumes:
|
volumes:
|
||||||
@@ -153,8 +123,6 @@ services:
|
|||||||
|
|
||||||
minio:
|
minio:
|
||||||
image: bitnami/minio:2022.10.8
|
image: bitnami/minio:2022.10.8
|
||||||
networks:
|
|
||||||
- minio
|
|
||||||
volumes:
|
volumes:
|
||||||
- minio_data:/data
|
- minio_data:/data
|
||||||
environment:
|
environment:
|
||||||
@@ -178,9 +146,7 @@ services:
|
|||||||
order: start-first
|
order: start-first
|
||||||
|
|
||||||
gitea:
|
gitea:
|
||||||
image: gitea/gitea:1.24.6
|
image: gitea/gitea:1.22.3
|
||||||
networks:
|
|
||||||
- postgres
|
|
||||||
volumes:
|
volumes:
|
||||||
- /sprint-data/gitea:/data
|
- /sprint-data/gitea:/data
|
||||||
- /etc/timezone:/etc/timezone
|
- /etc/timezone:/etc/timezone
|
||||||
@@ -192,7 +158,7 @@ services:
|
|||||||
USER_UID: 1000
|
USER_UID: 1000
|
||||||
USER_GID: 1000
|
USER_GID: 1000
|
||||||
GITEA__database__DB_TYPE: postgres
|
GITEA__database__DB_TYPE: postgres
|
||||||
GITEA__database__HOST: postgres:5432
|
GITEA__database__HOST: pg.sprinthub.ru:5432
|
||||||
GITEA__database__NAME: gitea
|
GITEA__database__NAME: gitea
|
||||||
GITEA__database__USER: postgres
|
GITEA__database__USER: postgres
|
||||||
GITEA__database__PASSWD: $DB_PASSWORD_PROD
|
GITEA__database__PASSWD: $DB_PASSWORD_PROD
|
||||||
@@ -211,9 +177,8 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- /sprint-data:/sprint-data
|
- /sprint-data:/sprint-data
|
||||||
- /root/.cache/act:/root/.cache/act
|
|
||||||
environment:
|
environment:
|
||||||
GITEA_INSTANCE_URL: https://gitea.chocomarsh.com/
|
GITEA_INSTANCE_URL: https://gitea.sprinthub.ru/
|
||||||
GITEA_RUNNER_REGISTRATION_TOKEN: $REGISTRATION_TOKEN
|
GITEA_RUNNER_REGISTRATION_TOKEN: $REGISTRATION_TOKEN
|
||||||
GITEA_RUNNER_NAME: prod
|
GITEA_RUNNER_NAME: prod
|
||||||
GITEA_RUNNER_LABELS: prod
|
GITEA_RUNNER_LABELS: prod
|
||||||
@@ -227,6 +192,35 @@ services:
|
|||||||
parallelism: 1
|
parallelism: 1
|
||||||
order: start-first
|
order: start-first
|
||||||
|
|
||||||
|
keycloak:
|
||||||
|
image: quay.io/keycloak/keycloak
|
||||||
|
ports:
|
||||||
|
- "8443:3000"
|
||||||
|
environment:
|
||||||
|
KC_DB: postgres
|
||||||
|
KC_DB_URL: jdbc:postgresql://0.0.0.0:5432/keycloak
|
||||||
|
KC_DB_USERNAME: postgres
|
||||||
|
KC_DB_PASSWORD: $DB_PASSWORD_PROD
|
||||||
|
KC_HOSTNAME: keycloak.sprinthub.ru
|
||||||
|
JAVA_OPTS_KC_HEAP: "-XX:MaxHeapFreeRatio=50 -XX:MaxRAMPercentage=65"
|
||||||
|
command: start
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
placement:
|
||||||
|
constraints: [node.labels.stage == production]
|
||||||
|
restart_policy:
|
||||||
|
condition: any
|
||||||
|
update_config:
|
||||||
|
parallelism: 1
|
||||||
|
order: start-first
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '1.0'
|
||||||
|
memory: 250M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.50'
|
||||||
|
memory: 125M
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
minio_data:
|
minio_data:
|
||||||
driver: local
|
driver: local
|
||||||
@@ -240,11 +234,3 @@ networks:
|
|||||||
external: true
|
external: true
|
||||||
configurator:
|
configurator:
|
||||||
external: true
|
external: true
|
||||||
clickhouse:
|
|
||||||
external: true
|
|
||||||
postgres:
|
|
||||||
external: true
|
|
||||||
mongo:
|
|
||||||
external: true
|
|
||||||
minio:
|
|
||||||
external: true
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ version: '3.2'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
agent:
|
agent:
|
||||||
image: portainer/agent:2.33.1
|
image: portainer/agent:2.11.1
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- /var/lib/docker/volumes:/var/lib/docker/volumes
|
- /var/lib/docker/volumes:/var/lib/docker/volumes
|
||||||
@@ -14,7 +14,7 @@ services:
|
|||||||
constraints: [node.platform.os == linux]
|
constraints: [node.platform.os == linux]
|
||||||
|
|
||||||
portainer:
|
portainer:
|
||||||
image: portainer/portainer-ce:2.33.1
|
image: portainer/portainer-ce:2.11.1
|
||||||
command: -H tcp://tasks.agent:9001 --tlsskipverify
|
command: -H tcp://tasks.agent:9001 --tlsskipverify
|
||||||
ports:
|
ports:
|
||||||
- "9443:9443"
|
- "9443:9443"
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ jobs:
|
|||||||
ref: dev
|
ref: dev
|
||||||
- name: build nginx dev
|
- name: build nginx dev
|
||||||
run: docker build -t mathwave/sprint-repo:sprint-infra-nginx-dev nginx/nginx-dev
|
run: docker build -t mathwave/sprint-repo:sprint-infra-nginx-dev nginx/nginx-dev
|
||||||
|
- name: build gitea runner
|
||||||
|
run: docker build -t mathwave/sprint-repo:gitea-runner gitea-runner
|
||||||
push:
|
push:
|
||||||
name: Push
|
name: Push
|
||||||
runs-on: [ prod ]
|
runs-on: [ prod ]
|
||||||
@@ -56,7 +58,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
MONGO_PASSWORD_DEV: ${{ secrets.MONGO_PASSWORD_DEV }}
|
MONGO_PASSWORD_DEV: ${{ secrets.MONGO_PASSWORD_DEV }}
|
||||||
DB_PASSWORD_DEV: ${{ secrets.POSTGRES_PASSWORD_DEV }}
|
DB_PASSWORD_DEV: ${{ secrets.POSTGRES_PASSWORD_DEV }}
|
||||||
CLICKHOUSE_PASSWORD_DEV: ${{ secrets.CLICKHOUSE_PASSWORD_DEV }}
|
|
||||||
MINIO_PASSWORD_DEV: ${{ secrets.MINIO_PASSWORD_DEV }}
|
MINIO_PASSWORD_DEV: ${{ secrets.MINIO_PASSWORD_DEV }}
|
||||||
MINIO_SECRET_KEY_DEV: ${{ secrets.MINIO_SECRET_KEY_DEV }}
|
MINIO_SECRET_KEY_DEV: ${{ secrets.MINIO_SECRET_KEY_DEV }}
|
||||||
REDIS_PASSWORD_DEV: ${{ secrets.REDIS_PASSWORD_DEV }}
|
REDIS_PASSWORD_DEV: ${{ secrets.REDIS_PASSWORD_DEV }}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ jobs:
|
|||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: prod
|
ref: dev
|
||||||
- name: build nginx prod
|
- name: build nginx prod
|
||||||
run: docker build -t mathwave/sprint-repo:sprint-infra-nginx-prod nginx/nginx-prod
|
run: docker build -t mathwave/sprint-repo:sprint-infra-nginx-prod nginx/nginx-prod
|
||||||
- name: build gitea runner
|
- name: build gitea runner
|
||||||
@@ -40,7 +40,7 @@ jobs:
|
|||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: prod
|
ref: dev
|
||||||
- name: prepare
|
- name: prepare
|
||||||
run: chmod 777 ./prepare/run-production.sh && ./prepare/run-production.sh
|
run: chmod 777 ./prepare/run-production.sh && ./prepare/run-production.sh
|
||||||
deploy-prod:
|
deploy-prod:
|
||||||
@@ -54,19 +54,17 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: prod
|
ref: prod
|
||||||
|
- name: deploy swarmpit
|
||||||
|
run: docker stack deploy --with-registry-auth -c ./.deploy-swarmpit/deploy-prod.yaml swarmpit
|
||||||
- name: deploy portainer
|
- name: deploy portainer
|
||||||
run: docker stack deploy --with-registry-auth -c ./.deploy-portainer/deploy-prod.yaml portainer
|
run: docker stack deploy --with-registry-auth -c ./.deploy-portainer/deploy-prod.yaml portainer
|
||||||
- name: deploy infra
|
- name: deploy infra
|
||||||
env:
|
env:
|
||||||
MONGO_PASSWORD_PROD: ${{ secrets.MONGO_PASSWORD_PROD }}
|
MONGO_PASSWORD_PROD: ${{ secrets.MONGO_PASSWORD_PROD }}
|
||||||
DB_PASSWORD_PROD: ${{ secrets.POSTGRES_PASSWORD_PROD }}
|
DB_PASSWORD_PROD: ${{ secrets.POSTGRES_PASSWORD_PROD }}
|
||||||
CLICKHOUSE_PASSWORD_PROD: ${{ secrets.CLICKHOUSE_PASSWORD_PROD }}
|
|
||||||
MINIO_PASSWORD_PROD: ${{ secrets.MINIO_PASSWORD_PROD }}
|
MINIO_PASSWORD_PROD: ${{ secrets.MINIO_PASSWORD_PROD }}
|
||||||
MINIO_SECRET_KEY_PROD: ${{ secrets.MINIO_SECRET_KEY_PROD }}
|
MINIO_SECRET_KEY_PROD: ${{ secrets.MINIO_SECRET_KEY_PROD }}
|
||||||
REDIS_PASSWORD_PROD: ${{ secrets.REDIS_PASSWORD_PROD }}
|
REDIS_PASSWORD_PROD: ${{ secrets.REDIS_PASSWORD_PROD }}
|
||||||
RABBITMQ_PASSWORD_PROD: ${{ secrets.RABBITMQ_PASSWORD_PROD }}
|
RABBITMQ_PASSWORD_PROD: ${{ secrets.RABBITMQ_PASSWORD_PROD }}
|
||||||
REGISTRATION_TOKEN: ${{ secrets.REGISTRATION_TOKEN }}
|
REGISTRATION_TOKEN: ${{ secrets.REGISTRATION_TOKEN }}
|
||||||
AUTHTHELIA_JWT_SECRET: ${{ secrets.AUTHTHELIA_JWT_SECRET }}
|
|
||||||
AUTHTHELIA_SESSION_SECRET: ${{ secrets.AUTHTHELIA_SESSION_SECRET }}
|
|
||||||
AUTHELIA_STORAGE_ENCRYPTION_KEY: ${{ secrets.AUTHELIA_STORAGE_ENCRYPTION_KEY }}
|
|
||||||
run: docker stack deploy --with-registry-auth -c ./.deploy-infra/deploy-prod.yaml infra
|
run: docker stack deploy --with-registry-auth -c ./.deploy-infra/deploy-prod.yaml infra
|
||||||
|
|||||||
@@ -3,4 +3,3 @@ FROM gitea/act_runner:nightly
|
|||||||
RUN apk add docker
|
RUN apk add docker
|
||||||
RUN apk add git
|
RUN apk add git
|
||||||
RUN apk add --no-cache nodejs
|
RUN apk add --no-cache nodejs
|
||||||
RUN apk add --no-cache make
|
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ FROM nginx
|
|||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install certbot --yes
|
RUN apt-get install certbot --yes
|
||||||
RUN apt-get install python3-certbot-nginx python3-pip --yes
|
RUN apt-get install python3-certbot-nginx python3-pip --yes
|
||||||
RUN pip3 install --break-system-packages minio
|
RUN pip3 install --break-system-packages requests minio
|
||||||
COPY ./config /etc/nginx
|
COPY ./config /etc/nginx
|
||||||
|
COPY ./fullchain.pem /etc/nginx/fullchain.pem
|
||||||
|
COPY ./privkey.pem /etc/nginx/privkey.pem
|
||||||
COPY prepare.py prepare.py
|
COPY prepare.py prepare.py
|
||||||
COPY run.sh run.sh
|
COPY run.sh run.sh
|
||||||
COPY refre.sh refre.sh
|
COPY refre.sh refre.sh
|
||||||
|
|||||||
@@ -8,17 +8,6 @@ http {
|
|||||||
'' close;
|
'' close;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name *.develop.sprinthub.ru;
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name *.dev.chocomarsh.com;
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
include ./hosts.conf;
|
include ./hosts.conf;
|
||||||
|
include ./sprinthub.conf;
|
||||||
}
|
}
|
||||||
118
nginx/nginx-dev/config/sprinthub.conf
Normal file
118
nginx/nginx-dev/config/sprinthub.conf
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name *.develop.sprinthub.ru;
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
server_name swarmpit.develop.sprinthub.ru;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/privkey.pem;
|
||||||
|
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
||||||
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://develop.sprinthub.ru:888/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
server_name portainer.develop.sprinthub.ru;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/privkey.pem;
|
||||||
|
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
||||||
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://develop.sprinthub.ru:8888/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/websocket/ {
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_pass http://develop.sprinthub.ru:8888/api/websocket/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
server_name rabbitmq.develop.sprinthub.ru;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/privkey.pem;
|
||||||
|
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
||||||
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://develop.sprinthub.ru:15672/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
server_name minio.develop.sprinthub.ru;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/privkey.pem;
|
||||||
|
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
||||||
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://develop.sprinthub.ru:9001/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
server_name grafana.develop.sprinthub.ru;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/privkey.pem;
|
||||||
|
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
||||||
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://develop.sprinthub.ru:3000/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/live/ws {
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_pass http://develop.sprinthub.ru:3000/api/live/ws;
|
||||||
|
}
|
||||||
|
}
|
||||||
48
nginx/nginx-dev/fullchain.pem
Normal file
48
nginx/nginx-dev/fullchain.pem
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDmTCCAx+gAwIBAgISBmM6pAg0qa3+cxLar5nvn27GMAoGCCqGSM49BAMDMDIx
|
||||||
|
CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQDEwJF
|
||||||
|
NTAeFw0yNTA1MzAyMTEzMjZaFw0yNTA4MjgyMTEzMjVaMCExHzAdBgNVBAMMFiou
|
||||||
|
ZGV2ZWxvcC5zcHJpbnRodWIucnUwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATy
|
||||||
|
YXxx4cfN6ga0duaq7STjZxNwtFQ7c0ZAO+D7ulmdf/jpK8Xfkj5d0KMX0jhTmTEg
|
||||||
|
DUwvBMsH/f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||||||
|
bcwbZM6sTDIaEriR/PLk6LKs9Be0uoVxgOKDcpG9svD33J+G9Lcfv1K9luDmSTgG
|
||||||
|
6XNFIN5vfI5gs/lMPyojEMdIzK9blcl2/1vKxO8WGCcjvsQ1nJ/Pwt8LQZBfOFyV
|
||||||
|
XP8ubAp/au3dc4EKWG9MO5zcx1qT9+NXRGdVWxGvmBFRAajciMfXME1ZuGmk3/GO
|
||||||
|
koAM7ZkjZmleyokP1LGzmfJcUd9s7eeu1/9/eg5XlXd/55GtYjAM+C4DG5i7eaNq
|
||||||
|
cm2F+yxYIPt6cbbtYVNJCGfHWqHEQ4FYStUyFnv8sjyqU8ypgZaNJ9aVcWSICLOI
|
||||||
|
E1/Qv/7oKsnZCWJ926wU6RqG1OYPGOi1zuABhLw61cuPVDT28nQS/e6z95cJXq0e
|
||||||
|
K1BcaJ6fJZsmbjRgD5p3mvEf5vdQM7MCEvU0tHbsx2I5mHHJoABHb8KVBgWp/lcX
|
||||||
|
GWiWaeOyB7RP+OfDtvi2OsapxXiV7vNVs7fMlrRjY1joKaqmmycnBvAq14AEbtyL
|
||||||
|
sVfOS66B8apkeFX2NY4XPEYV4ZSCe8VHPrdrERk2wILG3T/EGmSIkCYVUMSnjmJd
|
||||||
|
VQD9F6Na/+zmXCc=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -1,36 +1,23 @@
|
|||||||
|
from requests import get
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
from minio import Minio
|
from minio import Minio
|
||||||
from urllib.request import urlopen
|
|
||||||
from json import loads
|
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
minio_client = Minio(
|
minio_client = Minio(
|
||||||
"minio:9000",
|
"minio.develop.sprinthub.ru:9000",
|
||||||
access_key="serviceminioadmin",
|
access_key="serviceminioadmin",
|
||||||
secret_key=os.getenv("MINIO_SECRET_KEY", "minioadmin"),
|
secret_key=os.getenv("MINIO_SECRET_KEY", "minioadmin"),
|
||||||
secure=False,
|
secure=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get(url):
|
hosts = get('http://configurator/api/v1/fetch?project=certupdater&stage=development').json()['configs']['hosts']
|
||||||
with urlopen(url) as response:
|
hosts = {**hosts, 'platform.develop.sprinthub.ru': {'host': 'platform-nginx', 'port': 1238}}
|
||||||
data = response.read().decode("utf-8")
|
|
||||||
return loads(data)
|
|
||||||
|
|
||||||
|
config = ''
|
||||||
try:
|
|
||||||
response = get(
|
|
||||||
"http://configurator/api/v1/fetch?project=certupdater&stage=development"
|
|
||||||
)
|
|
||||||
hosts = response["configs"]["hosts"]
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error fetching config: {e}", file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
config = ""
|
|
||||||
for host, params in hosts.items():
|
for host, params in hosts.items():
|
||||||
config += """
|
config += '''
|
||||||
server {{
|
server {{
|
||||||
listen 443 ssl http2;
|
listen 443 ssl http2;
|
||||||
listen [::]:443 ssl http2;
|
listen [::]:443 ssl http2;
|
||||||
@@ -43,43 +30,30 @@ for host, params in hosts.items():
|
|||||||
add_header X-XSS-Protection "1; mode=block" always;
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
add_header X-Content-Type-Options "nosniff" always;
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
||||||
proxy_set_header Host $host;
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
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;
|
|
||||||
|
|
||||||
location / {{
|
location / {{
|
||||||
resolver 127.0.0.11;
|
resolver 127.0.0.11;
|
||||||
proxy_pass http://{target_host}:{port}$request_uri;
|
proxy_pass http://{target_host}:{port}$request_uri;
|
||||||
}}
|
}}
|
||||||
}}\n\n
|
}}\n\n
|
||||||
""".format(
|
'''.format(host=host, target_host=params['host'], port=params['port'])
|
||||||
host=host, target_host=params["host"], port=params["port"]
|
fullchain = minio_client.get_object("certupdater", f'certificates/{host}/fullchain.pem')
|
||||||
)
|
privkey = minio_client.get_object("certupdater", f'certificates/{host}/privkey.pem')
|
||||||
try:
|
try:
|
||||||
fullchain = minio_client.get_object(
|
os.mkdir(f'/etc/nginx/{host}')
|
||||||
"certupdater", f"certificates/{host}/fullchain.pem"
|
except FileExistsError:
|
||||||
)
|
...
|
||||||
privkey = minio_client.get_object(
|
with open(f"/etc/nginx/{host}/fullchain.pem", 'wb') as fp:
|
||||||
"certupdater", f"certificates/{host}/privkey.pem"
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
os.makedirs(f"/etc/nginx/{host}", exist_ok=True)
|
|
||||||
except OSError as e:
|
|
||||||
print(f"Error creating directory: {e}", file=sys.stderr)
|
|
||||||
continue
|
|
||||||
|
|
||||||
with open(f"/etc/nginx/{host}/fullchain.pem", "wb") as fp:
|
|
||||||
fp.write(fullchain.data)
|
fp.write(fullchain.data)
|
||||||
with open(f"/etc/nginx/{host}/privkey.pem", "wb") as fp:
|
with open(f"/etc/nginx/{host}/privkey.pem", 'wb') as fp:
|
||||||
fp.write(privkey.data)
|
fp.write(privkey.data)
|
||||||
except Exception as e:
|
|
||||||
print(f"Error processing host {host}: {e}", file=sys.stderr)
|
with open('/etc/nginx/hosts.conf', 'w') as fp:
|
||||||
continue
|
fp.write(config)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open("/etc/nginx/hosts.conf", "w") as fp:
|
main()
|
||||||
fp.write(config)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error writing config file: {e}", file=sys.stderr)
|
print(e)
|
||||||
sys.exit(1)
|
|
||||||
|
|||||||
5
nginx/nginx-dev/privkey.pem
Normal file
5
nginx/nginx-dev/privkey.pem
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIPtfut2MheT8iyX6/EXDHHDR9yvtYLxMUg34mLeCpngpoAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAE8mF8ceHHzeoGtHbmqu0k42cTcLRUO3NGQDvg+7pZnX/46SvF35I+
|
||||||
|
XdCjF9I4U5kxIA1MLwTLB/36crrhHRzT1g==
|
||||||
|
-----END EC PRIVATE KEY-----
|
||||||
@@ -1,11 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if ! python3 prepare.py; then
|
python3 prepare.py
|
||||||
echo "Error running prepare.py" >&2
|
nginx -s reload
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! nginx -s reload; then
|
|
||||||
echo "Error reloading nginx" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -2,8 +2,10 @@ FROM nginx
|
|||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install certbot --yes
|
RUN apt-get install certbot --yes
|
||||||
RUN apt-get install python3-certbot-nginx python3-pip --yes
|
RUN apt-get install python3-certbot-nginx python3-pip --yes
|
||||||
RUN pip3 install --break-system-packages minio
|
RUN pip3 install --break-system-packages requests minio
|
||||||
COPY ./config /etc/nginx
|
COPY ./config /etc/nginx
|
||||||
|
COPY ./fullchain.pem /etc/nginx/fullchain.pem
|
||||||
|
COPY ./privkey.pem /etc/nginx/privkey.pem
|
||||||
COPY prepare.py prepare.py
|
COPY prepare.py prepare.py
|
||||||
COPY run.sh run.sh
|
COPY run.sh run.sh
|
||||||
COPY refre.sh refre.sh
|
COPY refre.sh refre.sh
|
||||||
|
|||||||
@@ -8,17 +8,6 @@ http {
|
|||||||
'' close;
|
'' close;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name *.sprinthub.ru;
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name *.chocomarsh.com;
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
include ./hosts.conf;
|
include ./hosts.conf;
|
||||||
|
include ./sprinthub.conf;
|
||||||
}
|
}
|
||||||
90
nginx/nginx-prod/config/sprinthub.conf
Normal file
90
nginx/nginx-prod/config/sprinthub.conf
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name *.sprinthub.ru;
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
server_name swarmpit.sprinthub.ru;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/privkey.pem;
|
||||||
|
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
||||||
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://dev.sprinthub.ru:888/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
server_name portainer.sprinthub.ru;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/privkey.pem;
|
||||||
|
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
||||||
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://dev.sprinthub.ru:8888/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/websocket/ {
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_pass http://dev.sprinthub.ru:8888/api/websocket/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
server_name minio.sprinthub.ru;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/privkey.pem;
|
||||||
|
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
||||||
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://dev.sprinthub.ru:9001/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
server_name gitea.sprinthub.ru;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/privkey.pem;
|
||||||
|
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
||||||
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://dev.sprinthub.ru:3000/;
|
||||||
|
}
|
||||||
|
}
|
||||||
47
nginx/nginx-prod/fullchain.pem
Normal file
47
nginx/nginx-prod/fullchain.pem
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDhzCCAw6gAwIBAgISBXELtGOqEI5IsXNFUC7cue03MAoGCCqGSM49BAMDMDIx
|
||||||
|
CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQDEwJF
|
||||||
|
NTAeFw0yNTA1MzAyMTQ3MzZaFw0yNTA4MjgyMTQ3MzVaMBkxFzAVBgNVBAMMDiou
|
||||||
|
c3ByaW50aHViLnJ1MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEoS3M+thgeup/
|
||||||
|
F6JS7kVNJCWee8xzLkoIUcZNgNqmoovVSP02K9azdDRAp+c2OlzJqJQC+ZefswCB
|
||||||
|
2xvjNSoL2aOCAhswggIXMA4GA1UdDwEB/wQEAwIHgDAdBgNVHSUEFjAUBggrBgEF
|
||||||
|
BQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUu+3qfzUyaCAb
|
||||||
|
POu7GPUO6ZI2WfswHwYDVR0jBBgwFoAUnytfzzwhT50Et+0rLMTGcIvS1w0wMgYI
|
||||||
|
KwYBBQUHAQEEJjAkMCIGCCsGAQUFBzAChhZodHRwOi8vZTUuaS5sZW5jci5vcmcv
|
||||||
|
MBkGA1UdEQQSMBCCDiouc3ByaW50aHViLnJ1MBMGA1UdIAQMMAowCAYGZ4EMAQIB
|
||||||
|
MC0GA1UdHwQmMCQwIqAgoB6GHGh0dHA6Ly9lNS5jLmxlbmNyLm9yZy81Ni5jcmww
|
||||||
|
ggEDBgorBgEEAdZ5AgQCBIH0BIHxAO8AdgDd3Mo0ldfhFgXnlTL6x5/4PRxQ39sA
|
||||||
|
OhQSdgosrLvIKgAAAZcjX78RAAAEAwBHMEUCIDNC6e7jNcTXW1bti1nkseruXw84
|
||||||
|
b8dsVzBt96FtE4+aAiEAr7ugvtozhmp6JdkIEfdHKecym9TxcL1h43j6rbKU3d8A
|
||||||
|
dQAaBP9J0FQdQK/2oMO/8djEZy9O7O4jQGiYaxdALtyJfQAAAZcjX8BoAAAEAwBG
|
||||||
|
MEQCIDezeAIFZ25OWXVV9hmtzEE5ujP0IyFaLxebyXAflYZMAiAy09hFLQXapebE
|
||||||
|
5YDtvqfmefapEsr4OaWyfusWjmeaiDAKBggqhkjOPQQDAwNnADBkAjAobO18Vk18
|
||||||
|
BG7lBbXEQ0O8RYy+CEV/ef1ni2CBQp+MtmG/ZCWAbfEXFaj2WKng5Q0CMFRR9icx
|
||||||
|
p6/tLUixnJfAusGudEtD5Leh2foPDT2jzgazaROaVFVTrCJMGcdgVukuPQ==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIEVzCCAj+gAwIBAgIRAIOPbGPOsTmMYgZigxXJ/d4wDQYJKoZIhvcNAQELBQAw
|
||||||
|
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
|
||||||
|
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjQwMzEzMDAwMDAw
|
||||||
|
WhcNMjcwMzEyMjM1OTU5WjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg
|
||||||
|
RW5jcnlwdDELMAkGA1UEAxMCRTUwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNCzqK
|
||||||
|
a2GOtu/cX1jnxkJFVKtj9mZhSAouWXW0gQI3ULc/FnncmOyhKJd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ZsmbjRgD5p3mvEf5vdQM7MCEvU0tHbsx2I5mHHJoABHb8KVBgWp/lcX
|
||||||
|
GWiWaeOyB7RP+OfDtvi2OsapxXiV7vNVs7fMlrRjY1joKaqmmycnBvAq14AEbtyL
|
||||||
|
sVfOS66B8apkeFX2NY4XPEYV4ZSCe8VHPrdrERk2wILG3T/EGmSIkCYVUMSnjmJd
|
||||||
|
VQD9F6Na/+zmXCc=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -1,36 +1,22 @@
|
|||||||
|
from requests import get
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
from minio import Minio
|
from minio import Minio
|
||||||
from urllib.request import urlopen
|
|
||||||
from json import loads
|
|
||||||
|
|
||||||
|
|
||||||
minio_client = Minio(
|
minio_client = Minio(
|
||||||
"minio:9000",
|
"minio.sprinthub.ru:9000",
|
||||||
access_key="serviceminioadmin",
|
access_key="serviceminioadmin",
|
||||||
secret_key=os.getenv("MINIO_SECRET_KEY", "minioadmin"),
|
secret_key=os.getenv("MINIO_SECRET_KEY", "minioadmin"),
|
||||||
secure=False,
|
secure=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get(url):
|
hosts = get('http://configurator/api/v1/fetch?project=certupdater&stage=production').json()['configs']['hosts']
|
||||||
with urlopen(url) as response:
|
hosts = {**hosts, 'platform.sprinthub.ru': {'host': 'platform-nginx', 'port': 1238}}
|
||||||
data = response.read().decode("utf-8")
|
|
||||||
return loads(data)
|
|
||||||
|
|
||||||
|
config = ''
|
||||||
try:
|
|
||||||
response = get(
|
|
||||||
"http://configurator/api/v1/fetch?project=certupdater&stage=production"
|
|
||||||
)
|
|
||||||
hosts = response["configs"]["hosts"]
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error fetching config: {e}", file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
config = ""
|
|
||||||
for host, params in hosts.items():
|
for host, params in hosts.items():
|
||||||
config += """
|
config += '''
|
||||||
server {{
|
server {{
|
||||||
listen 443 ssl http2;
|
listen 443 ssl http2;
|
||||||
listen [::]:443 ssl http2;
|
listen [::]:443 ssl http2;
|
||||||
@@ -43,43 +29,24 @@ for host, params in hosts.items():
|
|||||||
add_header X-XSS-Protection "1; mode=block" always;
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
add_header X-Content-Type-Options "nosniff" always;
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
add_header Referrer-Policy "no-refferer-when-downgrade" always;
|
||||||
proxy_set_header Host $host;
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
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;
|
|
||||||
|
|
||||||
location / {{
|
location / {{
|
||||||
resolver 127.0.0.11;
|
resolver 127.0.0.11;
|
||||||
proxy_pass http://{target_host}:{port}$request_uri;
|
proxy_pass http://{target_host}:{port}$request_uri;
|
||||||
}}
|
}}
|
||||||
}}\n\n
|
}}\n\n
|
||||||
""".format(
|
'''.format(host=host, target_host=params['host'], port=params['port'])
|
||||||
host=host, target_host=params["host"], port=params["port"]
|
fullchain = minio_client.get_object("certupdater", f'certificates/{host}/fullchain.pem')
|
||||||
)
|
privkey = minio_client.get_object("certupdater", f'certificates/{host}/privkey.pem')
|
||||||
try:
|
try:
|
||||||
fullchain = minio_client.get_object(
|
os.mkdir(f'/etc/nginx/{host}')
|
||||||
"certupdater", f"certificates/{host}/fullchain.pem"
|
except FileExistsError:
|
||||||
)
|
...
|
||||||
privkey = minio_client.get_object(
|
with open(f"/etc/nginx/{host}/fullchain.pem", 'wb') as fp:
|
||||||
"certupdater", f"certificates/{host}/privkey.pem"
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
os.makedirs(f"/etc/nginx/{host}", exist_ok=True)
|
|
||||||
except OSError as e:
|
|
||||||
print(f"Error creating directory: {e}", file=sys.stderr)
|
|
||||||
continue
|
|
||||||
|
|
||||||
with open(f"/etc/nginx/{host}/fullchain.pem", "wb") as fp:
|
|
||||||
fp.write(fullchain.data)
|
fp.write(fullchain.data)
|
||||||
with open(f"/etc/nginx/{host}/privkey.pem", "wb") as fp:
|
with open(f"/etc/nginx/{host}/privkey.pem", 'wb') as fp:
|
||||||
fp.write(privkey.data)
|
fp.write(privkey.data)
|
||||||
except Exception as e:
|
|
||||||
print(f"Error processing host {host}: {e}", file=sys.stderr)
|
|
||||||
continue
|
|
||||||
|
|
||||||
try:
|
with open('/etc/nginx/hosts.conf', 'w') as fp:
|
||||||
with open("/etc/nginx/hosts.conf", "w") as fp:
|
|
||||||
fp.write(config)
|
fp.write(config)
|
||||||
except Exception as e:
|
|
||||||
print(f"Error writing config file: {e}", file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|||||||
5
nginx/nginx-prod/privkey.pem
Normal file
5
nginx/nginx-prod/privkey.pem
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIL0TAduonJLmbcDpRxDjSfa8bMIqLOh1KQcGQvAeQTIQoAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAEoS3M+thgeup/F6JS7kVNJCWee8xzLkoIUcZNgNqmoovVSP02K9az
|
||||||
|
dDRAp+c2OlzJqJQC+ZefswCB2xvjNSoL2Q==
|
||||||
|
-----END EC PRIVATE KEY-----
|
||||||
@@ -4,8 +4,6 @@ mkdir /sprint-data/redis || true
|
|||||||
mkdir /sprint-data/rabbitmq || true
|
mkdir /sprint-data/rabbitmq || true
|
||||||
mkdir /sprint-data/certs || true
|
mkdir /sprint-data/certs || true
|
||||||
mkdir /sprint-data/gitea || true
|
mkdir /sprint-data/gitea || true
|
||||||
mkdir /sprint-data/clickhouse || true
|
|
||||||
chmod 777 /sprint-data/redis
|
chmod 777 /sprint-data/redis
|
||||||
chmod 777 /sprint-data/rabbitmq
|
chmod 777 /sprint-data/rabbitmq
|
||||||
chmod 777 /sprint-data/gitea
|
chmod 777 /sprint-data/gitea
|
||||||
chmod 777 /sprint-data/clickhouse
|
|
||||||
|
|||||||
@@ -5,30 +5,12 @@ docker network create -d overlay --attachable common-infra-nginx-development ||
|
|||||||
docker network create -d overlay --attachable queues || true
|
docker network create -d overlay --attachable queues || true
|
||||||
docker network create -d overlay --attachable queues-development || true
|
docker network create -d overlay --attachable queues-development || true
|
||||||
docker network create -d overlay --attachable configurator || true
|
docker network create -d overlay --attachable configurator || true
|
||||||
docker network create -d overlay --attachable monitoring || true
|
|
||||||
docker network create -d overlay --attachable configurator-development || true
|
docker network create -d overlay --attachable configurator-development || true
|
||||||
docker network create -d overlay --attachable clickhouse || true
|
|
||||||
docker network create -d overlay --attachable postgres || true
|
|
||||||
docker network create -d overlay --attachable postgres-development || true
|
|
||||||
docker network create -d overlay --attachable mongo || true
|
|
||||||
docker network create -d overlay --attachable mongo-development || true
|
|
||||||
docker network create -d overlay --attachable minio || true
|
|
||||||
docker network create -d overlay --attachable minio-development || true
|
|
||||||
|
|
||||||
mkdir /sprint-data/mongo || true
|
mkdir /sprint-data/mongo || true
|
||||||
mkdir /sprint-data/redis || true
|
mkdir /sprint-data/redis || true
|
||||||
|
mkdir /sprint-data/rabbitmq || true
|
||||||
mkdir /sprint-data/certs || true
|
mkdir /sprint-data/certs || true
|
||||||
mkdir /sprint-data/gitea || true
|
mkdir /sprint-data/gitea || true
|
||||||
mkdir /sprint-data/clickhouse || true
|
|
||||||
mkdir /sprint-data/grafana || true
|
|
||||||
mkdir /sprint-data/authelia || true
|
|
||||||
mkdir /sprint-data/authelia/config || true
|
|
||||||
mkdir /sprint-data/authelia/data || true
|
|
||||||
chmod 777 /sprint-data/authelia
|
|
||||||
chmod 777 /sprint-data/authelia/config
|
|
||||||
chmod 777 /sprint-data/authelia/data
|
|
||||||
chmod 777 /sprint-data/redis
|
chmod 777 /sprint-data/redis
|
||||||
chmod 777 /sprint-data/rabbitmq
|
chmod 777 /sprint-data/rabbitmq
|
||||||
chmod 777 /sprint-data/gitea
|
chmod 777 /sprint-data/gitea
|
||||||
chmod 777 /sprint-data/clickhouse
|
|
||||||
chmod 777 /sprint-data/grafana
|
|
||||||
|
|||||||
Reference in New Issue
Block a user