mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
implemented draft for openproject
This commit is contained in:
49
roles/docker-openproject/README.md
Normal file
49
roles/docker-openproject/README.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# README.md for Docker 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_instance_directory`: Directory for Docker Compose instances.
|
||||
|
||||
## Handlers
|
||||
|
||||
Defined in `handlers/main.yml`, the handler `recreate openproject` is used for recreating the OpenProject instance with specific environment settings.
|
||||
|
||||
## Tasks
|
||||
|
||||
Outlined in `tasks/main.yml`, the role includes tasks for:
|
||||
|
||||
- Including Nginx Docker proxy domain tasks.
|
||||
- Creating the repository directory.
|
||||
- Pulling the OpenProject Docker repository.
|
||||
- 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.
|
||||
|
||||
## Notes
|
||||
|
||||
Ensure that Docker and Docker Compose are installed and configured correctly on the target machine. Also, ensure that the necessary ports are open and accessible.
|
8
roles/docker-openproject/handlers/main.yml
Normal file
8
roles/docker-openproject/handlers/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- 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
|
2
roles/docker-openproject/meta/main.yml
Normal file
2
roles/docker-openproject/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- nginx-docker-reverse-proxy
|
30
roles/docker-openproject/tasks/main.yml
Normal file
30
roles/docker-openproject/tasks/main.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: "include tasks nginx-docker-proxy-domain.yml"
|
||||
include_tasks: nginx-docker-proxy-domain.yml
|
||||
|
||||
- name: "create {{ repository_directory }}"
|
||||
file:
|
||||
path: "{{ repository_directory }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- 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
|
||||
ignore_errors: true
|
||||
|
||||
- name: Warn if repo is not reachable
|
||||
debug:
|
||||
msg: "Warning: Repository is not reachable."
|
||||
when: git_result.failed
|
||||
|
||||
- name: "copy .env"
|
||||
template:
|
||||
src: env.j2
|
||||
dest: "{{docker_compose_instance_directory}}.env"
|
||||
notify: recreate openproject
|
21
roles/docker-openproject/templates/env.j2
Normal file
21
roles/docker-openproject/templates/env.j2
Normal file
@@ -0,0 +1,21 @@
|
||||
##
|
||||
# All environment variables defined here will only apply if you pass them
|
||||
# to the OpenProject container in docker-compose.yml under x-op-app -> environment.
|
||||
# For the examples here this is already the case.
|
||||
#
|
||||
# Please refer to our documentation to see all possible variables:
|
||||
# https://www.openproject.org/docs/installation-and-operations/configuration/environment/
|
||||
#
|
||||
TAG=13
|
||||
OPENPROJECT_HTTPS=true
|
||||
OPENPROJECT_HOST__NAME={{domain}}
|
||||
PORT=127.0.0.1:{{http_port}}
|
||||
OPENPROJECT_RAILS__RELATIVE__URL__ROOT=
|
||||
IMAP_ENABLED=false
|
||||
DATABASE_URL=postgres://openproject:{{ openproject_database_password }}@db/openproject?pool=20&encoding=unicode&reconnect=true
|
||||
RAILS_MIN_THREADS=4
|
||||
RAILS_MAX_THREADS=16
|
||||
|
||||
# The following volumes are default
|
||||
# PGDATA="pgdata"
|
||||
# OPDATA="opdata"
|
2
roles/docker-openproject/vars/main.yml
Normal file
2
roles/docker-openproject/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
repository_directory: "{{ path_docker_compose_instances }}openproject/"
|
||||
docker_compose_instance_directory: "{{repository_directory}}compose/"
|
Reference in New Issue
Block a user