Skip to content

Commit 1078a74

Browse files
authored
Merge pull request #51 from OpenGeoscience/ansible1
Ansible improvements
2 parents 6bd01a6 + 7b25b72 commit 1078a74

6 files changed

Lines changed: 306 additions & 15 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
- name: reset geoserver owner
2-
command: chown -R tomcat7:tomcat7 /var/lib/tomcat7/webapps/geoserver/data
2+
command: chown -R tomcat7:vagrant '/data/geodata'
33
sudo: yes
44

55
- name: reset geoserver permissions
6-
command: chmod -R g+rws /var/lib/tomcat7/webapps/geoserver/data
6+
command: chmod -R g+rws '/data/geodata/'
77
sudo: yes

ansible/roles/dataqs/tasks/main.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
file: path=/home/{{deploy_user}}/epigeonode state=directory mode=1775 owner={{deploy_user}} group=tomcat7
3030
sudo: yes
3131

32-
- name: create geoserver data directory
33-
file: path=/var/lib/tomcat7/webapps/geoserver/data recurse=yes owner=tomcat7 group=tomcat7 state=directory mode=g+rws
32+
- name: Create temp data directory
33+
file: path=/data/tmp state=directory mode=1775 owner={{deploy_user}} group=tomcat7
3434
sudo: yes
3535

3636
- include: geoserver_permissions.yml
@@ -92,10 +92,6 @@
9292
command: "{{ app_code_dir }}/venvs/geonode/bin/python {{app_code_dir}}/venvs/geonode/src/dataqs/dataqs/gistemp/gistemp.py"
9393
ignore_errors: yes
9494

95-
- name: create geoserver data directory
96-
file: path=/var/lib/tomcat7/webapps/geoserver/data/data/geonode/forecast_io_airtemp recurse=yes owner=tomcat7 group=tomcat7 state=directory mode=774
97-
sudo: yes
98-
9995
- include: geoserver_permissions.yml
10096

10197
- name: Create the forecastio coverage store

ansible/roles/dataqs/templates/dataq_settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@
6060
GPM_ACCOUNT = 'your_gpm_email_account'
6161

6262
# Location of GeoServer data directory
63-
GS_DATA_DIR = '/var/lib/tomcat7/webapps/geoserver/data'
63+
GS_DATA_DIR = '/data/geodata/data'
6464

6565
# Directory where temporary data_queues geoprocessing files should
6666
# be downloaded
67-
GS_TMP_DIR = '/tmp'
67+
GS_TMP_DIR = '/data/tmp'
6868

6969
# Time to wait before updating Geoserver mosaic (keep at 0 unless Geoserver
7070
# is on a different server.

ansible/roles/geoserver/tasks/main.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
###
2-
# Install GeoServer from Custom GeoNode Build
2+
# Install GeoServer from Custom GeoNode Build
33
#
44
---
55

66
- name: ensure apt cache is up to date
77
apt: update_cache=yes
88
sudo: yes
99

10-
- name: install Tomcat
10+
- name: install Tomcat
1111
apt: pkg={{ item }} state=present
1212
sudo: yes
1313
with_items:
1414
- tomcat7
15+
- unzip
1516

1617
- name: copy the Tomcat setenv.sh file to /usr/share/tomcat7/bin
1718
template: src=setenv.sh dest=/usr/share/tomcat7/bin/setenv.sh
@@ -21,16 +22,45 @@
2122
template: src=tomcat7 dest=/etc/default/tomcat7
2223
sudo: yes
2324

25+
- name: Create Geoserver data directory
26+
file: path=/data/ state=directory
27+
sudo: yes
28+
2429
- name: Download Geoserver (remote)
2530
sudo: yes
2631
get_url:
27-
dest=/var/lib/tomcat7/webapps/geoserver.war
32+
dest=/tmp/geoserver.war
2833
url={{ geoserver_url }}
2934
owner=0
3035
group=0
3136
mode=0644
3237

