diff --git a/shinyproxy/defaults/main.yml b/shinyproxy/defaults/main.yml new file mode 100644 index 00000000..637b0d58 --- /dev/null +++ b/shinyproxy/defaults/main.yml @@ -0,0 +1,9 @@ +--- +shinyproxy_install: False +shinyproxy_version: 0.8.6 +shinyproxy_file_name: 'shinyproxy-{{ shinyproxy_version }}.jar' +shinyproxy_url: 'https://www.shinyproxy.io/downloads/{{ shinyproxy_file_name }}' +shinyproxy_app_name: shinyproxy.jar +shinyproxy_user: shinyproxy +shinyproxy_install_dir: /opt/shinyproxy +shinyproxy_http_port: 8080 diff --git a/shinyproxy/tasks/main.yml b/shinyproxy/tasks/main.yml new file mode 100644 index 00000000..f5325e1c --- /dev/null +++ b/shinyproxy/tasks/main.yml @@ -0,0 +1,25 @@ +--- +- block: + - name: Create the shinyproxy user + user: name={{ shinyproxy_user }} home={{ shinyproxy_install_dir }} createhome=yes system=yes shell=/usr/sbin/nologin + + - name: Download the shinyproxy jar + become: True + become_user: '{{ shinyproxy_user }}' + get_url: url={{ shinyproxy_url }} dest={{ shinyproxy_install_dir }} + + - name: Set up a symlink to an unversioned app name + become: True + become_user: '{{ shinyproxy_user }}' + file: src={{ shinyproxy_install_dir }}/{{ shinyproxy_file_name }} dest={{ shinyproxy_install_dir }}/{{ shinyproxy_app_name }} state=link + + - name: Install the upstart init file + template: src=upstart-shiniproxy.conf.j2 dest=/etc/init/shinyproxy.conf owner=root group=root mode=0644 + when: is_trusty + + - name: Ensure that the shinyproxy service is enabled and running + service: name=shinyproxy state=started enabled=yes + + when: shinyproxy_install + tags: shinyproxy + diff --git a/shinyproxy/upstart-shinyproxy.conf.j2 b/shinyproxy/upstart-shinyproxy.conf.j2 new file mode 100644 index 00000000..1519b125 --- /dev/null +++ b/shinyproxy/upstart-shinyproxy.conf.j2 @@ -0,0 +1,13 @@ +# shinyproxy - springboot based shiny executor + +description "shinyproxy service" + +start on runlevel [2345] +stop on runlevel [!2345] +respawn +respawn limit 10 5 + +setuid {{ shinyproxy_user }} +setgid {{ shinyproxy_user }} + +exec java -jar {{ shinyproxy_install_dir }}/{{ shinyproxy_app_name }}