master
omidshj 2024-05-17 19:42:53 +03:30
parent 78568c9d7d
commit 08068e156f
3 changed files with 76 additions and 1 deletions

22
build ocean.yml Normal file
View File

@ -0,0 +1,22 @@
---
- name: build ocean
hosts: all
tasks:
# - name: Change to the app directory and update the repository
# git:
# repo: 'https://gt.eron.co/eron/inception.git' # Replace with your repository URL
# dest: /root/code/inception
# version: master
# register: git_result
- name: Go to the ocean directory
command: chdir=/root/code/ocean git pull origin master
register: git_result
- name: Build docker image if there were changes
docker_image:
source: build
build:
path: /root/code/ocean
name: ocean
tag: "{{semaphore_vars.task_details.target_version}}"
when: git_result.changed

View File

@ -1,5 +1,5 @@
---
- name: udeploy generate-image
- name: deploy generate-image
hosts: all
tasks:
- name: Stop generate-image container if it exists

53
deploy ocean.yml Normal file
View File

@ -0,0 +1,53 @@
---
- name: deploy ocean
hosts: all
tasks:
- name: Stop ocean container if it exists
docker_container:
name: ocean
state: absent
- name: Deploy ocean Docker container
docker_container:
name: ocean
image: ocean:{{semaphore_vars.task_details.incoming_version}}
state: started
restart_policy: always
networks:
- name: traefik
env:
SERVER_BASE_URL: "inception:3000"
labels:
traefik.enable: "true"
traefik.http.routers.ocean.entrypoints: "web,websecure"
traefik.http.routers.ocean.rule: "HostRegexp(`{subdomain:[a-zA-Z0-9-]+}.panel.eron.co`)"
traefik.http.services.ocean.loadbalancer.server.port: "3000"
traefik.http.routers.ocean.tls: "true"
traefik.http.routers.ocean.tls.certresolver: "letsencrypt"
traefik.http.routers.ocean.service: "ocean"
traefik.http.routers.ocean.tls.domains[0].main: "panel.eron.co"
traefik.http.routers.ocean.tls.domains[0].sans: "*.panel.eron.co"
- name: Stop ocean2 container if it exists
docker_container:
name: ocean2
state: absent
- name: Deploy ocean2 Docker container
docker_container:
name: ocean2
image: ocean:{{semaphore_vars.task_details.incoming_version}}
state: started
restart_policy: always
networks:
- name: traefik
env:
SERVER_BASE_URL: "inception:3000"
labels:
traefik.enable: "true"
traefik.http.routers.ocean2.entrypoints: "web,websecure"
traefik.http.routers.ocean2.rule: "HostRegexp(`{subdomain:[a-zA-Z0-9-]+}.demo.eron.co`)"
traefik.http.services.ocean2.loadbalancer.server.port: "3000"
traefik.http.routers.ocean2.tls: "true"
traefik.http.routers.ocean2.tls.certresolver: "letsencrypt"
traefik.http.routers.ocean2.service: "ocean2"
traefik.http.routers.ocean2.tls.domains[0].main: "demo.eron.co"
traefik.http.routers.ocean2.tls.domains[0].sans: "*.demo.eron.co"