Fixes to the tasks that install as docker service

This commit is contained in:
Andrea Dell'Amico 2020-10-06 19:16:02 +02:00
parent df5a4eb5b2
commit aebedb0ed0
4 changed files with 20 additions and 10 deletions

View File

@ -22,6 +22,7 @@ shinyproxy_default_apps: True
shinyproxy_as_docker_src_dir: /srv/shinyproxy_service shinyproxy_as_docker_src_dir: /srv/shinyproxy_service
shinyproxy_as_docker_service_name: 'shinyproxy' shinyproxy_as_docker_service_name: 'shinyproxy'
shinyproxy_docker_network: 'shinyproxy' shinyproxy_docker_network: 'shinyproxy'
shinyproxy_docker_swarm_replicas: 2
# Shinyproxy configuration # Shinyproxy configuration
# docker, docker-swarm, kubernetes # docker, docker-swarm, kubernetes
shinyproxy_container_backend: 'docker' shinyproxy_container_backend: 'docker'

View File

@ -31,4 +31,5 @@ dependencies:
version: master version: master
name: openjdk name: openjdk
state: latest state: latest
when: not shinyproxy_as_docker_service

View File

@ -10,11 +10,11 @@
- name: Install the shinyproxy docker file - name: Install the shinyproxy docker file
template: src=Dockerfile.j2 dest={{ shinyproxy_as_docker_src_dir }}/Dockerfile owner=root group=root mode=0444 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 # - name: Create the docker network used by shinyproxy
docker_network: # docker_network:
name: '{{ shinyproxy_docker_network }}' # name: '{{ shinyproxy_docker_network }}'
driver: overlay # driver: overlay
state: present # state: present
- name: Install the docker compose file - name: Install the docker compose file
template: src=shinyproxy-docker-compose.yml.j2 dest={{ shinyproxy_as_docker_src_dir }}/docker-compose.yml template: src=shinyproxy-docker-compose.yml.j2 dest={{ shinyproxy_as_docker_src_dir }}/docker-compose.yml
@ -24,4 +24,6 @@
project_src: '{{ shinyproxy_as_docker_src_dir }}' project_src: '{{ shinyproxy_as_docker_src_dir }}'
build: yes build: yes
run_once: True
when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
tags: [ 'shinyproxy', 'shinyproxy_docker', 'docker' ] tags: [ 'shinyproxy', 'shinyproxy_docker', 'docker' ]

View File

@ -1,17 +1,20 @@
version: '3.8' version: '3.6'
services: services:
shinyproxy: shinyproxy:
build: . build: .
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
ports: #ports:
- '{{ shinyproxy_http_port }}':'{{ shinyproxy_http_port }}' # - '{{ shinyproxy_http_port }}':'{{ shinyproxy_http_port }}'
expose:
- "{{ shinyproxy_http_port }}"
networks: networks:
- '{{ shinyproxy_docker_network }}' - '{{ shinyproxy_docker_network }}'
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: {{ shinyproxy_docker_swarm_replicas }}
endpoint_mode: dnsrr
placement: placement:
constraints: [node.role == manager] constraints: [node.role == manager]
restart_policy: restart_policy:
@ -19,8 +22,11 @@ services:
delay: 5s delay: 5s
max_attempts: 3 max_attempts: 3
window: 120s window: 120s
{% if docker_log_to_journal %}
log_driver: 'journald'
{% endif %}
networks: networks:
'{{ shinyproxy_docker_network }}': '{{ shinyproxy_docker_network }}':
driver: overlay driver: overlay
attachable: true attachable: true