From f36366a3198222a2544d33e17f432a89afd7a702 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Tue, 3 Jan 2023 19:05:39 +0100 Subject: [PATCH] add condition for update or drop-create database --- inventory/group_vars/db | 3 ++- inventory/group_vars/drone | 2 +- inventory/group_vars/registry | 2 +- scaleway-k8s/tasks/create-cluster.yml | 1 - server/tasks/deploy.yml | 2 +- .../docker-compose-db.yml.j2} | 3 ++- .../docker-compose-drone.yml.j2} | 0 .../docker-compose-registry.yml.j2} | 0 8 files changed, 7 insertions(+), 6 deletions(-) rename server/{files/docker-compose-db.yml => templates/docker-compose-db.yml.j2} (90%) rename server/{files/docker-compose-drone.yml => templates/docker-compose-drone.yml.j2} (100%) rename server/{files/docker-compose-registry.yml => templates/docker-compose-registry.yml.j2} (100%) diff --git a/inventory/group_vars/db b/inventory/group_vars/db index ff36bca..f160199 100644 --- a/inventory/group_vars/db +++ b/inventory/group_vars/db @@ -11,7 +11,7 @@ project_directory: - "{{ project_src }}" - "{{ project_src }}/{{ project_name }}" -docker_compose_file: "docker-compose-db.yml" +docker_compose_file: "docker-compose-db.yml.j2" project_env: "env-db.j2" @@ -21,3 +21,4 @@ ports_tcp: - "{{ postgres_port }}" - "{{ redis_port }}" +covas_liquibase: false \ No newline at end of file diff --git a/inventory/group_vars/drone b/inventory/group_vars/drone index d63f0c5..91b37d6 100644 --- a/inventory/group_vars/drone +++ b/inventory/group_vars/drone @@ -15,7 +15,7 @@ project_directory: - "{{ project_src }}" project_env: env-drone.j2 -docker_compose_file: "docker-compose-drone.yml" +docker_compose_file: "docker-compose-drone.yml.j2" ports_tcp: - 8000 diff --git a/inventory/group_vars/registry b/inventory/group_vars/registry index 1aff19b..1e10de2 100644 --- a/inventory/group_vars/registry +++ b/inventory/group_vars/registry @@ -5,7 +5,7 @@ project_directory: - "{{ project_src }}" -docker_compose_file: "docker-compose-registry.yml" +docker_compose_file: "docker-compose-registry.yml.j2" ports_tcp: diff --git a/scaleway-k8s/tasks/create-cluster.yml b/scaleway-k8s/tasks/create-cluster.yml index 4be7131..4743fa7 100644 --- a/scaleway-k8s/tasks/create-cluster.yml +++ b/scaleway-k8s/tasks/create-cluster.yml @@ -11,7 +11,6 @@ src: main.tf.j2 dest: "{{ project_terraform }}/main.tf" - - name: Create cluster scaleway community.general.terraform: project_path: '{{ project_terraform }}' diff --git a/server/tasks/deploy.yml b/server/tasks/deploy.yml index 061390a..41de073 100644 --- a/server/tasks/deploy.yml +++ b/server/tasks/deploy.yml @@ -30,6 +30,6 @@ when: "project_env is defined" - name: Copy docker compose server file - copy: + template: src: "{{ docker_compose_file }}" dest: "{{ project_src }}/docker-compose.yml" diff --git a/server/files/docker-compose-db.yml b/server/templates/docker-compose-db.yml.j2 similarity index 90% rename from server/files/docker-compose-db.yml rename to server/templates/docker-compose-db.yml.j2 index a45804c..09d27ac 100644 --- a/server/files/docker-compose-db.yml +++ b/server/templates/docker-compose-db.yml.j2 @@ -16,7 +16,7 @@ services: image: redis/redis-stack-server:latest ports: - "63791:6379" - + {% if covas_liquibase == true %} liquibase: build: context: ./covas-liquibase @@ -25,6 +25,7 @@ services: - db command: - "update" + {% endif %} volumes: app-db-data: diff --git a/server/files/docker-compose-drone.yml b/server/templates/docker-compose-drone.yml.j2 similarity index 100% rename from server/files/docker-compose-drone.yml rename to server/templates/docker-compose-drone.yml.j2 diff --git a/server/files/docker-compose-registry.yml b/server/templates/docker-compose-registry.yml.j2 similarity index 100% rename from server/files/docker-compose-registry.yml rename to server/templates/docker-compose-registry.yml.j2