Role that installs and configure the java reverse proxy servlet.
This commit is contained in:
parent
a8aed0978b
commit
cf93b2011f
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
java_rproxy_service_install: False
|
||||
java_rproxy_service_version: latest
|
||||
java_rproxy_service_name: reverse-proxy
|
||||
java_rproxy_group_id: org.gcube.portal.rproxy
|
||||
java_rproxy_service_extension: war
|
||||
java_rproxy_service_file: '{{ java_rproxy_service_name }}-{{ java_rproxy_service_version }}.{{ java_rproxy_service_extension }}'
|
||||
smartgears_rproxy_base_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/gcube-snapshots'
|
||||
|
||||
java_rproxy_display_name: 'Java Reverse Proxy Service'
|
||||
java_rproxy_targets:
|
||||
- { servlet_name: 'ReverseProxy', target_uri: 'https://revproxied-app.example.org/', log: 'true', forwardip: 'true', preserve_host: 'true', preserve_cookies: 'true', handle_redirects: 'true', socket_timeout: '60000', read_timeout: '60000', url_pattern: [ '/dest1/*', '/dest2/*' ] }
|
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
- block:
|
||||
- name: Remove the old java_rproxy service files
|
||||
file: path={{ item }} state=absent
|
||||
with_items:
|
||||
- '{{ smartgears_instance_path }}/webapps/{{ java_rproxy_service_name }}'
|
||||
- '{{ smartgears_instance_path }}/webapps/{{ java_rproxy_service_name }}.{{ java_rproxy_service_extension }}'
|
||||
notify: Restart smartgears
|
||||
|
||||
become: True
|
||||
become_user: '{{ d4science_user }}'
|
||||
when: not java_rproxy_service_install
|
||||
tags: [ 'smartgears', 'java_rproxy_service', 'tomcat' ]
|
||||
|
||||
- block:
|
||||
- name: Get the java_rproxy-service war
|
||||
#maven_artifact: artifact_id={{ java_rproxy_service_name }} version={{ java_rproxy_service_version | default(omit) }} group_id={{ java_rproxy_group_id }} extension={{ java_rproxy_service_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ java_rproxy_service_file }} verify_checksum=always
|
||||
maven_artifact: artifact_id={{ java_rproxy_service_name }} version={{ java_rproxy_service_version | default(omit) }} group_id={{ java_rproxy_group_id }} extension={{ java_rproxy_service_extension | default('war') }} repository_url={{ smartgears_rproxy_base_url }} dest={{ smartgears_downloads_dir }}/{{ java_rproxy_service_file }} verify_checksum=always
|
||||
register: java_rproxy_service_download
|
||||
|
||||
- name: Remove the old java_rproxy service files
|
||||
file: path={{ item }} state=absent
|
||||
with_items:
|
||||
- '{{ smartgears_instance_path }}/webapps/{{ java_rproxy_service_name }}'
|
||||
- '{{ smartgears_instance_path }}/webapps/{{ java_rproxy_service_name }}.{{ java_rproxy_service_extension }}'
|
||||
notify: Restart smartgears
|
||||
when: java_rproxy_service_download is changed
|
||||
|
||||
- name: Create the java_rproxy webapp directory
|
||||
file: dest={{ smartgears_instance_path }}/webapps/{{ java_rproxy_service_name }} state=directory
|
||||
when: java_rproxy_service_download is changed
|
||||
|
||||
- name: Unarchive the java_rproxy war file
|
||||
unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ java_rproxy_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ java_rproxy_service_name }}
|
||||
args:
|
||||
creates: '{{ smartgears_instance_path }}/webapps/{{ java_rproxy_service_name }}/WEB-INF/web.xml'
|
||||
notify: Restart smartgears
|
||||
|
||||
- name: Install the java_rproxy web.xml template
|
||||
template: src=web.xml dest={{ smartgears_instance_path }}/webapps/{{ java_rproxy_service_name }}/WEB-INF/web.xml mode=0440
|
||||
notify: Restart smartgears
|
||||
|
||||
|
||||
# TODO: unarchive the war file and install the web.xml.
|
||||
|
||||
become: True
|
||||
become_user: '{{ d4science_user }}'
|
||||
when: java_rproxy_service_install
|
||||
tags: [ 'smartgears', 'java_rproxy_service', 'tomcat' ]
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
||||
<display-name>{{ java_rproxy_display_name }}</display-name>
|
||||
{% for servlet in java_rproxy_targets %}
|
||||
<servlet>
|
||||
<servlet-name>{{ servlet.servlet_name }}</servlet-name>
|
||||
<servlet-class>org.mitre.dsmiley.httpproxy.ProxyServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>targetUri</param-name>
|
||||
<param-value>{{ servlet. target_uri }}</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>log</param-name>
|
||||
<param-value>{{ servlet.log }}</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>forwardip</param-name>
|
||||
<param-value>{{ servlet.forwardip }}</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>preserveHost</param-name>
|
||||
<param-value>{{ servlet.preserve_host }}</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>preserveCookies</param-name>
|
||||
<param-value>{{ servlet.preserve_cookies }}</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>http.protocol.handle-redirects</param-name>
|
||||
<param-value>{{ servlet.handle_redirects }}</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>http.socket.timeout</param-name>
|
||||
<param-value>{{ servlet.socket_timeout }}</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>http.read.timeout</param-name>
|
||||
<param-value>{{ servlet.read_timeout }}</param-value>
|
||||
</init-param>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>{{ servlet.servlet_name }}</servlet-name>
|
||||
{% for pattern in servlet.url_patterns %}
|
||||
<url-pattern>{{ pattern }}</url-pattern>
|
||||
{% endfor %}
|
||||
</servlet-mapping>
|
||||
{% endfor %}
|
||||
</web-app>
|
Loading…
Reference in New Issue