Compare commits

...

5 Commits
lab6 ... master

Author SHA1 Message Date
b52025e597 demo commit
All checks were successful
build-and-deploy-prod / build-cc (push) Successful in 5s
build-and-deploy-prod / build-hm (push) Successful in 6s
build-and-deploy-prod / build-map (push) Successful in 6s
build-and-deploy-prod / deploy-all (push) Successful in 1s
2025-05-28 21:20:47 +03:00
ca6c79428c commit
All checks were successful
build-and-deploy-prod / build-cc (push) Successful in 5s
build-and-deploy-prod / build-hm (push) Successful in 6s
build-and-deploy-prod / build-map (push) Successful in 6s
build-and-deploy-prod / deploy-all (push) Successful in 1s
2025-05-28 20:55:12 +03:00
01ef30678d improve handling of several environments
All checks were successful
build-and-deploy-prod / build-cc (push) Successful in 6s
build-and-deploy-prod / build-hm (push) Successful in 7s
build-and-deploy-prod / build-map (push) Successful in 7s
build-and-deploy-prod / deploy-all (push) Successful in 0s
2025-05-28 20:17:33 +03:00
03f0b75d63 improve handling of several environments 2025-05-28 20:16:12 +03:00
0374b173c8 add files 2025-05-28 19:45:22 +03:00
7 changed files with 152 additions and 18 deletions

100
.gitea/workflows/prod.yaml Normal file
View File

@ -0,0 +1,100 @@
name: build-and-deploy-prod
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build-cc:
runs-on: docker
services:
docker:
image: docker:dind
options: --privileged --shm-size=2g
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
steps:
- name: Clone repo
shell: sh
run: |
git init
git remote add gitea http://10.1.1.1:3000/hasslesstech/devops-lab4
git fetch gitea
git checkout gitea/master
- name: Build container
shell: sh
run: |
docker build . -f Dockerfile-cc -t 10.5.1.10:5000/prod/cc
- name: Push container
shell: sh
run: |
docker push 10.5.1.10:5000/prod/cc
build-hm:
runs-on: docker
services:
docker:
image: docker:dind
options: --privileged --shm-size=2g
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
steps:
- name: Clone repo
shell: sh
run: |
git init
git remote add gitea http://10.1.1.1:3000/hasslesstech/devops-lab4
git fetch gitea
git checkout gitea/master
- name: Build container
shell: sh
run: |
docker build . -f Dockerfile-hm -t 10.5.1.10:5000/prod/hm
- name: Push container
shell: sh
run: |
docker push 10.5.1.10:5000/prod/hm
build-map:
runs-on: docker
services:
docker:
image: docker:dind
options: --privileged --shm-size=2g
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
steps:
- name: Clone repo
shell: sh
run: |
git init
git remote add gitea http://10.1.1.1:3000/hasslesstech/devops-lab4
git fetch gitea
git checkout gitea/master
- name: Build container
shell: sh
run: |
docker build . -f Dockerfile-map -t 10.5.1.10:5000/prod/map
- name: Push container
shell: sh
run: |
docker push 10.5.1.10:5000/prod/map
deploy-all:
runs-on: hardware-x86_64
needs:
- build-cc
- build-hm
- build-map
steps:
- run: |
ssh -i ~/prod-key root@10.5.1.11 "sh -c 'rm -rf devops-lab4 ; git clone http://10.1.1.1:3000/hasslesstech/devops-lab4 && cd devops-lab4 &&
docker-compose -f docker-compose-prod.yaml up -d'"

View File

@ -67,3 +67,6 @@ CMD sh -c "openrc default ; \
rc-service hive-hm start ; \
rc-service hive-map start ; \
exec sh"

View File

@ -6,10 +6,7 @@ services:
- sys
cc:
build:
context: .
dockerfile: Dockerfile-cc
#image: registry.digitalocean.com/duke-listings/cc
image: 10.5.1.10:5000/dev/cc
restart: always
environment:
Redis__ConnectionString: "redis:6379"
@ -21,10 +18,7 @@ services:
- redis
hm:
build:
context: .
dockerfile: Dockerfile-hm
#image: registry.digitalocean.com/duke-listings/hm
image: 10.5.1.10:5000/dev/hm
restart: always
environment:
CommunicationConfiguration__CommunicationControlIP: "cc"
@ -34,17 +28,12 @@ services:
- cc
map:
build:
context: .
dockerfile: Dockerfile-map
#image: registry.digitalocean.com/duke-listings/map
image: 10.5.1.10:5000/dev/map
restart: always
volumes:
- ./map/config.json:/usr/share/nginx/html/config.json:ro
- ./map/config-dev.json:/usr/share/nginx/html/config.json:ro
ports:
- 80:80
networks:
- sys
networks:
sys:

39
docker-compose-prod.yaml Normal file
View File

@ -0,0 +1,39 @@
services:
redis:
image: redis:7
restart: always
networks:
- sys
cc:
image: 10.5.1.10:5000/prod/cc
restart: always
environment:
Redis__ConnectionString: "redis:6379"
ports:
- 8080:8080
networks:
- sys
depends_on:
- redis
hm:
image: 10.5.1.10:5000/prod/hm
restart: always
environment:
CommunicationConfiguration__CommunicationControlIP: "cc"
networks:
- sys
depends_on:
- cc
map:
image: 10.5.1.10:5000/prod/map
restart: always
volumes:
- ./map/config-prod.json:/usr/share/nginx/html/config.json:ro
ports:
- 80:80
networks:
sys:

3
map/config-dev.json Normal file
View File

@ -0,0 +1,3 @@
{
"API": "http://10.5.1.12:8080/api/v1/client"
}

3
map/config-prod.json Normal file
View File

@ -0,0 +1,3 @@
{
"API": "http://10.5.1.11:8080/api/v1/client"
}

View File

@ -1,3 +0,0 @@
{
"API": "http://10.1.1.2:8080/api/v1/client"
}