Install a stack from a public image. Mount the configuration file.
This commit is contained in:
parent
1c41052e76
commit
ba6d510c21
|
@ -19,6 +19,7 @@ shinyproxy_http_port: 8080
|
|||
shinyproxy_log_retention: 10
|
||||
shinyproxy_default_apps: True
|
||||
# Shinyproxy as docker service
|
||||
shinyproxy_docker_image: 'adellamisti/shinyproxy:latest'
|
||||
shinyproxy_as_docker_src_dir: /srv/shinyproxy_service
|
||||
shinyproxy_as_docker_service_name: 'shinyproxy'
|
||||
shinyproxy_docker_network: 'shinyproxy'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
- name: Manage the composition of shinyproxy as a docker swarm service
|
||||
- name: Manage the composition of shinyproxy as a docker (non swarm) service
|
||||
block:
|
||||
- name: Create the directory where the dockerfile and the configuration file will be copied to
|
||||
- name: Create the directory where the dockerfile and the configuration file will be copied into
|
||||
file: dest={{ shinyproxy_as_docker_src_dir }} state=directory
|
||||
|
||||
- name: Install the shinyproxy configuration file when using version 2.x
|
||||
|
@ -10,12 +10,6 @@
|
|||
- name: Install the shinyproxy docker file
|
||||
template: src=Dockerfile.j2 dest={{ shinyproxy_as_docker_src_dir }}/Dockerfile owner=root group=root mode=0444
|
||||
|
||||
# - name: Create the docker network used by shinyproxy
|
||||
# docker_network:
|
||||
# name: '{{ shinyproxy_docker_network }}'
|
||||
# driver: overlay
|
||||
# state: present
|
||||
|
||||
- name: Install the docker compose file
|
||||
template: src=shinyproxy-docker-compose.yml.j2 dest={{ shinyproxy_as_docker_src_dir }}/docker-compose.yml
|
||||
|
||||
|
@ -24,6 +18,37 @@
|
|||
project_src: '{{ shinyproxy_as_docker_src_dir }}'
|
||||
build: yes
|
||||
|
||||
run_once: True
|
||||
when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
|
||||
when: shinyproxy_container_backend == 'docker'
|
||||
tags: [ 'shinyproxy', 'shinyproxy_docker', 'docker' ]
|
||||
|
||||
- name: Manage the installation of the shinyproxy configuration
|
||||
block:
|
||||
- name: Create the directory where the dockerfile and the configuration file will be copied into
|
||||
file: dest={{ shinyproxy_as_docker_src_dir }} state=directory
|
||||
|
||||
- name: Install the shinyproxy configuration file
|
||||
template: src=shinyproxy-2-conf.yml.j2 dest={{ shinyproxy_as_docker_src_dir }}/application.yml owner=root group=root mode=0400
|
||||
|
||||
when: shinyproxy_container_backend == 'docker-swarm'
|
||||
tags: [ 'shinyproxy', 'shinyproxy_swarm', 'docker' ]
|
||||
|
||||
- name: Manage the composition of shinyproxy as a docker swarm stack
|
||||
block:
|
||||
- name: Create the directory where the dockerfile and the configuration file will be copied into
|
||||
file: dest={{ shinyproxy_as_docker_src_dir }} state=directory
|
||||
|
||||
- name: Install the docker compose file
|
||||
template: src=shinyproxy-docker-compose.yml.j2 dest={{ shinyproxy_as_docker_src_dir }}/docker-shinyproxy-stack.yml
|
||||
|
||||
- name: Start the shinyproxy stack
|
||||
docker_stack:
|
||||
name: shinyproxy
|
||||
state: present
|
||||
compose:
|
||||
- '{{ haproxy_docker_compose_dir }}/docker-shinyproxy-stack.yml'
|
||||
|
||||
run_once: True
|
||||
when:
|
||||
- docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
|
||||
- shinyproxy_container_backend == 'docker-swarm'
|
||||
tags: [ 'shinyproxy', 'shinyproxy_swarm', 'docker' ]
|
||||
|
|
|
@ -2,15 +2,19 @@ version: '3.6'
|
|||
|
||||
services:
|
||||
shinyproxy:
|
||||
{% if shinyproxy_container_backend == 'docker' %}
|
||||
build: .
|
||||
ports:
|
||||
- '{{ shinyproxy_http_port }}':'{{ shinyproxy_http_port }}'
|
||||
{% else %}
|
||||
image: {{ shinyproxy_docker_image }}
|
||||
{% endif %}
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
#ports:
|
||||
# - '{{ shinyproxy_http_port }}':'{{ shinyproxy_http_port }}'
|
||||
expose:
|
||||
- "{{ shinyproxy_http_port }}"
|
||||
- {{ shinyproxy_as_docker_src_dir }}/application.yml:/opt/shinyproxy/application.yml:ro
|
||||
networks:
|
||||
- '{{ shinyproxy_docker_network }}'
|
||||
- shinyproxy_{{ shinyproxy_docker_network }}
|
||||
{% if shinyproxy_container_backend == 'docker-swarm' %}
|
||||
deploy:
|
||||
mode: replicated
|
||||
replicas: {{ shinyproxy_docker_swarm_replicas }}
|
||||
|
@ -22,6 +26,7 @@ services:
|
|||
delay: 5s
|
||||
max_attempts: 3
|
||||
window: 120s
|
||||
{% endif %}
|
||||
{% if docker_log_to_journal %}
|
||||
logging:
|
||||
driver: 'journald'
|
||||
|
|
Loading…
Reference in New Issue