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_service_name: 'shinyproxy'
shinyproxy_docker_network: 'shinyproxy'
shinyproxy_docker_swarm_replicas: 2
# Shinyproxy configuration
# docker, docker-swarm, kubernetes
shinyproxy_container_backend: 'docker'

View File

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

View File

@ -10,11 +10,11 @@
- 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: 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,4 +24,6 @@
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
tags: [ 'shinyproxy', 'shinyproxy_docker', 'docker' ]

View File

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