Enable the external volume correctly.

This commit is contained in:
Andrea Dell'Amico 2018-07-30 19:28:47 +02:00
parent f7615fa798
commit 2e2db8815c
2 changed files with 5 additions and 6 deletions

View File

@ -19,7 +19,7 @@ sharelatex_mongodb_url: 'mongodb://{{ sharelatex_mongodb_host }}/{{ sharelatex_m
sharelatex_redis_host: localhost
sharelatex_app_name: Our ShareLaTeX
sharelatex_site_url: 'http://localhost/sharelatex'
sharelatex_data_dir: '/srv/sharelatex'
sharelatex_data_volume: 'sharelatex_data'
sharelatex_host_data_dir: '/srv/sharelatex_data'
sharelatex_container_data_dir: '/var/lib/sharelatex'

View File

@ -1,11 +1,11 @@
---
- block:
- name: Create the sharelatex data dir on the host when the container runs as docker
file: dest={{ sharelatex_data_dir }} state=directory owner=docker group=docker
- name: Create the sharelatex data dirs on the host when the container runs as docker
file: dest={{ sharelatex_host_data_dir }} state=directory owner=docker group=docker
when: docker_run_as_docker_user
- name: Create the sharelatex data dir on the host when the container runs as root
file: dest={{ sharelatex_data_dir }} state=directory
file: dest={{ sharelatex_host_data_dir }} state=directory
when: not docker_run_as_docker_user
- name: Create the sharelatex directory into the docker s user home
@ -23,8 +23,7 @@
- name: Start the Sharelatex docker container as docker user
become: True
become_user: docker
#command: docker run -v {{ sharelatex_host_data_dir }}:{{ sharelatex_container_data_dir }} -p {{ sharelatex_container_public_port }}:{{ sharelatex_container_local_port }} --name={{ sharelatex_container_name }} --env-file {{ docker_user_home }}/sharelatex/sharelatex-env.sh {{ sharelatex_docker_image }}
docker_container: name={{ sharelatex_container_name }} volumes:{{ sharelatex_host_data_dir }}:{{ sharelatex_container_data_dir }} published_ports={{ sharelatex_container_public_port }}:{{ sharelatex_container_local_port }} env_file={{ docker_user_home }}/sharelatex/sharelatex-env.sh image={{ sharelatex_docker_image }} state=started keep_volumes=yes pull=yes
docker_container: name={{ sharelatex_container_name }} volumes={{ sharelatex_host_data_dir }}:{{ sharelatex_container_data_dir }} published_ports={{ sharelatex_container_public_port }}:{{ sharelatex_container_local_port }} env_file={{ docker_user_home }}/sharelatex/sharelatex-env.sh image={{ sharelatex_docker_image }} state=started keep_volumes=yes pull=yes
when: docker_run_as_docker_user
- name: Start the Sharelatex docker container as root