update launcher to supysonic-server
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
8856267b23
commit
2d9ed43ca5
@ -1,9 +1,7 @@
|
|||||||
---
|
---
|
||||||
# defaults file for supysonic
|
# defaults file for supysonic
|
||||||
|
|
||||||
|
|
||||||
supysonic_name: supysonic
|
supysonic_name: supysonic
|
||||||
source_location: /srv/
|
|
||||||
venv_location: /opt/venv/
|
venv_location: /opt/venv/
|
||||||
supysonic_venv_name: "{{supysonic_name}}"
|
supysonic_venv_name: "{{supysonic_name}}"
|
||||||
exec_user: root
|
exec_user: root
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
---
|
---
|
||||||
# handlers file for chainetv
|
# handlers file for chainetv
|
||||||
|
|
||||||
|
|
||||||
- name: Reload systemd
|
- name: Reload systemd
|
||||||
systemd:
|
systemd:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
|
|
||||||
- name: restart supysonic service
|
- name: restart supysonic service
|
||||||
systemd:
|
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.
|
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
|
enabled: true
|
||||||
become: yes
|
become: yes
|
||||||
|
@ -4,22 +4,6 @@
|
|||||||
- name: select specific Database tasks
|
- name: select specific Database tasks
|
||||||
include_tasks: "database_{{supysonic_DB_type}}.yml"
|
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
|
- name: create folder in var
|
||||||
file:
|
file:
|
||||||
path: "/var/{{supysonic_name}}" # required. Path to the file being managed.
|
path: "/var/{{supysonic_name}}" # required. Path to the file being managed.
|
||||||
@ -32,12 +16,15 @@
|
|||||||
state: directory
|
state: directory
|
||||||
mode: 0777
|
mode: 0777
|
||||||
become: yes
|
become: yes
|
||||||
|
notify:
|
||||||
|
- restart supysonic service
|
||||||
|
|
||||||
- name: create venv
|
- name: create venv
|
||||||
pip:
|
pip:
|
||||||
name: "file://{{source_location}}/{{supysonic_name}}"
|
name: "git+{{supysonic_repo}}"
|
||||||
virtualenv: "{{venv_location}}{{supysonic_venv_name}}"
|
virtualenv: "{{venv_location}}{{supysonic_venv_name}}"
|
||||||
virtualenv_command: /usr/bin/python -m venv
|
virtualenv_command: /usr/bin/python -m venv
|
||||||
|
state: "{{'forcereinstall' if supysonic_force_site_update ==true else 'present'}}"
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
- name: install sql client
|
- name: install sql client
|
||||||
@ -47,6 +34,7 @@
|
|||||||
- pymysql
|
- pymysql
|
||||||
- psycopg2
|
- psycopg2
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
- name: apply config template
|
- name: apply config template
|
||||||
template:
|
template:
|
||||||
dest: "/etc/supysonic" # required. Location to render the template to on the remote machine.
|
dest: "/etc/supysonic" # required. Location to render the template to on the remote machine.
|
||||||
@ -64,8 +52,8 @@
|
|||||||
|
|
||||||
- name: apply systemd service template
|
- name: apply systemd service template
|
||||||
template:
|
template:
|
||||||
dest: "/etc/systemd/system/gunicorn-{{supysonic_name}}.service" # required. Location to render the template to on the remote machine.
|
dest: "/etc/systemd/system/supysonic-server.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.
|
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
|
become: yes
|
||||||
notify:
|
notify:
|
||||||
- Reload systemd
|
- Reload systemd
|
||||||
@ -89,7 +77,7 @@
|
|||||||
|
|
||||||
- name: enable supysonic service
|
- name: enable supysonic service
|
||||||
systemd:
|
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
|
enabled: true
|
||||||
state: started
|
state: started
|
||||||
become: yes
|
become: yes
|
||||||
|
@ -7,7 +7,7 @@ User=root
|
|||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=2s
|
RestartSec=2s
|
||||||
Group=root
|
Group=root
|
||||||
WorkingDirectory={{source_location}}/{{supysonic_name}}
|
WorkingDirectory=/var/{{supysonic_name}}
|
||||||
ExecStart={{venv_location}}{{supysonic_venv_name}}/bin/python -m supysonic.daemon
|
ExecStart={{venv_location}}{{supysonic_venv_name}}/bin/python -m supysonic.daemon
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,12 +3,11 @@ Description=gunicorn daemon for {{supysonic_name}}
|
|||||||
After=network.target {{ 'postgresql.service' if supysonic_DB_type == 'postgres' else mysqld.service }}
|
After=network.target {{ 'postgresql.service' if supysonic_DB_type == 'postgres' else mysqld.service }}
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
PIDFile=/run/gunicorn-{{supysonic_name}}/pid
|
PIDFile=/run/{{supysonic_name}}.pid
|
||||||
User={{exec_user}}
|
User={{exec_user}}
|
||||||
Group={{exec_group}}
|
Group={{exec_group}}
|
||||||
RuntimeDirectory=gunicorn-{{supysonic_name}}
|
WorkingDirectory=/var/{{supysonic_name}}
|
||||||
WorkingDirectory={{source_location}}/{{supysonic_name}}/cgi-bin
|
ExecStart={{venv_location}}{{supysonic_venv_name}}/bin/supysonic-server -p 8001 --threads 4
|
||||||
ExecStart={{venv_location}}{{supysonic_venv_name}}/bin/gunicorn -b 0.0.0.0:8001 --workers=4 --pid /run/gunicorn-{{supysonic_name}}/pid server:app
|
|
||||||
ExecReload=/bin/kill -s HUP $MAINPID
|
ExecReload=/bin/kill -s HUP $MAINPID
|
||||||
ExecStop=/bin/kill -s TERM $MAINPID
|
ExecStop=/bin/kill -s TERM $MAINPID
|
||||||
PrivateTmp=true
|
PrivateTmp=true
|
0
tests/inventory
Normal file
0
tests/inventory
Normal file
7
tests/test.yml
Normal file
7
tests/test.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
vars:
|
||||||
|
supysonic_force_site_update: True
|
||||||
|
become: True
|
||||||
|
roles:
|
||||||
|
- supysonic
|
Loading…
Reference in New Issue
Block a user