From 4f0dde1da87315bb01391d8f9d639acdf8b237f5 Mon Sep 17 00:00:00 2001 From: Gleb Koval Date: Tue, 26 Sep 2023 03:13:11 +0100 Subject: [PATCH] nextcloud aio --- ...yaml => 0003_nextcloud_playbook copy.yaml} | 16 ++++-------- infra/cloud/0004_immich_playbook.yaml | 26 +++++++++++++++++++ .../{cloud => immich}/docker-compose.yaml | 4 +-- infra/cloud/nextcloud/all-in-one.sh | 16 ++++++++++++ 4 files changed, 49 insertions(+), 13 deletions(-) rename infra/cloud/{0003_app_playbook.yaml => 0003_nextcloud_playbook copy.yaml} (56%) create mode 100644 infra/cloud/0004_immich_playbook.yaml rename infra/cloud/{cloud => immich}/docker-compose.yaml (52%) create mode 100644 infra/cloud/nextcloud/all-in-one.sh diff --git a/infra/cloud/0003_app_playbook.yaml b/infra/cloud/0003_nextcloud_playbook copy.yaml similarity index 56% rename from infra/cloud/0003_app_playbook.yaml rename to infra/cloud/0003_nextcloud_playbook copy.yaml index 0736263..114f215 100644 --- a/infra/cloud/0003_app_playbook.yaml +++ b/infra/cloud/0003_nextcloud_playbook copy.yaml @@ -2,7 +2,7 @@ hosts: cloud gather_facts: false vars: - project: cloud + app: nextcloud tasks: - name: Wait for connection ansible.builtin.wait_for_connection: @@ -13,16 +13,10 @@ register: user - name: Copy project ansible.builtin.copy: - src: ./{{ project }} + src: ./{{ app }} dest: "{{ user.home }}" mode: "0744" - notify: re-deploy - handlers: - - name: Restart Docker compose - ansible.builtin.shell: | - docker compose down - docker compose up -d - exit 0 + - name: Re-deploy + ansible.builtin.command: bash all-in-one.sh args: - chdir: "{{ user.home }}/{{ project }}" - listen: re-deploy + chdir: "{{ user.home }}/{{ app }}" diff --git a/infra/cloud/0004_immich_playbook.yaml b/infra/cloud/0004_immich_playbook.yaml new file mode 100644 index 0000000..984fb2d --- /dev/null +++ b/infra/cloud/0004_immich_playbook.yaml @@ -0,0 +1,26 @@ +- name: Deploy app + hosts: cloud + gather_facts: false + vars: + app: immich + tasks: + - name: Wait for connection + ansible.builtin.wait_for_connection: + timeout: 300 + - name: Get user + ansible.builtin.user: + name: debian + register: user + - name: Docker compose down + ansible.builtin.command: docker compose down + args: + chdir: "{{ user.home }}/{{ app }}" + - name: Copy project + ansible.builtin.copy: + src: ./{{ app }} + dest: "{{ user.home }}" + mode: "0744" + - name: Docker compose up -d + ansible.builtin.command: docker compose up -d + args: + chdir: "{{ user.home }}/{{ app }}" diff --git a/infra/cloud/cloud/docker-compose.yaml b/infra/cloud/immich/docker-compose.yaml similarity index 52% rename from infra/cloud/cloud/docker-compose.yaml rename to infra/cloud/immich/docker-compose.yaml index 2645159..90b74f4 100644 --- a/infra/cloud/cloud/docker-compose.yaml +++ b/infra/cloud/immich/docker-compose.yaml @@ -1,6 +1,6 @@ version: "3" services: - test: + dummy: image: nginx - restart: unless-stopped \ No newline at end of file + restart: unless-stopped diff --git a/infra/cloud/nextcloud/all-in-one.sh b/infra/cloud/nextcloud/all-in-one.sh new file mode 100644 index 0000000..713aa9f --- /dev/null +++ b/infra/cloud/nextcloud/all-in-one.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +docker stop nextcloud-aio-mastercontainer || true +docker rm nextcloud-aio-mastercontainer || true + +docker run \ +--init \ +--sig-proxy=false \ +--name nextcloud-aio-mastercontainer \ +--restart unless-stopped \ +--publish 8080:8080 \ +--env APACHE_PORT=11000 \ +--env APACHE_IP_BINDING=0.0.0.0 \ +--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \ +--volume /var/run/docker.sock:/var/run/docker.sock:ro \ +-d nextcloud/all-in-one:latestdocker run