forked from ISTI-ansible-roles/ansible-roles
library/roles/smartgears/r_connector: Role that installs the smartgears r-connector.
library/roles/smartgears/smartgears-nginx-frontend/templates: nginx virtualhosts for the rstudio servers.
This commit is contained in:
parent
38e69bec93
commit
bd1808560c
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
gcube_repository: 'gcube-staging'
|
||||
r_connector_install: False
|
||||
r_connector_ver: 2.0.1-4.0.0-128766
|
||||
r_connector_name: r-connector
|
||||
r_connector_filename: '{{ r_connector_name }}-{{ r_connector_ver }}.war'
|
||||
r_connector_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/{{ gcube_repository }}/org/gcube/data/analysis/{{ r_connector_name }}/{{ r_connector_ver}}/{{ r_connector_filename }}'
|
||||
r_connector_war_file: '{{ r_connector_name }}.war'
|
||||
r_connector_usershome: /home/
|
||||
r_connector_userconfig: userconfig.csv
|
||||
r_connector_adduserscript: /usr/local/bin/rusersadd
|
||||
r_connector_rstudio_cookie_key: /var/lib/rstudio-server/secure-cookie-key
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- block:
|
||||
|
||||
- name: Remove the installed R connector before upgrading
|
||||
file: dest={{ item }} state=absent
|
||||
with_items:
|
||||
- '{{ smartgears_instance_path }}/webapps/r-connector'
|
||||
- '{{ smartgears_instance_path }}/webapps/r-connector.war'
|
||||
when: smartgears_upgrade or not r_connector_install
|
||||
|
||||
- name: Get the R connector war file
|
||||
get_url: url={{ ckan_connector_url }} dest={{ smartgears_instance_path }}/webapps/{{ ckan_connector_war_file }}
|
||||
|
||||
- name: Unpack the R connector war file
|
||||
shell: mkdir {{ smartgears_instance_path }}/webapps/r-connector ; cd {{ smartgears_instance_path }}/webapps/r-connector ; jar xf {{ smartgears_instance_path }}/webapps/{{ ckan_connector_war_file }}
|
||||
args:
|
||||
creates: '{{ smartgears_instance_path }}/webapps/r-connector/WEB-INF/web.xml'
|
||||
|
||||
- name: Obtain the permission to read the Rstudio secure cookie key
|
||||
file: dest={{ r_connector_rstudio_cookie_key }} mode=640 group={{ smartgears_user }}
|
||||
|
||||
- name: Install the R connector web.xml template
|
||||
template: src=r-web.xml.j2 dest={{ smartgears_instance_path }}/webapps/r-connector/WEB-INF/web.xml mode=0440
|
||||
notify: Restart smartgears
|
||||
|
||||
become: True
|
||||
become_user: '{{ smartgears_user }}'
|
||||
when: r_connector_install
|
||||
tags: [ 'smartgears', 'r_connector', 'tomcat' ]
|
|
@ -0,0 +1,29 @@
|
|||
<web-app>
|
||||
<context-param>
|
||||
<param-name>usersHome</param-name>
|
||||
<param-value>{{ r_connector_usershome }}</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>filename</param-name>
|
||||
<param-value>{{ r_connector_userconfig }}</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>addUserScript</param-name>
|
||||
<param-value>{{ r_connector_adduserscript }}</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>storedKeyPath</param-name>
|
||||
<param-value>{{ r_connector_rstudio_cookie_key }}</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>rStudioAddress</param-name>
|
||||
<param-value>{{ ansible_fqdn }}</param-value>
|
||||
</context-param>
|
||||
<servlet>
|
||||
<servlet-name>org.gcube.data.analysis.rconnector.RConnector</servlet-name>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>org.gcube.data.analysis.rconnector.RConnector</servlet-name>
|
||||
<url-pattern>/gcube/service/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
USER="$1"
|
||||
HDIR="{{ r_connector_usershome }}/$USER"
|
||||
|
||||
if [ -d $HDIR ] ; then
|
||||
#echo "user dir exist"
|
||||
exit 0
|
||||
else
|
||||
if id -u $USER >/dev/null 2>&1
|
||||
then
|
||||
#"echo "ldap user first login"
|
||||
/bin/su - $USER
|
||||
exit 0
|
||||
else
|
||||
#echo "user does not exist and is not ldap"
|
||||
/usr/sbin/useradd -m -s /bin/false $USER
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,27 @@
|
|||
server {
|
||||
listen {{ http_port }};
|
||||
server_name {{ ansible_fqdn }};
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
proxy_read_timeout 600;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $schema;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_redirect off;
|
||||
|
||||
{% for instance in tomcat_m_instances %}
|
||||
{% for context in instance.app_contexts %}
|
||||
location /{{ context }} {
|
||||
proxy_pass http://localhost:{{ item.http_port }}/{{ context }};
|
||||
}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
location / {
|
||||
proxy_pass http://localhost:{{ rstudio_http_port }}/;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
rstudio-dev.d4science.org-virtualhost.j2
|
Loading…
Reference in New Issue