Update to 2021-12-31 14:05

This commit is contained in:
Daniel Berteaud
2021-12-31 14:05:49 +01:00
parent 489c627e9d
commit 6430e931d0
46 changed files with 856 additions and 51 deletions

View File

@@ -1,8 +0,0 @@
---
wbo_id: 1
wbo_port: 8095
wbo_src_ip: []
wbo_root_dir: /opt/wbo_{{ wbo_id }}
wbo_git_url: https://github.com/lovasoa/whitebophir.git

View File

@@ -1,4 +0,0 @@
---
- name: restart wbo
service: name=wbo-{{ wbo_id }} state=restarted

View File

@@ -1,3 +0,0 @@
---
dependencies:
- role: repo_nodejs

View File

@@ -1,57 +0,0 @@
---
- name: Install dependencies
yum:
name:
- nodejs
- git
tags: wbo
- import_tasks: ../includes/create_system_user.yml
vars:
- user: wbo_{{ wbo_id }}
- home: "{{ wbo_root_dir }}"
- comment: "Online collaborative Whiteboard {{ wbo_id }}"
tags: wbo
- name: Clone wbo repo
git:
repo: "{{ wbo_git_url }}"
dest: "{{ wbo_root_dir }}/app"
force: True
notify: restart wbo
register: wbo_git
tags: wbo
- name: Install wbo
command: npm i
args:
chdir: "{{ wbo_root_dir }}/app"
when: wbo_git.changed
tags: wbo
- name: Set permissions on server data dir
file: path={{ wbo_root_dir }}/app/server-data owner=wbo_{{ wbo_id }} mode=700
tags: wbo
- name: Deploy systemd unit
template: src=wbo.service.j2 dest=/etc/systemd/system/wbo-{{ wbo_id }}.service
register: wbo_unit
tags: wbo
- name: Reload systemd
systemd: daemon_reload=True
when: wbo_unit.changed
tags: wbo
- name: Handle wbo port
iptables_raw:
name: wbo_port_{{ wbo_id }}
state: "{{ (wbo_src_ip | length > 0) | ternary('present','absent') }}"
rules: "-A INPUT -m state --state NEW -p tcp --dport {{ wbo_port }} -s {{ wbo_src_ip | join(',') }} -j ACCEPT"
when: iptables_manage | default(True)
tags: wbo
- name: Start and enable wbo daemon
service: name=wbo-{{ wbo_id }} state=started enabled=True
tags: wbo

View File

@@ -1,21 +0,0 @@
[Unit]
Description=Online collaborative Whiteboard (Instance {{ wbo_id }})
After=syslog.target network.target
[Service]
Type=simple
User=wbo_{{ wbo_id }}
Group=wbo_{{ wbo_id }}
Environment=PORT={{ wbo_port }}
Environment=NODE_ENV='production'
ExecStart=/bin/node {{ wbo_root_dir }}/app/server/server.js
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=full
ProtectHome=yes
NoNewPrivileges=yes
MemoryLimit=512M
Restart=on-failure
[Install]
WantedBy=multi-user.target