From e10deb9e549a3bf7ad8021f8754c0459142a92e4 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 19 Feb 2025 16:26:32 +0100 Subject: [PATCH] Optimized and refactored portfolio for flock.town --- group_vars/all/14_about.yml | 14 + playbook.servers.yml | 2 +- roles/docker-akaunting/vars/main.yml | 8 +- roles/docker-attendize/vars/main.yml | 8 +- roles/docker-discourse/handlers/main.yml | 2 +- roles/docker-discourse/tasks/main.yml | 8 +- roles/docker-discourse/vars/main.yml | 4 +- roles/docker-openproject/README.md | 26 +- roles/docker-openproject/handlers/main.yml | 8 - roles/docker-openproject/tasks/main.yml | 18 +- roles/docker-openproject/vars/main.yml | 16 +- roles/docker-portfolio/tasks/main.yml | 27 +- .../docker-portfolio/templates/config.yaml.j2 | 431 ++++++++++++++++++ .../templates/docker-compose.yml.j2 | 4 +- roles/docker-portfolio/vars/main.yml | 5 +- roles/docker-repository-setup/README.md | 50 ++ .../docker-repository-setup/handlers/main.yml | 7 + roles/docker-repository-setup/meta/main.yml | 2 + roles/docker-repository-setup/tasks/main.yml | 14 + roles/docker-taiga/tasks/main.yml | 10 +- .../templates/docker-compose.yml.j2 | 2 +- roles/docker-taiga/vars/main.yml | 12 +- .../templates/update-docker.py.j2 | 6 +- tasks/update-repository-with-files.yml | 6 +- 24 files changed, 587 insertions(+), 103 deletions(-) create mode 100644 group_vars/all/14_about.yml create mode 100644 roles/docker-portfolio/templates/config.yaml.j2 create mode 100644 roles/docker-repository-setup/README.md create mode 100644 roles/docker-repository-setup/handlers/main.yml create mode 100644 roles/docker-repository-setup/meta/main.yml create mode 100644 roles/docker-repository-setup/tasks/main.yml diff --git a/group_vars/all/14_about.yml b/group_vars/all/14_about.yml new file mode 100644 index 00000000..a7973262 --- /dev/null +++ b/group_vars/all/14_about.yml @@ -0,0 +1,14 @@ +# This is just a dummy person. +# Adapt the values in your inventory file +person: + type: "legal" # Accepted Values: natural, legal + name: "CyMaIS Demo Instance" + address: + street: "Binary Avenue 01" + city: "Cybertown" + postal_code: "00001" + country: "Nexusland" + contact: + email: "contact@{{primary_domain}}" + phone: "+0 000 000 404" + mastodon: "@{{administrator_username}}@{{domains.mastodon}}" \ No newline at end of file diff --git a/playbook.servers.yml b/playbook.servers.yml index 646cb933..0b045d93 100644 --- a/playbook.servers.yml +++ b/playbook.servers.yml @@ -42,7 +42,7 @@ - role: docker-keycloak - name: setup nextcloud hosts - hosts: nextcloud_server + hosts: nextcloud become: true roles: - role: docker-nextcloud diff --git a/roles/docker-akaunting/vars/main.yml b/roles/docker-akaunting/vars/main.yml index de2efe17..72c13464 100644 --- a/roles/docker-akaunting/vars/main.yml +++ b/roles/docker-akaunting/vars/main.yml @@ -1,4 +1,4 @@ -application_id: "akaunting" -database_type: "mariadb" -database_password: "{{akaunting_database_password}}" -repository_address: "https://github.com/akaunting/docker.git" +application_id: "akaunting" +database_type: "mariadb" +database_password: "{{akaunting_database_password}}" +docker_repository_address: "https://github.com/akaunting/docker.git" diff --git a/roles/docker-attendize/vars/main.yml b/roles/docker-attendize/vars/main.yml index 99ede1f3..64e50705 100644 --- a/roles/docker-attendize/vars/main.yml +++ b/roles/docker-attendize/vars/main.yml @@ -1,5 +1,5 @@ --- -application_id: "attendize" -database_type: "mariadb" -database_password: "{{attendize_database_password}}" -repository_address: "https://github.com/Attendize/Attendize.git" \ No newline at end of file +application_id: "attendize" +database_type: "mariadb" +database_password: "{{attendize_database_password}}" +docker_repository_address: "https://github.com/Attendize/Attendize.git" \ No newline at end of file diff --git a/roles/docker-discourse/handlers/main.yml b/roles/docker-discourse/handlers/main.yml index 87cefd4c..dcc7d837 100644 --- a/roles/docker-discourse/handlers/main.yml +++ b/roles/docker-discourse/handlers/main.yml @@ -17,5 +17,5 @@ - name: rebuild discourse command: cmd: "./launcher rebuild {{applications.discourse.container}}" - chdir: "{{discourse_repository_directory}}" + chdir: "{{docker_repository_directory }}" listen: recreate discourse \ No newline at end of file diff --git a/roles/docker-discourse/tasks/main.yml b/roles/docker-discourse/tasks/main.yml index 6941353f..f612b2bf 100644 --- a/roles/docker-discourse/tasks/main.yml +++ b/roles/docker-discourse/tasks/main.yml @@ -32,15 +32,15 @@ - name: pull docker repository git: repo: "https://github.com/discourse/discourse_docker.git" - dest: "{{discourse_repository_directory}}" + dest: "{{docker_repository_directory }}" update: yes notify: recreate discourse become: true ignore_errors: true -- name: set chmod 700 for {{discourse_repository_directory}}containers +- name: set chmod 700 for {{docker_repository_directory }}containers ansible.builtin.file: - path: "{{discourse_repository_directory}}/containers" + path: "{{docker_repository_directory }}/containers" mode: '700' state: directory @@ -53,7 +53,7 @@ - name: "destroy container discourse_application" command: cmd: "./launcher destroy discourse_application" - chdir: "{{discourse_repository_directory}}" + chdir: "{{docker_repository_directory }}" ignore_errors: true notify: recreate discourse when: mode_reset | bool diff --git a/roles/docker-discourse/vars/main.yml b/roles/docker-discourse/vars/main.yml index f28b0b1f..e9e9b483 100644 --- a/roles/docker-discourse/vars/main.yml +++ b/roles/docker-discourse/vars/main.yml @@ -1,5 +1,5 @@ application_id: "discourse" database_password: "{{ applications.discourse.database_password }}" database_type: "postgres" -discourse_repository_directory: "{{docker_compose.directories.services}}{{applications.discourse.repository}}/" -discourse_application_yml_destination: "{{discourse_repository_directory}}containers/{{applications.discourse.container}}.yml" \ No newline at end of file +docker_repository_directory : "{{docker_compose.directories.services}}{{applications.discourse.repository}}/" +discourse_application_yml_destination: "{{docker_repository_directory }}containers/{{applications.discourse.container}}.yml" \ No newline at end of file diff --git a/roles/docker-openproject/README.md b/roles/docker-openproject/README.md index 34c9a591..573fd7cb 100644 --- a/roles/docker-openproject/README.md +++ b/roles/docker-openproject/README.md @@ -1,22 +1,8 @@ -# README.md for Docker OpenProject Role +# OpenProject Role ## Overview -This role is designed to deploy the OpenProject application using Docker. It includes tasks for setting up the environment, pulling the Docker repository, and configuring a reverse proxy with Nginx. - -## Requirements - -- Ansible -- Docker -- Docker Compose -- Access to the GitHub repository "opf/openproject-deploy" - -## Role Variables - -The role uses several variables, defined in `vars/main.yml`: - -- `repository_directory`: The directory for the OpenProject repository. -- `docker_compose.directories.instance`: Directory for Docker Compose instances. +This role is designed to deploy the [OpenProject](https://www.openproject.org/) application using Docker. It includes tasks for setting up the environment, pulling the Docker repository, and configuring a reverse proxy with Nginx. It was developed by [Kevin Veen-Birkenbach](https://www.veen.world/) ## Handlers @@ -32,14 +18,6 @@ Outlined in `tasks/main.yml`, the role includes tasks for: - Warning if the repository is not reachable. - Copying the `.env` file from a template. -## Templates - -`env.j2` in `templates/` folder is a Jinja2 template for the `.env` file, setting up environment variables for the OpenProject container. - -## Dependencies - -This role depends on `nginx-docker-reverse-proxy`, as defined in `meta/main.yml`. - ## Usage To use this role, include it in your Ansible playbook and set the necessary variables, especially those required in the `.env` file template. diff --git a/roles/docker-openproject/handlers/main.yml b/roles/docker-openproject/handlers/main.yml index 706a3890..076068ce 100644 --- a/roles/docker-openproject/handlers/main.yml +++ b/roles/docker-openproject/handlers/main.yml @@ -3,14 +3,6 @@ command: cmd: docker build --no-cache -t {{custom_openproject_image}} . chdir: "{{openproject_plugins_service}}" - environment: - COMPOSE_HTTP_TIMEOUT: 600 - DOCKER_CLIENT_TIMEOUT: 600 - -- name: rebuild openproject repository - command: - cmd: docker compose build - chdir: "{{openproject_repository_service}}" environment: COMPOSE_HTTP_TIMEOUT: 600 DOCKER_CLIENT_TIMEOUT: 600 \ No newline at end of file diff --git a/roles/docker-openproject/tasks/main.yml b/roles/docker-openproject/tasks/main.yml index 6d9e0169..d63f1bd8 100644 --- a/roles/docker-openproject/tasks/main.yml +++ b/roles/docker-openproject/tasks/main.yml @@ -7,12 +7,6 @@ include_role: name: nginx-domain-setup -#- name: "include tasks update-repository-with-files.yml" -# include_tasks: update-repository-with-files.yml -# vars: -# detached_files: -# - "docker-compose.yml" - - name: "Create {{openproject_plugins_service}}" file: path: "{{openproject_plugins_service}}" @@ -35,15 +29,9 @@ - docker compose project setup - rebuild custom openproject docker image -- name: pull docker repository - git: - repo: "{{ repository_address }}" - dest: "{{ openproject_repository_service }}" - update: yes - notify: - - docker compose project setup - - rebuild openproject repository - become: true +- name: "include role docker-repository-setup for {{application_id}}" + include_role: + name: docker-repository-setup - name: "create {{dummy_volume}}" file: diff --git a/roles/docker-openproject/vars/main.yml b/roles/docker-openproject/vars/main.yml index ff9c377a..45840bc0 100644 --- a/roles/docker-openproject/vars/main.yml +++ b/roles/docker-openproject/vars/main.yml @@ -1,12 +1,10 @@ -application_id: "openproject" -repository_address: "https://github.com/opf/openproject-deploy" -database_password: "{{openproject_database_password}}" -database_type: "postgres" - -openproject_plugins_service: "{{docker_compose.directories.services}}plugins/" -openproject_repository_service: "{{docker_compose.directories.services}}repository/" -custom_openproject_image: "custom_openproject" +application_id: "openproject" +docker_repository_address: "https://github.com/opf/openproject-deploy" +database_password: "{{openproject_database_password}}" +database_type: "postgres" +openproject_plugins_service: "{{docker_compose.directories.services}}plugins/" +custom_openproject_image: "custom_openproject" # The following volume doesn't have a practcical function. It just exist to prevent the creation of unnecessary anonymous volumes -dummy_volume: "{{docker_compose.directories.volumes}}dummy_volume" \ No newline at end of file +dummy_volume: "{{docker_compose.directories.volumes}}dummy_volume" \ No newline at end of file diff --git a/roles/docker-portfolio/tasks/main.yml b/roles/docker-portfolio/tasks/main.yml index c849280a..99cf95ba 100644 --- a/roles/docker-portfolio/tasks/main.yml +++ b/roles/docker-portfolio/tasks/main.yml @@ -7,17 +7,28 @@ include_role: name: nginx-domain-setup -- name: "include tasks update-repository-with-files.yml" - include_tasks: update-repository-with-files.yml - vars: - detached_files: - - "docker-compose.yml" +- name: "include role docker-repository-setup for {{application_id}}" + include_role: + name: docker-repository-setup -- name: create {{docker_compose.directories.instance}}/app/config.yaml +- name: Check if host-specific config.yaml exists + stat: + path: "{{ config_inventory_path }}" + register: config_file + +- name: Copy host-specific config.yaml if it exists copy: - src: "{{ inventory_dir }}/files/{{ inventory_hostname }}/docker/portfolio/config.yaml" - dest: "{{docker_compose.directories.instance}}/app/config.yaml" + src: "{{ config_inventory_path }}" + dest: "{{docker_repository_path}}/app/config.yaml" notify: docker compose project setup + when: config_file.stat.exists + +- name: Copy default config.yaml from the role template if host-specific file does not exist + template: + src: "config.yaml.j2" + dest: "{{docker_repository_path}}/app/config.yaml" + notify: docker compose project setup + when: not config_file.stat.exists - name: add docker-compose.yml template: src=docker-compose.yml.j2 dest={{docker_compose.directories.instance}}docker-compose.yml diff --git a/roles/docker-portfolio/templates/config.yaml.j2 b/roles/docker-portfolio/templates/config.yaml.j2 new file mode 100644 index 00000000..1d2c7055 --- /dev/null +++ b/roles/docker-portfolio/templates/config.yaml.j2 @@ -0,0 +1,431 @@ +--- +accounts: + name: Online Presence + description: Discover {{ 'our' if person.type == 'legal' else 'my' }} online presence. + icon: + class: fa-solid fa-users + children: + - name: Publishing Channels + description: Platforms where I share content. + icon: + class: fas fa-newspaper + children: + - name: Microblogs + description: Stay updated with {{ 'our' if person.type == 'legal' else 'my' }} microblog posts. + icon: + class: fa-solid fa-pen-nib + children: + - name: Mastodon + description: Follow {{ 'our' if person.type == 'legal' else 'my' }} updates on Mastodon. + icon: + class: fa-brands fa-mastodon + url: https://{{ person.contact.mastodon.split('@')[2] }}/@{{ person.contact.mastodon.split('@')[1] }} + identifier: "{{person.contact.mastodon}}" + - name: Bluesky + description: Follow me on Bluesky (coming soon). + icon: + class: fa-brands fa-bluesky + info: Bluesky is coming soon. + alternatives: + - link: accounts.publishingchannels.microblogs.mastodon + + - name: Pictures + description: View {{ 'our' if person.type == 'legal' else 'my' }} photography. + icon: + class: fa-solid fa-images + children: + - name: Pixelfed + description: Explore {{ 'our' if person.type == 'legal' else 'my' }} photo gallery on Pixelfed. + icon: + class: fa-solid fa-camera + url: https://s.veen.world/pictures + - name: Instagram + description: Follow me on Instagram. + icon: + class: fa-brands fa-instagram + url: https://www.instagram.com/kevinveenbirkenbach/ + identifier: kevinveenbirkenbach + warning: Platforms by Meta (e.g., Instagram, Facebook) may compromise your data privacy. Consider using decentralized alternatives. + alternatives: + - link: accounts.publishingchannels.pictures.pixelfed + + - name: Videos + description: Watch {{ 'our' if person.type == 'legal' else 'my' }} video content. + icon: + class: fa-solid fa-video + children: + - name: Peertube + description: Discover {{ 'our' if person.type == 'legal' else 'my' }} videos on Peertube. + icon: + class: fa-solid fa-video + url: https://s.veen.world/videos + - name: YouTube + description: Follow me on YouTube (inactive). + icon: + class: fa-brands fa-youtube + url: https://s.veen.world/youtube + warning: I no longer publish videos on YouTube. Please visit {{ 'our' if person.type == 'legal' else 'my' }} Peertube channel instead. + alternatives: + - link: accounts.publishingchannels.videos.peertube + + - name: Blog + description: Read {{ 'our' if person.type == 'legal' else 'my' }} articles and stories. + icon: + class: fa-solid fa-blog + url: https://blog.veen.world + + - name: Code + description: Access {{ 'our' if person.type == 'legal' else 'my' }} coding projects. + icon: + class: fa-solid fa-laptop-code + children: + - name: GitHub + description: View {{ 'our' if person.type == 'legal' else 'my' }} GitHub repositories. + icon: + class: bi bi-github + url: https://github.com/kevinveenbirkenbach + - name: Gitea + description: Explore {{ 'our' if person.type == 'legal' else 'my' }} self-hosted repositories. + icon: + class: fa-solid fa-code + url: https://git.veen.world/kevinveenbirkenbach + + - name: Social Networks + description: Social and developer platforms. + icon: + class: fa fa-users + children: + - name: Facebook + warning: I recommend to don't use Facebook and connect instead with me via the Fediverse. Check out the listed alternatives. + description: Visit {{ 'our' if person.type == 'legal' else 'my' }} Facebook page. + icon: + class: fa-brands fa-facebook + url: https://www.facebook.com/kevinveenbirkenbach + alternatives: + - link: accounts.socialnetworks.friendica + - name: Friendica + description: Visit {{ 'our' if person.type == 'legal' else 'my' }} friendica profile + icon: + class: fas fa-network-wired + url: https://s.veen.world/friendica + identifier: "kevinveenbirkenbach@friendica.veen.world" + - link: navigation.header.contact.messenger + + - name: Career Profiles + description: Professional networking profiles. + icon: + class: fa-solid fa-user-tie + children: + - name: XING + description: View {{ 'our' if person.type == 'legal' else 'my' }} XING profile. + icon: + class: bi bi-building + url: https://s.veen.world/xing + - name: LinkedIn + description: Connect with me on LinkedIn. + icon: + class: bi bi-linkedin + url: https://s.veen.world/linkedin + - name: upwork.com + description: Check out {{ 'our' if person.type == 'legal' else 'my' }} profile on upwork + icon: + class: fas fa-users + url: https://s.veen.world/upwork + - name: freelancermap.de + description: Check out {{ 'our' if person.type == 'legal' else 'my' }} profile on freelancermap.de + icon: + class: fas fa-people-arrows + url: https://s.veen.world/freelancermap + - name: malt + description: Check out {{ 'our' if person.type == 'legal' else 'my' }} profile on malt + icon: + class: fas fa-sun + url: https://s.veen.world/malt + - name: Sports + description: My sports activities and logs. + icon: + class: fa-solid fa-running + children: + - name: Garmin + description: Explore {{ 'our' if person.type == 'legal' else 'my' }} Garmin activity records. + icon: + class: fa-solid fa-person-running + url: https://s.veen.world/garmin + - name: Eversports + description: View {{ 'our' if person.type == 'legal' else 'my' }} Eversports sessions. + icon: + class: fa-solid fa-dumbbell + url: https://s.veen.world/eversports + + - name: Duolingo + description: Join me in language learning. + icon: + class: fa-solid fa-language + url: https://www.duolingo.com/profile/kevinbirkenbach + + - name: Spotify + description: Listen to {{ 'our' if person.type == 'legal' else 'my' }} playlists. + icon: + class: fa-brands fa-spotify + url: https://open.spotify.com/user/31vebfzbjf3p7oualis76qfpr5ty + + - name: Patreon + description: Support {{ 'our' if person.type == 'legal' else 'my' }} work on Patreon. + icon: + class: fa-brands fa-patreon + url: https://patreon.com/kevinveenbirkenbach + + - name: Discourse + description: Join discussions on {{ 'our' if person.type == 'legal' else 'my' }} forum. + icon: + class: fa-brands fa-discourse + url: https://forum.veen.world/u/kevinveenbirkenbach + + - name: Nextcloud + description: Share data with me via nextcloud + icon: + class: fa fa-cloud + url: https://s.veen.world/cloud + +cards: +- icon: + source: https://cloud.veen.world/s/logo_agile_coach_512x512/download + title: Agile Coach + text: I lead agile transformations and improve team dynamics through Scrum, DevOps, + and Agile Coaching. My goal is to enhance collaboration and efficiency in organizations, + ensuring agile principles are effectively implemented for sustainable success. + url: https://www.agile-coach.world + link_text: www.agile-coach.world +- icon: + source: https://cloud.veen.world/s/logo_personal_coach_512x512/download + title: Personal Coach + text: Offering personalized coaching for growth and development, I utilize a blend + of hypnotherapy, mediation, and holistic techniques. My approach is tailored to + help you achieve personal and professional milestones, fostering holistic well-being. + url: https://www.personalcoach.berlin + link_text: www.personalcoach.berlin +- icon: + source: https://cloud.veen.world/s/logo_yachtmaster_512x512/download + title: Yachtmaster + text: As a Yachtmaster, I provide comprehensive sailing education, yacht delivery, + and voyage planning services. Whether you're learning to sail or need an experienced + skipper, my expertise ensures a safe and enjoyable experience on the water. + url: https://www.yachtmaster.world + link_text: www.yachtmaster.world +company: + titel: Kevin Veen-Birkenbach + subtitel: Consulting and Coaching Solutions + logo: + source: https://cloud.veen.world/s/logo_face_512x512/download + favicon: + source: https://cloud.veen.world/s/veen_world_favicon/download + address: + street: Afrikanische Straße 43 + postal_code: DE-13351 + city: Berlin + country: Germany + imprint_url: https://s.veen.world/imprint +navigation: + header: + children: + - link: accounts.publishingchannels.children + - link: accounts.socialnetworks + - name: Contact + description: Get in touch + icon: + class: fa-solid fa-envelope + children: + - name: Email + description: Send me an email + icon: + class: fa-solid fa-envelope + children: + - name: Email + description: Send me an email + icon: + class: fa-solid fa-envelope + url: mailto:kevin@veen.world + identifier: kevin@veen.world + alternatives: + - link: navigation.header.contact.messenger.matrix + - name: Mobile + description: Call me + icon: + class: fa-solid fa-phone + url: "tel:+491781798023" + identifier: "+491781798023" + target: _top + - name: Messenger + description: Social and developer networks + icon: + class: fa-solid fa-comments + children: + - name: Matrix + description: Chat with me on Matrix + icon: + class: fa-solid fa-cubes + identifier: "@kevinveenbirkenbach:veen.world" + info: | + #### Why Use Matrix? + Matrix is a secure, decentralized communication platform that ensures privacy and control over your data. Learn more about [Matrix](https://matrix.org/). + + #### Privacy and Security + End-to-end encryption keeps your conversations private and secure. + + #### Decentralized and Open + Matrix's federated network means you can host your own server or use any provider while staying connected. + + #### A Movement for Digital Freedom + By using Matrix, you support open, transparent, and secure communication. + - name: Signal + description: Message me on Signal + icon: + class: fa-brands fa-signal-messenger + identifier: "+491781798023" + warning: Signal is not hosted by me! + alternatives: + - link: navigation.header.contact.messenger.matrix + - name: Telegram + description: Message me on Telegram + icon: + class: fa-brands fa-telegram + target: _blank + url: https://t.me/kevinveenbirkenbach + identifier: kevinveenbirkenbach + warning: Telegram is not hosted by me! + alternatives: + - link: navigation.header.contact.messenger.matrix + - name: WhatsApp + description: Chat with me on WhatsApp + icon: + class: fa-brands fa-whatsapp + url: https://wa.me/491781798023 + identifier: "+491781798023" + info: Consider using decentralized and privacy-respecting alternatives to maintain control over your data, improve security, and foster healthier online interactions. + alternatives: + - link: navigation.header.contact.messenger.matrix + - link: navigation.header.contact.messenger.signal + - link: navigation.header.contact.messenger.telegram + footer: + children: + - link: accounts + - name: Solution Hub + description: Curated collection of self hosted tools + icon: + class: fa-solid fa-network-wired + url: + children: + - name: Community + description: Tools to manage the community + icon: + class: fa-solid fa-users + children: + - name: Forum + description: Join the discussion + icon: + class: fa-brands fa-discourse + url: https://forum.veen.world/ + - name: Learning Platform + description: Learn with {{ 'our' if person.type == 'legal' else 'my' }} academy + icon: + class: fa-solid fa-graduation-cap + url: https://academy.veen.world/ + - name: Newsletter + description: Subscribe to {{ 'our' if person.type == 'legal' else 'my' }} newsletter + icon: + class: fa-solid fa-envelope-open-text + url: https://newsletter.veen.world/subscription/form + - name: Project Management + description: Project Management Tools + icon: + class: fa-solid fa-chart-line + children: + - name: Open Project + description: Explore {{ 'our' if person.type == 'legal' else 'my' }} projects + icon: + class: fa-solid fa-tasks + url: https://project.veen.world/ + + - name: Taiga + description: View {{ 'our' if person.type == 'legal' else 'my' }} Kanban board + icon: + class: bi bi-clipboard2-check-fill + url: https://kanban.veen.world/ + + - name: Snipe IT + description: Manage {{ 'our' if person.type == 'legal' else 'my' }} inventory + icon: + class: fas fa-box-open + url: https://inventory.veen.world/ + + - name: Communication + icon: + class: fa-solid fa-comments + children: + - name: Elements + description: Chat with me + icon: + class: fa-solid fa-comment + url: https://element.veen.world/ + + - name: Big Blue Button + description: Join live events + icon: + class: fa-solid fa-video + url: https://meet.veen.world/ + + - name: Mailu + description: Send me a mail + icon: + class: fa-solid fa-envelope + url: https://mail.veen.world/ + - name: Administration + icon: + class: fas fa-building + children: + - name: Matomo + description: Analyze with Matomo + icon: + class: fa-solid fa-chart-simple + url: https://matomo.veen.world/ + - name: phpMyAdmin + description: Administrate MySQL and MariaDB databases + icon: + class: fas fa-database + url: https://phpmyadmin.veen.world/ + - name: Keycloak + description: Manage User via Keycloak + icon: + class: fas fa-user-shield + url: https://auth.veen.world/admin + - name: LDAP + description: Manage LDAP + icon: + class: fas fa-key + url: https://ldap.veen.world/ + - name: Tools + icon: + class: fas fa-tools + children: + - name: Baserow + description: Organize with Baserow + icon: + class: fa-solid fa-table + url: https://baserow.veen.world/ + - name: Yourls + description: Find {{ 'our' if person.type == 'legal' else 'my' }} curated links + icon: + class: bi bi-link + url: https://s.veen.world/admin/ + + - name: Nextcloud + description: Access {{ 'our' if person.type == 'legal' else 'my' }} cloud storage + icon: + class: fa-solid fa-cloud + url: https://cloud.veen.world/ + - name: Imprint + description: Check out the imprint information + icon: + class: fa-solid fa-scale-balanced + url: https://s.veen.world/imprint + \ No newline at end of file diff --git a/roles/docker-portfolio/templates/docker-compose.yml.j2 b/roles/docker-portfolio/templates/docker-compose.yml.j2 index 77eaa4a8..9c83fe80 100644 --- a/roles/docker-portfolio/templates/docker-compose.yml.j2 +++ b/roles/docker-portfolio/templates/docker-compose.yml.j2 @@ -1,14 +1,14 @@ services: portfolio: build: - context: . + context: {{docker_repository_path}} dockerfile: Dockerfile image: application-portfolio container_name: portfolio ports: - 127.0.0.1:{{http_port}}:5000 volumes: - - ./app:/app + - {{docker_repository_path}}app:/app restart: unless-stopped {% include 'templates/docker/container/networks.yml.j2' %} healthcheck: diff --git a/roles/docker-portfolio/vars/main.yml b/roles/docker-portfolio/vars/main.yml index 7e3b9bb0..36d18be6 100644 --- a/roles/docker-portfolio/vars/main.yml +++ b/roles/docker-portfolio/vars/main.yml @@ -1,2 +1,3 @@ -application_id: "portfolio" -repository_address: "https://github.com/kevinveenbirkenbach/portfolio" \ No newline at end of file +application_id: "portfolio" +docker_repository_address: "https://github.com/kevinveenbirkenbach/portfolio" +config_inventory_path: "{{ inventory_dir }}/files/{{ inventory_hostname }}/docker/portfolio/config.yaml" \ No newline at end of file diff --git a/roles/docker-repository-setup/README.md b/roles/docker-repository-setup/README.md new file mode 100644 index 00000000..89855172 --- /dev/null +++ b/roles/docker-repository-setup/README.md @@ -0,0 +1,50 @@ +# Docker Repository Setup πŸš€ + +This Ansible role sets up and manages your Docker repository. It ensures that the repository is pulled from your remote Git source, and it automatically triggers a rebuild of your Docker images using Docker Compose. + +## Features πŸ”§ + +- **Default Path Setup:** + Automatically sets a default `docker_repository_path` if not already defined. + +- **Repository Management:** + Clones or updates your Docker repository from a specified Git repository. + +- **Automated Build Trigger:** + Notifies handlers to rebuild the Docker repository using Docker Compose with extended timeouts. + +## Role Structure πŸ“‚ + +- **Handlers:** + - `rebuild docker repository`: Runs `docker compose build` in the designated repository directory with custom timeout settings. + +- **Tasks:** + - Sets the default repository path if undefined. + - Pulls the latest code from the Docker repository. + - Notifies the Docker Compose project setup and triggers a repository rebuild. + +- **Meta:** + - Declares a dependency on the `docker-compose` role to ensure that handlers and related dependencies are loaded. + +## Usage βš™οΈ + +Ensure that you have set the following variables (either via your inventory, `group_vars`, or `host_vars`): + +- `docker_repository_address`: The Git repository URL of your Docker repository. +- `docker_compose.directories.services`: The base directory where your Docker services are stored. + The role will append `repository/` to this path to form `docker_repository_path`. + +If `docker_repository_path` is not defined, the role will automatically set it to: + +```yaml +"{{ docker_compose.directories.services }}repository/" +``` + +## Author + +Kevin Veen-Birkenbach +[https://www.veen.world](https://www.veen.world) + +--- + +Happy deploying! πŸš€πŸ³ \ No newline at end of file diff --git a/roles/docker-repository-setup/handlers/main.yml b/roles/docker-repository-setup/handlers/main.yml new file mode 100644 index 00000000..529a6b16 --- /dev/null +++ b/roles/docker-repository-setup/handlers/main.yml @@ -0,0 +1,7 @@ +- name: rebuild docker repository + command: + cmd: docker compose build + chdir: "{{docker_repository_path}}" + environment: + COMPOSE_HTTP_TIMEOUT: 600 + DOCKER_CLIENT_TIMEOUT: 600 \ No newline at end of file diff --git a/roles/docker-repository-setup/meta/main.yml b/roles/docker-repository-setup/meta/main.yml new file mode 100644 index 00000000..28d81564 --- /dev/null +++ b/roles/docker-repository-setup/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: +- docker-compose # To load handlers and make dependencies visible diff --git a/roles/docker-repository-setup/tasks/main.yml b/roles/docker-repository-setup/tasks/main.yml new file mode 100644 index 00000000..5b2af08b --- /dev/null +++ b/roles/docker-repository-setup/tasks/main.yml @@ -0,0 +1,14 @@ +- name: Set default docker_repository_path if not defined + set_fact: + docker_repository_path: "{{docker_compose.directories.services}}repository/" + when: docker_repository_path is not defined + +- name: pull docker repository + git: + repo: "{{ docker_repository_address }}" + dest: "{{ docker_repository_path }}" + update: yes + notify: + - docker compose project setup + - rebuild docker repository + become: true \ No newline at end of file diff --git a/roles/docker-taiga/tasks/main.yml b/roles/docker-taiga/tasks/main.yml index 51b6ff24..846c8787 100644 --- a/roles/docker-taiga/tasks/main.yml +++ b/roles/docker-taiga/tasks/main.yml @@ -7,13 +7,9 @@ include_role: name: nginx-domain-setup -- name: pull docker repository - git: - repo: "{{ repository_address }}" - dest: "{{ docker_compose.directories.services }}" - update: yes - notify: docker compose project setup - become: true +- name: "include role docker-repository-setup for {{application_id}}" + include_role: + name: docker-repository-setup - name: "create {{docker_compose_init}}" template: diff --git a/roles/docker-taiga/templates/docker-compose.yml.j2 b/roles/docker-taiga/templates/docker-compose.yml.j2 index d4ef3db1..521eb661 100644 --- a/roles/docker-taiga/templates/docker-compose.yml.j2 +++ b/roles/docker-taiga/templates/docker-compose.yml.j2 @@ -81,7 +81,7 @@ services: ports: - "127.0.0.1:{{http_port}}:80" volumes: - - {{docker_compose.directories.services}}taiga-gateway/taiga.conf:/etc/nginx/conf.d/default.conf + - {{docker_repository_path}}taiga-gateway/taiga.conf:/etc/nginx/conf.d/default.conf - static-data:/taiga/static - media-data:/taiga/media {% include 'roles/docker-compose/templates/services/base.yml.j2' %} diff --git a/roles/docker-taiga/vars/main.yml b/roles/docker-taiga/vars/main.yml index 941e663a..37254ff7 100644 --- a/roles/docker-taiga/vars/main.yml +++ b/roles/docker-taiga/vars/main.yml @@ -1,6 +1,6 @@ -application_id: "taiga" -database_type: "postgres" -database_password: "{{taiga_database_password}}" -repository_address: "https://github.com/taigaio/taiga-docker" -email_backend: "smtp" ## use an SMTP server or display the emails in the console (either "smtp" or "console") -docker_compose_init: "{{docker_compose.directories.instance}}docker-compose-inits.yml.j2" \ No newline at end of file +application_id: "taiga" +database_type: "postgres" +database_password: "{{taiga_database_password}}" +docker_repository_address: "https://github.com/taigaio/taiga-docker" +email_backend: "smtp" ## use an SMTP server or display the emails in the console (either "smtp" or "console") +docker_compose_init: "{{docker_compose.directories.instance}}docker-compose-inits.yml.j2" \ No newline at end of file diff --git a/roles/update-docker/templates/update-docker.py.j2 b/roles/update-docker/templates/update-docker.py.j2 index 91d6e89b..6df0f8d8 100644 --- a/roles/update-docker/templates/update-docker.py.j2 +++ b/roles/update-docker/templates/update-docker.py.j2 @@ -124,9 +124,9 @@ def update_discourse(directory): """ Updates Discourse by running the rebuild command on the launcher script. """ - repository_directory = os.path.join(directory, "services", "{{applications.discourse.repository}}") - print(f"Using path {repository_directory} to pull discourse repository.") - os.chdir(repository_directory) + docker_repository_directory = os.path.join(directory, "services", "{{applications.discourse.repository}}") + print(f"Using path {docker_repository_directory } to pull discourse repository.") + os.chdir(docker_repository_directory ) if git_pull(): print("Start Discourse update procedure.") update_procedure("docker stop {{applications.discourse.container}}") diff --git a/tasks/update-repository-with-files.yml b/tasks/update-repository-with-files.yml index 6ef5e9a0..abe75b6c 100644 --- a/tasks/update-repository-with-files.yml +++ b/tasks/update-repository-with-files.yml @@ -21,10 +21,12 @@ chdir: "{{docker_compose.directories.instance}}" ignore_errors: true +# This could be replaced by include_role: docker-repository-setup +# Attendize and Akaunting still use this. When you refactor this code replace this. - name: pull docker repository git: - repo: "{{ repository_address }}" - dest: "{{ repository_directory | default(docker_compose.directories.instance) }}" + repo: "{{ docker_repository_address }}" + dest: "{{ docker_repository_directory | default(docker_compose.directories.instance) }}" update: yes notify: docker compose project setup become: true