diff --git a/group_vars/all b/group_vars/all index 04547305..e440d97a 100644 --- a/group_vars/all +++ b/group_vars/all @@ -131,6 +131,7 @@ domain_friendica: "friendica.{{top_domain}}" domain_funkwhale: "music.{{top_domain}}" domain_gitea: "git.{{top_domain}}" domain_gitlab: "gitlab.{{top_domain}}" +domain_landingpage: "{{top_domain}}" domain_listmonk: "newsletter.{{top_domain}}" domain_mailu: "mail.{{top_domain}}" domain_mastodon: "microblog.{{top_domain}}" diff --git a/playbook.servers.yml b/playbook.servers.yml index fbbcac2f..2dae9e3d 100644 --- a/playbook.servers.yml +++ b/playbook.servers.yml @@ -277,6 +277,15 @@ domain: "{{domain_friendica}}" http_port: 8028 +- name: setup landingpage + hosts: landingpage + become: true + roles: + - role: docker-landingpage + vars: + domain: "{{domain_landingpage}}" + http_port: 8029 + # Native Webserver Roles - name: setup nginx-homepages hosts: homepage diff --git a/roles/docker-landingpage/README.md b/roles/docker-landingpage/README.md new file mode 100644 index 00000000..646cac15 --- /dev/null +++ b/roles/docker-landingpage/README.md @@ -0,0 +1,2 @@ +# role docker-landingpage +create a landingpage with flask. Uses https://github.com/kevinveenbirkenbach/landingpage \ No newline at end of file diff --git a/roles/docker-landingpage/tasks/main.yml b/roles/docker-landingpage/tasks/main.yml new file mode 100644 index 00000000..9d532bb7 --- /dev/null +++ b/roles/docker-landingpage/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- name: "include docker/compose/common.yml" + include_tasks: docker/compose/common.yml + +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml + +- name: "include tasks update-repository-with-docker-compose.yml" + include_tasks: update-repository-with-docker-compose.yml + +- name: add docker-compose.yml + template: src=docker-compose.yml.j2 dest={{docker_compose_instance_directory}}docker-compose.yml + notify: docker compose project setup diff --git a/roles/docker-landingpage/templates/docker-compose.yml.j2 b/roles/docker-landingpage/templates/docker-compose.yml.j2 new file mode 100644 index 00000000..3efd26c6 --- /dev/null +++ b/roles/docker-landingpage/templates/docker-compose.yml.j2 @@ -0,0 +1,15 @@ +services: + landingpage: + build: + context: . + dockerfile: Dockerfile + image: application-landingpage + container_name: landingpage + ports: + - 127.0.0.1:{{http_port}}:5000 + volumes: + - ./app:/app + restart: unless-stopped +{% include 'templates/docker/container/networks.yml.j2' %} + +{% include 'templates/docker/compose/networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-landingpage/vars/main.yml b/roles/docker-landingpage/vars/main.yml new file mode 100644 index 00000000..b2ea89de --- /dev/null +++ b/roles/docker-landingpage/vars/main.yml @@ -0,0 +1,2 @@ +docker_compose_project_name: "landingpage" +repository_address: "https://github.com/kevinveenbirkenbach/landingpage" diff --git a/tasks/update-repository-with-files.yml b/tasks/update-repository-with-files.yml index 4c985139..ecb56563 100644 --- a/tasks/update-repository-with-files.yml +++ b/tasks/update-repository-with-files.yml @@ -1,4 +1,4 @@ -- name: "backup docker-compose.yml if it exists" +- name: "backup detached files" command: > mv "{{docker_compose_instance_directory}}{{ item }}" "/tmp/{{docker_compose_project_name}}-{{ item }}.backup" args: @@ -21,7 +21,7 @@ notify: docker compose project setup become: true -- name: "restore docker-compose.yml from backup" +- name: "restore detached files" command: > mv "/tmp/{{docker_compose_project_name}}-{{ item }}.backup" "{{docker_compose_instance_directory}}{{ item }}" args: diff --git a/templates/docker/compose/networks.yml.j2 b/templates/docker/compose/networks.yml.j2 index 3f6c7742..d82195d7 100644 --- a/templates/docker/compose/networks.yml.j2 +++ b/templates/docker/compose/networks.yml.j2 @@ -1,6 +1,6 @@ # This template needs to be included in docker-compose.yml networks: -{% if enable_central_database | bool %} +{% if enable_central_database | bool and database_type is defined %} central_{{ database_type }}: external: true {% endif %} diff --git a/templates/docker/container/networks.yml.j2 b/templates/docker/container/networks.yml.j2 index dd8ff2a2..5c5ff1db 100644 --- a/templates/docker/container/networks.yml.j2 +++ b/templates/docker/container/networks.yml.j2 @@ -1,6 +1,6 @@ # This template needs to be included in docker-compose.yml containers networks: -{% if enable_central_database | bool %} +{% if enable_central_database | bool and database_type is defined %} central_{{ database_type }}: {% endif %} default: