mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 12:41:05 +01:00
Created role docker-compose and refactored attendize, akauntin, openproject
This commit is contained in:
parent
3181ce3def
commit
f70a7690a8
@ -18,6 +18,8 @@ This guide details the process of setting up Akaunting, a free and online accoun
|
||||
|
||||
## Installation Steps
|
||||
|
||||
@ATTENTION Variable ```#AKAUNTING_SETUP: true``` needs to be set
|
||||
|
||||
### New Manual Setup
|
||||
1. **Navigate to Docker Compose Directory**: Change to the directory containing your Docker Compose files for Akaunting.
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
dependencies:
|
||||
- nginx-docker-reverse-proxy
|
||||
- docker-compose
|
@ -2,43 +2,13 @@
|
||||
- name: "include tasks nginx-docker-proxy-domain.yml"
|
||||
include_tasks: nginx-docker-proxy-domain.yml
|
||||
|
||||
- name: register directory
|
||||
stat:
|
||||
path: "{{docker_compose_instance_directory}}"
|
||||
register: docker_compose_instance_directory_register
|
||||
|
||||
- name: checkout repository
|
||||
ansible.builtin.shell: git checkout .
|
||||
become: true
|
||||
args:
|
||||
chdir: "{{docker_compose_instance_directory}}"
|
||||
when: docker_compose_instance_directory_register.stat.exists
|
||||
|
||||
- name: pull docker repository
|
||||
git:
|
||||
repo: "https://github.com/akaunting/docker.git"
|
||||
dest: "{{docker_compose_instance_directory}}"
|
||||
update: yes
|
||||
notify: setup akaunting
|
||||
become: true
|
||||
register: git_result
|
||||
ignore_errors: true
|
||||
|
||||
- name: Warn if repo is not reachable
|
||||
debug:
|
||||
msg: "Warning: Repository is not reachable."
|
||||
when: git_result.failed
|
||||
|
||||
- name: set akaunting version
|
||||
ansible.builtin.shell: find . -type f -exec sed -i 's/akaunting:latest/akaunting:{{version_akaunting}}/' {} + && find . -type f -exec sed -i 's/version=latest/version={{version_akaunting}}/' {} +
|
||||
become: true
|
||||
args:
|
||||
chdir: "{{docker_compose_instance_directory}}"
|
||||
- name: "include tasks update-repository-with-docker-compose.yml"
|
||||
include_tasks: update-repository-with-docker-compose.yml
|
||||
|
||||
- name: configure db.env
|
||||
template: src=db.env.j2 dest={{docker_compose_instance_directory}}/env/db.env
|
||||
notify: setup akaunting
|
||||
notify: docker compose project setup
|
||||
|
||||
- name: configure run.env
|
||||
template: src=run.env.j2 dest={{docker_compose_instance_directory}}/env/run.env
|
||||
notify: setup akaunting
|
||||
notify: docker compose project setup
|
||||
|
24
roles/docker-akaunting/templates/docker-compose.yml.j2
Normal file
24
roles/docker-akaunting/templates/docker-compose.yml.j2
Normal file
@ -0,0 +1,24 @@
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
application:
|
||||
image: docker.io/akaunting/akaunting:{{version_akaunting}}
|
||||
build:
|
||||
context: .
|
||||
ports:
|
||||
- 127.0.0.1:{{http_port}}:80
|
||||
volumes:
|
||||
- data:/var/www/html
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- env/run.env
|
||||
environment:
|
||||
- AKAUNTING_SETUP
|
||||
depends_on:
|
||||
- database
|
||||
|
||||
{% include 'templates/docker-mariadb-service.yml.j2' %}
|
||||
|
||||
volumes:
|
||||
data:
|
||||
database:
|
@ -1,6 +1,10 @@
|
||||
docker_compose_instance_directory: "{{path_docker_compose_instances}}akaunting/"
|
||||
database_instance: "akaunting"
|
||||
database_host: "akaunting-db"
|
||||
database_databasename: "{{database_instance}}"
|
||||
database_username: "admin"
|
||||
database_password: "{{akaunting_database_password}}"
|
||||
docker_compose_project_name: "akaunting"
|
||||
docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/"
|
||||
docker_compose_file_path: "{{docker_compose_instance_directory}}docker-compose.yml"
|
||||
docker_compose_backup_path: "/tmp/{{docker_compose_project_name}}-docker-compose-backup.yml"
|
||||
database_instance: "{{docker_compose_project_name}}"
|
||||
database_host: "database"
|
||||
database_databasename: "{{database_instance}}"
|
||||
database_username: "admin"
|
||||
database_password: "{{akaunting_database_password}}"
|
||||
repository_address: "https://github.com/akaunting/docker.git"
|
||||
|
@ -1,4 +1,6 @@
|
||||
# Role: docker-attendize
|
||||
@TODO @ATTENTION THIS ROLE IS WORK IN PROGRESS
|
||||
|
||||
# Role: docker-attendize (WIP)
|
||||
|
||||
This Ansible role sets up Attendize, an open-source ticket selling and event management platform.
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
dependencies:
|
||||
- nginx-docker-reverse-proxy
|
||||
- docker-compose
|
@ -20,32 +20,5 @@
|
||||
# domain: "{{ mail_interface_domain }}"
|
||||
# notify: restart nginx
|
||||
|
||||
- name: register directory
|
||||
stat:
|
||||
path: "{{docker_compose_instance_directory}}"
|
||||
register: docker_compose_instance_directory_register
|
||||
|
||||
- name: checkout repository
|
||||
ansible.builtin.shell: git checkout .
|
||||
become: true
|
||||
args:
|
||||
chdir: "{{docker_compose_instance_directory}}"
|
||||
when: docker_compose_instance_directory_register.stat.exists
|
||||
|
||||
- name: checkout Attendize repository
|
||||
ansible.builtin.git:
|
||||
repo: "https://github.com/Attendize/Attendize.git"
|
||||
dest: "{{docker_compose_instance_directory}}"
|
||||
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_instance_directory}}/docker-compose.yml"
|
||||
mode: 0644
|
||||
- name: "include tasks update-repository-with-docker-compose.yml"
|
||||
include_tasks: update-repository-with-docker-compose.yml
|
@ -1,8 +1,12 @@
|
||||
---
|
||||
docker_compose_project_name: "attendize"
|
||||
docker_compose_instance_directory: "{{path_docker_compose_instances}}attendize/"
|
||||
docker_compose_file_path: "{{docker_compose_instance_directory}}docker-compose.yml"
|
||||
docker_compose_backup_path: "/tmp/attendize-docker-compose-backup.yml"
|
||||
mail_interface_domain: "mail.{{domain}}"
|
||||
database_instance: "attendize"
|
||||
database_instance: "{{docker_compose_project_name}}"
|
||||
database_host: "database"
|
||||
database_databasename: "{{database_instance}}"
|
||||
database_username: "{{database_instance}}"
|
||||
database_password: "{{attendize_database_password}}"
|
||||
repository_address: "https://github.com/Attendize/Attendize.git"
|
@ -1,9 +1,8 @@
|
||||
---
|
||||
- name: setup akaunting
|
||||
- name: docker compose project setup
|
||||
command:
|
||||
cmd: docker-compose -p akaunting up -d --force-recreate
|
||||
cmd: docker-compose -p "{{docker_compose_project_name}}" up -d --force-recreate
|
||||
chdir: "{{docker_compose_instance_directory}}"
|
||||
environment:
|
||||
#AKAUNTING_SETUP: true
|
||||
COMPOSE_HTTP_TIMEOUT: 600
|
||||
DOCKER_CLIENT_TIMEOUT: 600
|
2
roles/docker-compose/meta/main.yml
Normal file
2
roles/docker-compose/meta/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- nginx-docker-reverse-proxy
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
- name: recreate openproject
|
||||
command:
|
||||
cmd: docker-compose -p openproject up -d --force-recreate
|
||||
chdir: "{{ docker_compose_instance_directory }}"
|
||||
environment:
|
||||
COMPOSE_HTTP_TIMEOUT: 600
|
||||
DOCKER_CLIENT_TIMEOUT: 600
|
@ -1,2 +1,2 @@
|
||||
dependencies:
|
||||
- nginx-docker-reverse-proxy
|
||||
- docker-compose
|
@ -2,54 +2,11 @@
|
||||
- name: "include tasks nginx-docker-proxy-domain.yml"
|
||||
include_tasks: nginx-docker-proxy-domain.yml
|
||||
|
||||
- name: "backup docker-compose.yml if it exists"
|
||||
command: >
|
||||
mv "{{ docker_compose_file_path }}" "{{ docker_compose_backup_path }}"
|
||||
args:
|
||||
removes: "{{ docker_compose_file_path }}"
|
||||
become: true
|
||||
|
||||
- name: register directory
|
||||
stat:
|
||||
path: "{{docker_compose_instance_directory}}"
|
||||
register: docker_compose_instance_directory_register
|
||||
|
||||
- name: checkout repository
|
||||
ansible.builtin.shell: git checkout .
|
||||
become: true
|
||||
args:
|
||||
chdir: "{{docker_compose_instance_directory}}"
|
||||
when: docker_compose_instance_directory_register.stat.exists
|
||||
|
||||
- name: pull docker repository
|
||||
git:
|
||||
repo: "https://github.com/opf/openproject-deploy"
|
||||
dest: "{{ repository_directory }}"
|
||||
update: yes
|
||||
notify: recreate openproject
|
||||
become: true
|
||||
register: git_result
|
||||
|
||||
- name: "restore docker-compose.yml from backup"
|
||||
command: >
|
||||
mv "{{ docker_compose_backup_path }}" "{{ docker_compose_file_path }}"
|
||||
args:
|
||||
removes: "{{ docker_compose_backup_path }}"
|
||||
become: true
|
||||
|
||||
- name: Warn if repo is not reachable
|
||||
debug:
|
||||
msg: "Warning: Repository is not reachable."
|
||||
when: git_result.failed
|
||||
- name: "include tasks update-repository-with-docker-compose.yml"
|
||||
include_tasks: update-repository-with-docker-compose.yml
|
||||
|
||||
- name: "copy .env"
|
||||
template:
|
||||
src: env.j2
|
||||
dest: "{{ docker_compose_instance_directory }}.env"
|
||||
notify: recreate openproject
|
||||
|
||||
- name: "copy docker-compose.yml"
|
||||
template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{ docker_compose_file_path }}"
|
||||
notify: recreate openproject
|
||||
notify: docker compose project setup
|
||||
|
@ -21,7 +21,7 @@ x-op-app: &app
|
||||
RAILS_CACHE_STORE: "memcache"
|
||||
OPENPROJECT_CACHE__MEMCACHE__SERVER: "cache:11211"
|
||||
OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}"
|
||||
DATABASE_URL: "${DATABASE_URL:-postgres://postgres:p4ssw0rd@db/openproject?pool=20&encoding=unicode&reconnect=true}"
|
||||
DATABASE_URL: "${DATABASE_URL}"
|
||||
RAILS_MIN_THREADS: ${RAILS_MIN_THREADS:-4}
|
||||
RAILS_MAX_THREADS: ${RAILS_MAX_THREADS:-16}
|
||||
# set to true to enable the email receiving feature. See ./docker/cron for more options
|
||||
@ -31,7 +31,7 @@ x-op-app: &app
|
||||
- "${PGDATA}:/var/openproject/pgdata"
|
||||
|
||||
services:
|
||||
db:
|
||||
database:
|
||||
image: postgres:13
|
||||
<<: *restart_policy
|
||||
stop_grace_period: "3s"
|
||||
@ -72,7 +72,7 @@ services:
|
||||
- frontend
|
||||
- backend
|
||||
depends_on:
|
||||
- db
|
||||
- database
|
||||
- cache
|
||||
- seeder
|
||||
labels:
|
||||
@ -99,7 +99,7 @@ services:
|
||||
networks:
|
||||
- backend
|
||||
depends_on:
|
||||
- db
|
||||
- database
|
||||
- cache
|
||||
- seeder
|
||||
|
||||
@ -109,7 +109,7 @@ services:
|
||||
networks:
|
||||
- backend
|
||||
depends_on:
|
||||
- db
|
||||
- database
|
||||
- cache
|
||||
- seeder
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
repository_directory: "{{ path_docker_compose_instances }}openproject/"
|
||||
docker_compose_instance_directory: "{{repository_directory}}compose/"
|
||||
docker_compose_file_path: "{{docker_compose_instance_directory}}docker-compose.yml"
|
||||
docker_compose_backup_path: "/tmp/openproject-docker-compose-backup.yml"
|
||||
database_instance: "openproject"
|
||||
database_host: "db"
|
||||
database_databasename: "{{database_instance}}"
|
||||
database_username: "postgres"
|
||||
database_password: "{{openproject_database_password}}"
|
||||
docker_compose_project_name: "openproject"
|
||||
repository_directory: "{{ path_docker_compose_instances }}{{docker_compose_project_name}}/"
|
||||
docker_compose_instance_directory: "{{repository_directory}}compose/"
|
||||
docker_compose_file_path: "{{docker_compose_instance_directory}}docker-compose.yml"
|
||||
docker_compose_backup_path: "/tmp/{{docker_compose_project_name}}-docker-compose-backup.yml"
|
||||
database_instance: "{{docker_compose_project_name}}"
|
||||
database_host: "database"
|
||||
database_databasename: "{{database_instance}}"
|
||||
database_username: "postgres"
|
||||
database_password: "{{openproject_database_password}}"
|
||||
repository_address: "https://github.com/opf/openproject-deploy"
|
@ -246,7 +246,7 @@
|
||||
- role: docker-akaunting
|
||||
vars:
|
||||
domain: "{{domain_akaunting}}"
|
||||
http_port: 8080
|
||||
http_port: 8025
|
||||
|
||||
# Native Webserver Roles
|
||||
- name: setup nginx-homepages
|
||||
|
45
tasks/update-repository-with-docker-compose.yml
Normal file
45
tasks/update-repository-with-docker-compose.yml
Normal file
@ -0,0 +1,45 @@
|
||||
- name: "backup docker-compose.yml if it exists"
|
||||
command: >
|
||||
mv "{{ docker_compose_file_path }}" "{{ docker_compose_backup_path }}"
|
||||
args:
|
||||
removes: "{{ docker_compose_file_path }}"
|
||||
become: true
|
||||
|
||||
- name: register directory
|
||||
stat:
|
||||
path: "{{docker_compose_instance_directory}}"
|
||||
register: docker_compose_instance_directory_register
|
||||
|
||||
- name: checkout repository
|
||||
ansible.builtin.shell: git checkout .
|
||||
become: true
|
||||
args:
|
||||
chdir: "{{docker_compose_instance_directory}}"
|
||||
when: docker_compose_instance_directory_register.stat.exists
|
||||
|
||||
- name: pull docker repository
|
||||
git:
|
||||
repo: "{{ repository_address }}"
|
||||
dest: "{{ repository_directory }}"
|
||||
update: yes
|
||||
notify: docker compose project setup
|
||||
become: true
|
||||
register: git_result
|
||||
|
||||
- name: "restore docker-compose.yml from backup"
|
||||
command: >
|
||||
mv "{{ docker_compose_backup_path }}" "{{ docker_compose_file_path }}"
|
||||
args:
|
||||
removes: "{{ docker_compose_backup_path }}"
|
||||
become: true
|
||||
|
||||
- name: Warn if repo is not reachable
|
||||
debug:
|
||||
msg: "Warning: Repository is not reachable."
|
||||
when: git_result.failed
|
||||
|
||||
- name: "copy docker-compose.yml"
|
||||
template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{ docker_compose_file_path }}"
|
||||
notify: docker compose project setup
|
Loading…
Reference in New Issue
Block a user