Finishes todos for proper service creation
This commit is contained in:
@@ -7,13 +7,9 @@ Currently, the playbook will:
|
|||||||
* Install dependencies (nodejs, caddy, unzip)
|
* Install dependencies (nodejs, caddy, unzip)
|
||||||
* Create a foundry user/group
|
* Create a foundry user/group
|
||||||
* Extract the Foundry app onto the remote server
|
* Extract the Foundry app onto the remote server
|
||||||
|
* Set up a data directory for Foundry to use
|
||||||
* Configure caddy to reverse proxy the app
|
* Configure caddy to reverse proxy the app
|
||||||
|
* Set up a systemd unit to run the app
|
||||||
Things it still needs:
|
|
||||||
* Unit file to run the app
|
|
||||||
* Configuration file for Foundry itself
|
|
||||||
* A data directory for Foundry to use
|
|
||||||
|
|
||||||
|
|
||||||
# Usage instructions
|
# Usage instructions
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,22 @@
|
|||||||
environment:
|
environment:
|
||||||
DATA_DIRECTORY: /home/foundry/data
|
DATA_DIRECTORY: /home/foundry/data
|
||||||
tasks:
|
tasks:
|
||||||
- name: Apt repos
|
- name: Node GPG keys
|
||||||
shell: |
|
apt_key:
|
||||||
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
|
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
|
||||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
|
state: present
|
||||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list
|
- name: Caddy GPG keys
|
||||||
|
apt_key:
|
||||||
|
url: https://dl.cloudsmith.io/public/caddy/stable/gpg.key
|
||||||
|
state: present
|
||||||
|
- name: Node apt repo
|
||||||
|
apt_repository:
|
||||||
|
repo: deb https://deb.nodesource.com/node_14.x focal main
|
||||||
|
state: present
|
||||||
|
- name: Caddy apt repo
|
||||||
|
apt_repository:
|
||||||
|
repo: deb https://dl.cloudsmith.io/public/caddy/stable/deb/ubuntu focal main
|
||||||
|
state: present
|
||||||
- name: Dependencies
|
- name: Dependencies
|
||||||
apt:
|
apt:
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
@@ -34,18 +45,50 @@
|
|||||||
state: directory
|
state: directory
|
||||||
owner: foundry
|
owner: foundry
|
||||||
group: foundry
|
group: foundry
|
||||||
mode: '0644'
|
mode: '0744'
|
||||||
- name: Foundry archive
|
- name: Foundry data directory
|
||||||
unarchive:
|
file:
|
||||||
src: ./foundryvtt.zip
|
path: /home/foundry/foundry_data
|
||||||
dest: /home/foundry/foundry_app
|
state: directory
|
||||||
owner: foundry
|
owner: foundry
|
||||||
group: foundry
|
group: foundry
|
||||||
mode: '0644'
|
mode: '0744'
|
||||||
|
- name: Foundry archive
|
||||||
|
copy:
|
||||||
|
src: ./foundryvtt.zip
|
||||||
|
dest: /home/foundry/foundryvtt.zip
|
||||||
|
owner: foundry
|
||||||
|
group: foundry
|
||||||
|
mode: '0744'
|
||||||
|
register: foundry_archive
|
||||||
|
- name: Foundry extract
|
||||||
|
unarchive:
|
||||||
|
src: /home/foundry/foundryvtt.zip
|
||||||
|
dest: /home/foundry/foundry_app
|
||||||
|
remote_src: yes
|
||||||
|
owner: foundry
|
||||||
|
group: foundry
|
||||||
|
mode: '0744'
|
||||||
|
when: foundry_archive.changed
|
||||||
- name: Caddyfile
|
- name: Caddyfile
|
||||||
template:
|
template:
|
||||||
src: ./Caddyfile.j2
|
src: ./Caddyfile.j2
|
||||||
dest: /etc/caddy/Caddyfile
|
dest: /etc/caddy/Caddyfile
|
||||||
owner: root
|
owner: caddy
|
||||||
group: root
|
group: caddy
|
||||||
mode: '0644'
|
mode: '0744'
|
||||||
|
- name: Foundry unit file
|
||||||
|
copy:
|
||||||
|
src: ./foundryvtt.service
|
||||||
|
dest: /etc/systemd/system/foundryvtt.service
|
||||||
|
- name: Refresh systemd
|
||||||
|
systemd:
|
||||||
|
daemon_reload: yes
|
||||||
|
- name: Foundry service
|
||||||
|
systemd:
|
||||||
|
name: foundryvtt.service
|
||||||
|
state: restarted
|
||||||
|
- name: Caddy service
|
||||||
|
systemd:
|
||||||
|
name: caddy.service
|
||||||
|
state: restarted
|
||||||
|
|||||||
15
foundryvtt.service
Normal file
15
foundryvtt.service
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Foundry VTT
|
||||||
|
Documentation=https://foundryvtt.com
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=foundry
|
||||||
|
Group=foundry
|
||||||
|
ExecStart=/home/foundry/foundry_app/resources/app/main.js --dataPath=/home/foundry/foundry_data
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user