From dac6867a7596a5136d42992d1f2b53a7ad44e1a1 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 2 Sep 2023 18:09:06 +0200 Subject: [PATCH] Added docker baserow role --- playbook.yml | 8 ++++++ roles/docker-baserow/README.md | 5 ++++ roles/docker-baserow/handlers/main.yml | 8 ++++++ roles/docker-baserow/tasks/main.yml | 25 +++++++++++++++++++ .../templates/docker-compose.yml.j2 | 16 ++++++++++++ roles/docker-baserow/templates/env.j2 | 10 ++++++++ roles/docker-baserow/vars/main.yml | 1 + 7 files changed, 73 insertions(+) create mode 100644 roles/docker-baserow/README.md create mode 100644 roles/docker-baserow/handlers/main.yml create mode 100644 roles/docker-baserow/tasks/main.yml create mode 100644 roles/docker-baserow/templates/docker-compose.yml.j2 create mode 100644 roles/docker-baserow/templates/env.j2 create mode 100644 roles/docker-baserow/vars/main.yml diff --git a/playbook.yml b/playbook.yml index d552e4e2..d6808b48 100644 --- a/playbook.yml +++ b/playbook.yml @@ -182,6 +182,14 @@ domain: "tickets.{{top_domain}}" http_port: 8015 mail_interface_http_port: 8016 +- name: setup baserow hosts + hosts: baserow + become: true + roles: + - role: docker-baserow + vars: + domain: baserow.{{top_domain}} + http_port: 8017 - name: setup akaunting hosts hosts: akaunting become: true diff --git a/roles/docker-baserow/README.md b/roles/docker-baserow/README.md new file mode 100644 index 00000000..96a11258 --- /dev/null +++ b/roles/docker-baserow/README.md @@ -0,0 +1,5 @@ +# docker baserow + +This role allows the setup of [baserole](https://baserow.io/). + +It was created with the help of [Chat GPT-4](https://chat.openai.com/share/556c2d7f-6b6f-4256-a646-a50529554efc). \ No newline at end of file diff --git a/roles/docker-baserow/handlers/main.yml b/roles/docker-baserow/handlers/main.yml new file mode 100644 index 00000000..9cad282a --- /dev/null +++ b/roles/docker-baserow/handlers/main.yml @@ -0,0 +1,8 @@ +--- +- name: recreate baserow + command: + cmd: docker-compose -p baserow up -d --force-recreate + chdir: "{{path_docker_compose_files}}baserow/" + environment: + COMPOSE_HTTP_TIMEOUT: 600 + DOCKER_CLIENT_TIMEOUT: 600 diff --git a/roles/docker-baserow/tasks/main.yml b/roles/docker-baserow/tasks/main.yml new file mode 100644 index 00000000..01b6d889 --- /dev/null +++ b/roles/docker-baserow/tasks/main.yml @@ -0,0 +1,25 @@ +--- +- name: recieve {{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/docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf + notify: restart nginx + +- name: "create {{docker_compose_path}}" + file: + path: "{{docker_compose_path}}" + state: directory + mode: 0755 + +- name: add docker-compose.yml + template: src=docker-compose.yml.j2 dest={{docker_compose_path}}docker-compose.yml + notify: recreate baserow + +- name: add env + template: + src: env.j2 + dest: "{{docker_compose_path}}env" + mode: '770' + force: yes + notify: recreate baserow \ No newline at end of file diff --git a/roles/docker-baserow/templates/docker-compose.yml.j2 b/roles/docker-baserow/templates/docker-compose.yml.j2 new file mode 100644 index 00000000..cc07adf8 --- /dev/null +++ b/roles/docker-baserow/templates/docker-compose.yml.j2 @@ -0,0 +1,16 @@ +version: '2' + +services: + baserow: + image: baserow/baserow:1.19.1 + restart: always + logging: + driver: journald + env_file: + - ./env + volumes: + - baserow_data:/baserow/data + ports: + - "{{http_port}}:80" +volumes: + baserow_data: \ No newline at end of file diff --git a/roles/docker-baserow/templates/env.j2 b/roles/docker-baserow/templates/env.j2 new file mode 100644 index 00000000..a6ff98fd --- /dev/null +++ b/roles/docker-baserow/templates/env.j2 @@ -0,0 +1,10 @@ +# Public URL +BASEROW_PUBLIC_URL=https://{{ domain }} + +# Email Server Configuration +EMAIL_SMTP=True +EMAIL_SMTP_HOST={{ system_email_host }} +EMAIL_SMTP_PORT={{ system_email_port }} +EMAIL_SMTP_USER={{ system_email_username }} +EMAIL_SMTP_PASSWORD={{ system_email_password }} +EMAIL_SMTP_USE_TLS=tls diff --git a/roles/docker-baserow/vars/main.yml b/roles/docker-baserow/vars/main.yml new file mode 100644 index 00000000..4c6318d8 --- /dev/null +++ b/roles/docker-baserow/vars/main.yml @@ -0,0 +1 @@ +docker_compose_path: "{{path_docker_compose_files}}baserow/" \ No newline at end of file