38+
- name: Unzip Geoserver WAR file
39+
command: unzip -o -d '/tmp/geoserver' '/tmp/geoserver.war'
40+
sudo: yes
41+
42+
- name: Copy Geoserver web.xml file with custom data directory
43+
template: src=web.xml dest=/tmp/geoserver/WEB-INF/web.xml
44+
sudo: yes
45+
46+
- name: Move data files
47+
command: mv -n '/tmp/geoserver/data' '/data/geodata'
48+
sudo: yes
49+
50+
- name: Move web app
51+
command: mv -n '/tmp/geoserver' '/var/lib/tomcat7/webapps/geoserver'
52+
sudo: yes
53+
54+
- name: reset geoserver owner
55+
file:
56+
state: directory
57+
owner: tomcat7
58+
group: "{{ deploy_user }}"
59+
path: "/data"
60+
mode: 0774
61+
recurse: true
62+
sudo: yes
63+
3364
- name: Restart Tomcat
3465
service: name=tomcat7 state=restarted
3566
sudo: yes
36-
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CATALINA_OPTS="$CATALINA_OPTS -Xms2048m -Xmx2048m -XX:MaxPermSize=256m"
1+
CATALINA_OPTS="$CATALINA_OPTS -Xms4096m -Xmx4096m -XX:MaxPermSize=512m"
Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
3+
<web-app>
4+
<display-name>GeoServer</display-name>
5+
6+
<context-param>
7+
<param-name>serviceStrategy</param-name>
8+
<!-- Meaning of the different values :
9+
10+
PARTIAL-BUFFER2
11+
- Partially buffers the first xKb to disk. Once that has buffered, the the
12+
result is streamed to the user. This will allow for most errors to be caught
13+
early.
14+
15+
BUFFER
16+
- stores the entire response in memory first, before sending it off to
17+
the user (may run out of memory)
18+
19+
SPEED
20+
- outputs directly to the response (and cannot recover in the case of an
21+
error)
22+
23+
FILE
24+
- outputs to the local filesystem first, before sending it off to the user
25+
-->
26+
<param-value>FILE</param-value>
27+
</context-param>
28+
29+
<!-- If true, enable versioning datastore as well -->
30+
<context-param>
31+
<param-name>enableVersioning</param-name>
32+
<param-value>true</param-value>
33+
</context-param>
34+
35+
<context-param>
36+
<!-- see comments on the PARTIAL-BUFFER strategy -->
37+
<!-- this sets the size of the buffer. default is "50" = 50kb -->
38+
<!-- For GeoNode this has been changed to 5Mb to avoid invalid GetCapabilities responses -->
39+
<param-name>PARTIAL_BUFFER_STRATEGY_SIZE</param-name>
40+
<param-value>5000</param-value>
41+
</context-param>
42+
43+
<!--Can be true or false (defaults to: false). -->
44+
<!--When true the JSONP (text/javascript) output format is enabled -->
45+
<!--
46+
<context-param>
47+
<param-name>ENABLE_JSONP</param-name>
48+
<param-value>true</param-value>
49+
</context-param>
50+
-->
51+
<!--
52+
<context-param>
53+
<param-name>PROXY_BASE_URL</param-name>
54+
<param-value>http://82.58.146.45/geoserver</param-value>
55+
</context-param>
56+
-->
57+
58+
<context-param>
59+
<param-name>GEOSERVER_DATA_DIR</param-name>
60+
<param-value>/data/geodata</param-value>
61+
</context-param>
62+
63+
<!-- pick up all spring application contexts -->
64+
<context-param>
65+
<param-name>contextConfigLocation</param-name>
66+
<param-value>classpath*:/applicationContext.xml classpath*:/applicationSecurityContext.xml</param-value>
67+
</context-param>
68+
69+
<filter>
70+
<filter-name>FlushSafeFilter</filter-name>
71+
<filter-class>org.geoserver.filters.FlushSafeFilter</filter-class>
72+
</filter>
73+
74+
<filter>
75+
<filter-name>Set Character Encoding</filter-name>
76+
<filter-class>org.vfny.geoserver.filters.SetCharacterEncodingFilter</filter-class>
77+
<init-param>
78+
<param-name>encoding</param-name>
79+
<param-value>UTF-8</param-value>
80+
</init-param>
81+
</filter>
82+
83+
<filter>
84+
<filter-name>SessionDebugger</filter-name>
85+
<filter-class>org.geoserver.filters.SessionDebugFilter</filter-class>
86+
</filter>
87+
88+
<filter>
89+
<filter-name>filterChainProxy</filter-name>
90+
<filter-class> org.springframework.web.filter.DelegatingFilterProxy</filter-class>
91+
</filter>
92+
93+
<filter>
94+
<filter-name>GZIP Compression Filter</filter-name>
95+
<filter-class>org.geoserver.filters.GZIPFilter</filter-class>
96+
<init-param>
97+
<!-- The compressed-types parameter is a comma-separated list of regular expressions.
98+
If a mime type matches any of the regular expressions then it will be compressed.
99+
-->
100+
<param-name>compressed-types</param-name>
101+
<param-value>text/.*,.*xml.*,application/json,application/x-javascript</param-value>
102+
</init-param>
103+
</filter>
104+
105+
<filter>
106+
<filter-name>Request Logging Filter</filter-name>
107+
<filter-class>org.geoserver.filters.LoggingFilter</filter-class>
108+
<init-param>
109+
<!-- The 'enabled' parameter is a boolean value, "true" (case-insensitive) for true or
110+
any other value for false. If enabled, then the logging will be performed;
111+
otherwise the logging filter will have no effect. If not specified, this
112+
parameter defaults to false.
113+
-->
114+
<param-name>enabled</param-name>
115+
<param-value>false</param-value>
116+
</init-param>
117+
<init-param>
118+
<!-- The 'log-request-bodies' parameter is a boolean value, "true" (case-insensitive) for
119+
true or any other value for false. If enabled, then the logging will include the body
120+
of POST and PUT requests. If not specified, this parameter defaults to false.
121+
Note that this may noticeably degrade responsiveness of your geoserver since it will
122+
not begin to process requests until the entire request body has been received by the
123+
server.
124+
-->
125+
<param-name>log-request-bodies</param-name>
126+
<param-value>false</param-value>
127+
</init-param>
128+
</filter>
129+
130+
<filter>
131+
<filter-name>Advanced Dispatch Filter</filter-name>
132+
<filter-class>org.geoserver.platform.AdvancedDispatchFilter</filter-class>
133+
<!--
134+
This filter allows for a single mapping to the spring dispatcher. However using /* as a mapping
135+
in a servlet mapping causes the servlet path to be "/" of the request. This causes problems with
136+
library like wicket and restlet. So this filter fakes the servlet path by assuming the first
137+
component of the path is the mapped path.
138+
-->
139+
</filter>
140+
141+
<filter>
142+
<filter-name>Spring Delegating Filter</filter-name>
143+
<filter-class>org.geoserver.filters.SpringDelegatingFilter</filter-class>
144+
<!--
145+
This filter allows for filters to be loaded via spring rather than
146+
registered here in web.xml. One thing to note is that for such filters
147+
init() is not called. INstead any initialization is performed via spring
148+
ioc.
149+
-->
150+
</filter>
151+
152+
<filter>
153+
<filter-name>Thread locals cleanup filter</filter-name>
154+
<filter-class>org.geoserver.filters.ThreadLocalsCleanupFilter</filter-class>
155+
<!--
156+
This filter cleans up thread locals Geotools is setting up for concurrency and performance
157+
reasons
158+
-->
159+
</filter>
160+
161+
<!--
162+
THIS FILTER MUST BE THE FIRST ONE, otherwise we end up with ruined chars in the input from the GUI
163+
See the "Note" in the Tomcat character encoding guide:
164+
http://wiki.apache.org/tomcat/FAQ/CharacterEncoding
165+
-->
166+
<filter-mapping>
167+
<filter-name>Set Character Encoding</filter-name>
168+
<url-pattern>/*</url-pattern>
169+
</filter-mapping>
170+
171+
<filter-mapping>
172+
<filter-name>FlushSafeFilter</filter-name>
173+
<url-pattern>/*</url-pattern>
174+
</filter-mapping>
175+
176+
<filter-mapping>
177+
<filter-name>SessionDebugger</filter-name>
178+
<url-pattern>/*</url-pattern>
179+
</filter-mapping>
180+
181+
<filter-mapping>
182+
<filter-name>GZIP Compression Filter</filter-name>
183+
<url-pattern>/*</url-pattern>
184+
</filter-mapping>
185+
186+
<filter-mapping>
187+
<filter-name>Request Logging Filter</filter-name>
188+
<url-pattern>/*</url-pattern>
189+
</filter-mapping>
190+
191+
<!--
192+
If you want to use your security system comment out this one too
193+
-->
194+
<filter-mapping>
195+
<filter-name>filterChainProxy</filter-name>
196+
<url-pattern>/*</url-pattern>
197+
</filter-mapping>
198+
199+
<filter-mapping>
200+
<filter-name>Set Character Encoding</filter-name>
201+
<url-pattern>/*</url-pattern>
202+
</filter-mapping>
203+
204+
<filter-mapping>
205+
<filter-name>Advanced Dispatch Filter</filter-name>
206+
<url-pattern>/*</url-pattern>
207+
</filter-mapping>
208+
209+
<filter-mapping>
210+
<filter-name>Spring Delegating Filter</filter-name>
211+
<url-pattern>/*</url-pattern>
212+
</filter-mapping>
213+
214+
<filter-mapping>
215+
<filter-name>Thread locals cleanup filter</filter-name>
216+
<url-pattern>/*</url-pattern>
217+
</filter-mapping>
218+
219+
<!-- general initializer, should be first thing to execute -->
220+
<listener>
221+
<listener-class>org.geoserver.GeoserverInitStartupListener</listener-class>
222+
</listener>
223+
224+
<!-- logging initializer, should execute before spring context startup -->
225+
<listener>
226+
<listener-class>org.geoserver.logging.LoggingStartupContextListener</listener-class>
227+
</listener>
228+
229+
<!-- spring context loader -->
230+
<listener>
231+
<listener-class>org.geoserver.platform.GeoServerContextLoaderListener</listener-class>
232+
</listener>
233+
234+
<!-- http session listener proxy -->
235+
<listener>
236+
<listener-class>org.geoserver.platform.GeoServerHttpSessionListenerProxy</listener-class>
237+
</listener>
238+
239+
<!-- spring dispatcher servlet, dispatches all incoming requests -->
240+
<servlet>
241+
<servlet-name>dispatcher</servlet-name>
242+
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
243+
</servlet>
244+
245+
<!-- single mapping to spring, this only works properly if the advanced dispatch filter is
246+
active -->
247+
<servlet-mapping>
248+
<servlet-name>dispatcher</servlet-name>
249+
<url-pattern>/*</url-pattern>
250+
</servlet-mapping>
251+
252+
<mime-mapping>
253+
<extension>xsl</extension>
254+
<mime-type>text/xml</mime-type>
255+
</mime-mapping>
256+
<mime-mapping>
257+
<extension>sld</extension>
258+
<mime-type>text/xml</mime-type>
259+
</mime-mapping>
260+
261+
<welcome-file-list>
262+
<welcome-file>index.html</welcome-file>
263+
</welcome-file-list>
264+
265+
</web-app>

0 commit comments

Comments
 (0)