Skip to content
Snippets Groups Projects
Commit 82bafd2a authored by jurgenhaas's avatar jurgenhaas
Browse files

mobimo/support#2979 Add support for maven apps to get installed

parent 0268a08f
No related branches found
No related tags found
No related merge requests found
---
# file: roles/docker/tasks/apps/maven.yml
- name: Set facts
set_fact:
appdir: /apps/{{ app.id }}
- name: Ensure Python Components
pip:
name: '{{ packages }}'
state: present
vars:
packages:
- lxml
- name: Ensure App Directory
file:
path: '{{ appdir }}/app'
state: directory
- name: Download Jar file
maven_artifact:
group_id: '{{ app.group_id }}'
artifact_id: '{{ app.artifact_id }}'
repository_url: '{{ app.repository_url }}'
version: '{{ app.version }}'
headers:
Private-Token: '{{ GITLAB_PRIVATE_TOKEN }}'
dest: '{{ appdir }}/app/{{ app.id }}.jar'
- name: Docker compose file
template:
src: maven/docker-compose.yml
dest: '{{ appdir }}/docker-compose.yml'
mode: 0664
- name: Start Docker containers
shell: docker compose {{ item }}
args:
chdir: '{{ appdir }}'
with_items:
- pull --quiet
- up -d
......@@ -12,4 +12,10 @@
- name: Import install
import_tasks: install.yml
- name: Install Maven App
include_tasks: apps/maven.yml
with_items: '{{ docker_compose_maven_apps|default([]) }}'
loop_control:
loop_var: app
when: not excluded_roles or "docker" not in excluded_roles
version: '3.3'
name: {{ app.id }}
services:
app:
image: registry.lakedrops.com/docker/maven-build/maven
restart: unless-stopped
command: java -jar /app/{{ app.id }}.jar{% for key, value in app.extrajarargs.items() %} --{{ key }}={{ value }}{% endfor %}
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- {{ appdir }}/app:/app
- {{ appdir }}/data:/data
{% if app.dbimage is defined %}
depends_on:
- db
db:
image: '{{ app.dbimage }}'
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: {{ app.id }}
MYSQL_DATABASE: {{ app.id }}
MYSQL_USER: {{ app.id }}
MYSQL_PASSWORD: {{ app.id }}
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- {{ appdir }}/db:/var/lib/mysql
{% endif %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment