update launcher to supysonic-server
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
vincent 2021-11-14 11:32:06 +01:00
parent 8856267b23
commit 2d9ed43ca5
7 changed files with 25 additions and 35 deletions

View File

@ -1,9 +1,7 @@
---
# defaults file for supysonic
supysonic_name: supysonic
source_location: /srv/
venv_location: /opt/venv/
supysonic_venv_name: "{{supysonic_name}}"
exec_user: root

View File

@ -1,16 +1,14 @@
---
# handlers file for chainetv
- name: Reload systemd
systemd:
daemon_reload: yes
become: yes
- name: restart supysonic service
systemd:
name: "gunicorn-{{supysonic_name}}.service" # not required. Name of the service. When using in a chroot environment you always need to specify the full name i.e. (crond.service).
name: "supysonic-server.service" # not required. Name of the service. When using in a chroot environment you always need to specify the full name i.e. (crond.service).
state: restarted # not required. choices: reloaded;restarted;started;stopped. C(started)/C(stopped) are idempotent actions that will not run commands unless necessary. C(restarted) will always bounce the service. C(reloaded) will always reload.
enabled: true
become: yes

View File

@ -4,22 +4,6 @@
- name: select specific Database tasks
include_tasks: "database_{{supysonic_DB_type}}.yml"
- name: stat location folder
stat:
path: "{{source_location}}/{{supysonic_name}}" # required. The full path of the file/object to get the facts of.
register: location_stat
- name: install source file if not exist
git:
dest: "{{source_location}}/{{supysonic_name}}" # required. The path of where the repository should be checked out. This parameter is required, unless C(clone) is set to C(no).
repo: "{{supysonic_repo}}" # required. git, SSH, or HTTP(S) protocol address of the git repository.
clone: yes # not required. If C(no), do not clone the repository if it does not exist locally
version: "{{supysonic_repo_branch}}"
become: yes
when: location_stat.stat.exists == false or supysonic_force_site_update == true
notify:
- restart supysonic service
- name: create folder in var
file:
path: "/var/{{supysonic_name}}" # required. Path to the file being managed.
@ -32,12 +16,15 @@
state: directory
mode: 0777
become: yes
notify:
- restart supysonic service
- name: create venv
pip:
name: "file://{{source_location}}/{{supysonic_name}}"
name: "git+{{supysonic_repo}}"
virtualenv: "{{venv_location}}{{supysonic_venv_name}}"
virtualenv_command: /usr/bin/python -m venv
state: "{{'forcereinstall' if supysonic_force_site_update ==true else 'present'}}"
become: yes
- name: install sql client
@ -47,6 +34,7 @@
- pymysql
- psycopg2
become: yes
- name: apply config template
template:
dest: "/etc/supysonic" # required. Location to render the template to on the remote machine.
@ -64,8 +52,8 @@
- name: apply systemd service template
template:
dest: "/etc/systemd/system/gunicorn-{{supysonic_name}}.service" # required. Location to render the template to on the remote machine.
src: "systemd/gunicorn.service.j2" # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path.
dest: "/etc/systemd/system/supysonic-server.service" # required. Location to render the template to on the remote machine.
src: "systemd/supysonic-server.service.j2" # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path.
become: yes
notify:
- Reload systemd
@ -89,7 +77,7 @@
- name: enable supysonic service
systemd:
name: "gunicorn-{{supysonic_name}}.service" # not required. Name of the service. When using in a chroot environment you always need to specify the full name i.e. (crond.service).
name: "supysonic-server.service" # not required. Name of the service. When using in a chroot environment you always need to specify the full name i.e. (crond.service).
enabled: true
state: started
become: yes

View File

@ -7,7 +7,7 @@ User=root
Restart=always
RestartSec=2s
Group=root
WorkingDirectory={{source_location}}/{{supysonic_name}}
WorkingDirectory=/var/{{supysonic_name}}
ExecStart={{venv_location}}{{supysonic_venv_name}}/bin/python -m supysonic.daemon

View File

@ -3,12 +3,11 @@ Description=gunicorn daemon for {{supysonic_name}}
After=network.target {{ 'postgresql.service' if supysonic_DB_type == 'postgres' else mysqld.service }}
[Service]
PIDFile=/run/gunicorn-{{supysonic_name}}/pid
PIDFile=/run/{{supysonic_name}}.pid
User={{exec_user}}
Group={{exec_group}}
RuntimeDirectory=gunicorn-{{supysonic_name}}
WorkingDirectory={{source_location}}/{{supysonic_name}}/cgi-bin
ExecStart={{venv_location}}{{supysonic_venv_name}}/bin/gunicorn -b 0.0.0.0:8001 --workers=4 --pid /run/gunicorn-{{supysonic_name}}/pid server:app
WorkingDirectory=/var/{{supysonic_name}}
ExecStart={{venv_location}}{{supysonic_venv_name}}/bin/supysonic-server -p 8001 --threads 4
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true

0
tests/inventory Normal file
View File

7
tests/test.yml Normal file
View File

@ -0,0 +1,7 @@
---
- hosts: all
vars:
supysonic_force_site_update: True
become: True
roles:
- supysonic