diff --git a/defaults/main.yml b/defaults/main.yml index ba9f403c6f3dd908c96981c8debedfb974d7bcab..4619417bce44b41a7927626e56c0d8111b8c1f61 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -15,6 +15,7 @@ funkwhale_nginx_max_body_size: 100M funkwhale_redis_managed: true funkwhale_api_ip: 127.0.0.1 funkwhale_api_port: 5000 +funkwhale_web_workers: 1 funkwhale_protocol: https funkwhale_settings_module: config.settings.production funkwhale_env_vars: [] diff --git a/handlers/main.yml b/handlers/main.yml index d15f22d5f467a80b4ad3f3143cecbab987f18850..f4b7666be378b863b331874842b67913a4a3c67e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -2,9 +2,16 @@ - name: restart funkwhale become: true service: - name: funkwhale.target + name: "{{ funkwhale_systemd_service_name }}.target" state: restarted +- name: reload funkwhale + become: true + shell: | + systemctl kill -s HUP {{ funkwhale_systemd_service_name }}-server + systemctl kill -s HUP {{ funkwhale_systemd_service_name }}-worker + systemctl restart {{ funkwhale_systemd_service_name }}-beat + - name: reload nginx become: true service: diff --git a/tasks/funkwhale.yml b/tasks/funkwhale.yml index 0fc178b9c239a8a171c5d05b3fb1a9f399fcf000..7ccdeaae61ffac248d15c97d137232bd602c8fa7 100644 --- a/tasks/funkwhale.yml +++ b/tasks/funkwhale.yml @@ -76,7 +76,7 @@ dest: "{{ funkwhale_install_path }}" remote_src: true notify: - - restart funkwhale + - reload funkwhale - name: Download api files become: true @@ -86,7 +86,7 @@ dest: "{{ funkwhale_install_path }}" remote_src: true notify: - - restart funkwhale + - reload funkwhale - name: "Setup virtualenv" become: true @@ -103,6 +103,18 @@ requirements: "{{ funkwhale_install_path }}/api/requirements.txt" virtualenv: "{{ funkwhale_install_path }}/virtualenv" virtualenv_python: python3 + notify: + - reload funkwhale + +- name: "Install gunicorn/uvicorn" + become: true + become_user: "{{ funkwhale_username }}" + pip: + name: + - gunicorn + - uvicorn + virtualenv: "{{ funkwhale_install_path }}/virtualenv" + virtualenv_python: python3 notify: - restart funkwhale diff --git a/tasks/packages.yml b/tasks/packages.yml index 4286607628ecdc3b8c9d81c55fda7a8828d3a1a5..fc2d1b87c466c37f1ca00a6372dd333122492118 100644 --- a/tasks/packages.yml +++ b/tasks/packages.yml @@ -14,6 +14,7 @@ - "unzip" - "build-essential" - "ffmpeg" + - "make" - "libjpeg-dev" - "libmagic-dev" - "libpq-dev" diff --git a/tasks/services.yml b/tasks/services.yml index e1123d6244d524c26dc0b5215447bae3940649fc..8d2a3c14af4251667082b53d9f75e0a92d60f65e 100644 --- a/tasks/services.yml +++ b/tasks/services.yml @@ -12,7 +12,7 @@ command: "{{ funkwhale_install_path }}/virtualenv/bin/celery -A funkwhale_api.taskapp worker -l INFO" - name: server description: Funkwhale application server - command: "{{ funkwhale_install_path }}/virtualenv/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application --proxy-headers" + command: "{{ funkwhale_install_path }}/virtualenv/bin/gunicorn config.asgi:application -w ${FUNKWHALE_WEB_WORKERS} -k uvicorn.workers.UvicornWorker -b ${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}" - name: beat description: Funkwhale celery beat process command: "{{ funkwhale_install_path }}/virtualenv/bin/celery -A funkwhale_api.taskapp beat -l INFO" diff --git a/templates/env.j2 b/templates/env.j2 index 4ef1f91f1553194f165b90af4cb608ab3b1423cf..587e63be80aacb473ab414c1f6bf57a363bab02c 100644 --- a/templates/env.j2 +++ b/templates/env.j2 @@ -6,6 +6,7 @@ DJANGO_SECRET_KEY={{ django_secret_key }} FUNKWHALE_API_IP={{ funkwhale_api_ip }} FUNKWHALE_API_PORT={{ funkwhale_api_port }} +FUNKWHALE_WEB_WORKERS={{ funkwhale_web_workers }} REVERSE_PROXY_TYPE=nginx {% if funkwhale_database_managed %}