-
Notifications
You must be signed in to change notification settings - Fork 5
/
minitruco.yml
83 lines (74 loc) · 2.4 KB
/
minitruco.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
- hosts: production
remote_user: "{{ admin_user }}"
# Notice that just rebuilidng the jar from latest sources is enough for the server to be softly
# redeployed with minimal downtime (<5s)
#
# see https://github.com/chesterbr/minitruco-android/blob/main/launcher.sh
handlers:
- name: reload supervisor # without restarting other supervised apps
shell: "supervisorctl update; supervisorctl reread"
become: yes
roles:
- role: chesterbr.vault
tasks:
- name: Install prereq packages
apt: name={{ packages }} state=present
become: yes
vars:
packages:
- git
- openjdk-21-jdk
- supervisor
- inotify-tools # Used by launcher.sh
tags:
- configure_supervisor
- name: Configure app to run under supervisor (from source dir)
template: src=templates/minitruco.conf.supervisor.j2 dest=/etc/supervisor/conf.d/minitruco.conf
become: yes
notify: reload supervisor
tags:
- configure_supervisor
- name: Configure logrotate to rotate logs, see file for retention details
become: yes
template:
src: templates/minitruco_logrotate.conf.j2
dest: /etc/logrotate.d/minitruco_logrotate.conf
owner: "root"
group: "root"
mode: '0644'
- name: Configure ufw (firewall) to allow incoming game connections, limiting max number
become: true
ufw:
rule: limit
proto: tcp
port: 6912
src: any
direction: in
tags:
- firewall
- name: Ensure code repository is at latest version
git: repo=https://github.com/chesterbr/minitruco-android.git
accept_hostkey=true
dest={{ minitruco_checkout_dir }}
version=main
become: yes
become_user: "{{ server_user }}"
tags:
- update_app
- name: Build the .jar
shell : ./gradlew --priority low --no-daemon -x test --settings-file server-only-gradle-settings build
args:
chdir: "{{ minitruco_checkout_dir }}"
become: yes
become_user: "{{ server_user }}"
tags:
- update_app
- name: Touch the .jar to ensure we get a soft reload even if nothing has changed
become: yes
become_user: "{{ server_user }}"
file:
path: "{{ minitruco_checkout_dir }}/server/build/libs/server.jar"
state: touch
tags:
- update_app