Skip to content
Snippets Groups Projects
Verified Commit 2db49315 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Gunicorn / uvicorn and 0-downtime upgrade

parent fc8ca19a
No related branches found
No related tags found
No related merge requests found
......@@ -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: []
......
......@@ -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:
......
......@@ -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
......
......@@ -14,6 +14,7 @@
- "unzip"
- "build-essential"
- "ffmpeg"
- "make"
- "libjpeg-dev"
- "libmagic-dev"
- "libpq-dev"
......
......@@ -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"
......
......@@ -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 %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment