From c6576c9f9dce21bf350308692e5562b7d74b09f7 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 29 May 2023 13:03:57 +0200 Subject: [PATCH] Added draft for attendize --- playbook.yml | 9 ++++ roles/server_docker-attendize/README.md | 13 +++++ roles/server_docker-attendize/meta/main.yml | 2 + roles/server_docker-attendize/tasks/main.yml | 51 ++++++++++++++++++ .../templates/docker-compose.yml.j2 | 52 +++++++++++++++++++ roles/server_docker-attendize/vars/main.yml | 3 ++ 6 files changed, 130 insertions(+) create mode 100644 roles/server_docker-attendize/README.md create mode 100644 roles/server_docker-attendize/meta/main.yml create mode 100644 roles/server_docker-attendize/tasks/main.yml create mode 100644 roles/server_docker-attendize/templates/docker-compose.yml.j2 create mode 100644 roles/server_docker-attendize/vars/main.yml diff --git a/playbook.yml b/playbook.yml index 3e2995db..c5e85ae0 100644 --- a/playbook.yml +++ b/playbook.yml @@ -173,6 +173,15 @@ vars: domain: "joomla.{{top_domain}}" http_port: 8014 +- name: setup attendize + hosts: attendize + become: true + roles: + - role: server_docker-attendize + vars: + domain: "tickets.{{top_domain}}" + http_port: 8015 + mail_interface_http_port: 8016 - name: setup akaunting hosts hosts: akaunting become: true diff --git a/roles/server_docker-attendize/README.md b/roles/server_docker-attendize/README.md new file mode 100644 index 00000000..d3a58092 --- /dev/null +++ b/roles/server_docker-attendize/README.md @@ -0,0 +1,13 @@ +# Role: server_docker-attendize + +This Ansible role sets up Attendize, an open-source ticket selling and event management platform. + +## Setup Instructions + +```bash +bash ./Makefile setup +``` + +## Author and License + +This role was created by Kevin Veen-Birkenbach (kevin@veen.world) and is distributed under the AGPL v3 License. diff --git a/roles/server_docker-attendize/meta/main.yml b/roles/server_docker-attendize/meta/main.yml new file mode 100644 index 00000000..da6fe221 --- /dev/null +++ b/roles/server_docker-attendize/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: +- server_native-docker-reverse-proxy diff --git a/roles/server_docker-attendize/tasks/main.yml b/roles/server_docker-attendize/tasks/main.yml new file mode 100644 index 00000000..f364d1a6 --- /dev/null +++ b/roles/server_docker-attendize/tasks/main.yml @@ -0,0 +1,51 @@ +--- +- name: receive {{ mail_interface_domain }} certificate + command: certbot certonly --agree-tos --email {{ administrator_email }} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{ mail_interface_domain }} + +- name: receive {{ domain }} certificate + command: certbot certonly --agree-tos --email {{ administrator_email }} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{ domain }} + +- name: configure {{domain}}.conf + template: + src: roles/server_native-docker-reverse-proxy/templates/domain.conf.j2 + dest: /etc/nginx/conf.d/{{domain}}.conf + notify: restart nginx + +#- name: configure {{ mail_interface_domain }}.conf +# template: +# src: roles/server_native-docker-reverse-proxy/templates/domain.conf.j2 +# dest: /etc/nginx/conf.d/{{ mail_interface_domain }}.conf +# vars: +# http_port: "{{ mail_interface_http_port }}" +# domain: "{{ mail_interface_domain }}" +# notify: restart nginx + +- name: register directory + stat: + path: "{{docker_compose_attendize_path}}" + register: docker_compose_attendize_path_register + +- name: checkout repository + ansible.builtin.shell: git checkout . + become: true + args: + chdir: "{{docker_compose_attendize_path}}" + when: docker_compose_attendize_path_register.stat.exists + +- name: checkout Attendize repository + ansible.builtin.git: + repo: "https://github.com/Attendize/Attendize.git" + dest: "{{docker_compose_attendize_path}}" + version: master + become: true + +- name: Warn if repo is not reachable + debug: + msg: "Warning: Repository is not reachable." + when: git_result.failed + +- name: create docker-compose.yml file from template + template: + src: docker-compose.yml.j2 + dest: "{{docker_compose_attendize_path}}/docker-compose.yml" + mode: 0644 \ No newline at end of file diff --git a/roles/server_docker-attendize/templates/docker-compose.yml.j2 b/roles/server_docker-attendize/templates/docker-compose.yml.j2 new file mode 100644 index 00000000..8b8ea942 --- /dev/null +++ b/roles/server_docker-attendize/templates/docker-compose.yml.j2 @@ -0,0 +1,52 @@ +version: '3.2' +services: + web: + image: attendize_web:latest + ports: + - "{{http_port}}:80" + #- "8081:443" + volumes: + - .:/usr/share/nginx/html + - .:/var/www + depends_on: + - database + - maildev + - redis + - worker + env_file: + - ./.env + worker: + image: attendize_worker:latest + depends_on: + - database + - maildev + - redis + volumes: + - .:/usr/share/nginx/html + - .:/var/www + database: + logging: + driver: journald + image: mariadb + restart: always + environment: + MYSQL_DATABASE: "attendize" + MYSQL_USER: "attendize" + MYSQL_PASSWORD: "{{attendize_database_password}}" + MYSQL_ROOT_PASSWORD: "{{attendize_database_password}}" + MARIADB_AUTO_UPGRADE: "1" + volumes: + - database:/var/lib/mysql + healthcheck: + test: "/usr/bin/mysql --user=attendize --password={{attendize_database_password}} --execute \"SHOW DATABASES;\"" + interval: 3s + timeout: 1s + retries: 5 + maildev: + image: maildev/maildev + ports: + - "{{ mail_interface_http_port }}:1080" + redis: + image: redis +volumes: + database: \ No newline at end of file diff --git a/roles/server_docker-attendize/vars/main.yml b/roles/server_docker-attendize/vars/main.yml new file mode 100644 index 00000000..fdbc1410 --- /dev/null +++ b/roles/server_docker-attendize/vars/main.yml @@ -0,0 +1,3 @@ +--- +docker_compose_attendize_path: "{{path_docker_compose_files}}attendize/" +mail_interface_domain: "mail.{{domain}}"