implemented draft for openproject

This commit is contained in:
2023-12-22 15:49:55 +01:00
parent b5e9197393
commit 824b3b1d87
10 changed files with 171 additions and 43 deletions

View 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.

View 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

View File

@@ -0,0 +1,2 @@
dependencies:
- nginx-docker-reverse-proxy

View 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

View 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"

View File

@@ -0,0 +1,2 @@
repository_directory: "{{ path_docker_compose_instances }}openproject/"
docker_compose_instance_directory: "{{repository_directory}}compose/"