Skip to content

File tree

5 files changed

+47
-33
lines changed

5 files changed

+47
-33
lines changed

vagrant/provisioning/roles/mystamps-app/files/mystamps.conf

-5
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description = MyStamps site
3+
After = syslog.target
4+
5+
[Service]
6+
User = mystamps
7+
WorkingDirectory = /data/mystamps
8+
EnvironmentFile = /data/mystamps/mystamps.conf
9+
ExecStart = /usr/bin/java $JAVA_OPTS -jar /data/mystamps/mystamps.war
10+
SuccessExitStatus = 143
11+
12+
[Install]
13+
WantedBy = multi-user.target

vagrant/provisioning/roles/mystamps-app/handlers/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
---
22

3+
# TODO: use systemd module (requires ansible 2.2+)
4+
- name: Reloading systemd service
5+
command:
6+
systemctl daemon-reload
7+
38
- name: Restarting mystamps service
49
service:
510
name: mystamps

vagrant/provisioning/roles/mystamps-app/tasks/main.yml

+26-28
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,28 @@
1212
notify:
1313
- Restarting mystamps service
1414

15-
- name: Creating init-script
16-
file:
17-
src: /data/mystamps/mystamps.war
18-
dest: /etc/init.d/mystamps
19-
state: link
15+
- name: Creating mystamps.conf
16+
template:
17+
src: mystamps.conf
18+
dest: /data/mystamps/mystamps.conf
19+
force: yes
20+
backup: no
21+
owner: mystamps
22+
group: mystamps
23+
mode: '0644'
24+
notify:
25+
- Restarting mystamps service
26+
27+
- name: Creating mystamps.service
28+
copy:
29+
src: mystamps.service
30+
dest: /etc/systemd/system/mystamps.service
31+
owner: root
32+
group: root
33+
mode: '0644'
34+
notify:
35+
- Reloading systemd service
36+
- Restarting mystamps service
2037

2138
- name: Creating /data/logs
2239
file:
@@ -26,18 +43,17 @@
2643
mode: '0755'
2744
state: directory
2845

29-
- name: Creating /data/uploads
46+
- name: Creating /data/heap-dumps
3047
file:
31-
path: /data/uploads
48+
path: /data/heap-dumps
3249
owner: mystamps
3350
group: mystamps
3451
mode: '0755'
3552
state: directory
36-
when: profile == 'prod'
3753

38-
- name: Creating /data/heap-dumps
54+
- name: Creating /data/uploads
3955
file:
40-
path: /data/heap-dumps
56+
path: /data/uploads
4157
owner: mystamps
4258
group: mystamps
4359
mode: '0755'
@@ -66,24 +82,6 @@
6682
- Restarting mystamps service
6783
when: profile == 'prod'
6884

69-
- name: Creating mystamps.conf
70-
copy:
71-
src: mystamps.conf
72-
dest: /data/mystamps/mystamps.conf
73-
mode: '0644'
74-
notify:
75-
- Restarting mystamps service
76-
when: profile == 'prod'
77-
78-
- name: Creating /var/log/mystamps
79-
file:
80-
path: /var/log/mystamps
81-
owner: mystamps
82-
group: mystamps
83-
mode: '0755'
84-
state: directory
85-
when: profile == 'prod'
86-
8785
- name: Running service
8886
service:
8987
name: mystamps
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file is being read and used by /etc/systemd/system/mystamps.service
2+
SPRING_PROFILES_ACTIVE={{ profile }}
3+
JAVA_OPTS=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/heap-dumps -XX:+UseCompressedOops -Dsun.rmi.dgc.client.gcInterval=86400000 -Dsun.rmi.dgc.server.gcInterval=86400000 -Djava.security.egd=file:/dev/./urandom -Xmx128m

0 commit comments

Comments
 (0)