From aa642562079350f2bc8f40d191824c31cbbe37e5 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 5 Dec 2022 20:47:15 +0100 Subject: [PATCH] finished funkwave draft --- roles/docker-funkwhale/README.md | 8 ++ roles/docker-funkwhale/tasks/main.yml | 4 +- .../templates/docker-compose.yml.j2 | 75 +++++++++-- roles/docker-funkwhale/templates/env.j2 | 118 ++++++++++++++++-- 4 files changed, 187 insertions(+), 18 deletions(-) diff --git a/roles/docker-funkwhale/README.md b/roles/docker-funkwhale/README.md index b3ddcb4d..39ccd3eb 100644 --- a/roles/docker-funkwhale/README.md +++ b/roles/docker-funkwhale/README.md @@ -1,4 +1,12 @@ # role funkwhale +This role doesn't work and needs to be implemented + +## cleanup + +```bash +docker-compose down && docker volume rm funkwhale_data +``` + ## further information - https://docs.funkwhale.audio/installation/docker.html \ No newline at end of file diff --git a/roles/docker-funkwhale/tasks/main.yml b/roles/docker-funkwhale/tasks/main.yml index 0438ec9e..8df826a8 100644 --- a/roles/docker-funkwhale/tasks/main.yml +++ b/roles/docker-funkwhale/tasks/main.yml @@ -16,10 +16,10 @@ template: src=docker-compose.yml.j2 dest={{docker_compose_path}}docker-compose.yml notify: recreate funkwhale -- name: add env +- name: add .env template: src: env.j2 - dest: "{{docker_compose_path}}env" + dest: "{{docker_compose_path}}.env" mode: '770' force: yes notify: recreate funkwhale \ No newline at end of file diff --git a/roles/docker-funkwhale/templates/docker-compose.yml.j2 b/roles/docker-funkwhale/templates/docker-compose.yml.j2 index 6e4ab935..ba30a0a7 100644 --- a/roles/docker-funkwhale/templates/docker-compose.yml.j2 +++ b/roles/docker-funkwhale/templates/docker-compose.yml.j2 @@ -1,13 +1,74 @@ version: "3" + services: - funkwhale: - container_name: funkwhale + postgres: restart: unless-stopped - image: funkwhale/all-in-one:{{funkwhale_version}} - env_file: env + env_file: .env + environment: + - "POSTGRES_HOST_AUTH_METHOD=trust" + image: postgres:15-alpine volumes: - - data:/data + - database:/var/lib/postgresql/data + + redis: + restart: unless-stopped + env_file: .env + image: redis:7-alpine + volumes: + - redis:/data + + celeryworker: + restart: unless-stopped + image: funkwhale/api:${FUNKWHALE_VERSION:-latest} + depends_on: + - postgres + - redis + env_file: .env + command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency=${CELERYD_CONCURRENCY-0} + environment: + - C_FORCE_ROOT=true + volumes: + - "data:${MEDIA_ROOT}" + + celerybeat: + restart: unless-stopped + image: funkwhale/api:${FUNKWHALE_VERSION:-latest} + depends_on: + - postgres + - redis + env_file: .env + command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO + + api: + restart: unless-stopped + image: funkwhale/api:${FUNKWHALE_VERSION:-latest} + depends_on: + - postgres + - redis + env_file: .env + volumes: + - "data:${MEDIA_ROOT}" + #- "${STATIC_ROOT}:${STATIC_ROOT}" ports: - - "127.0.0.1:{{http_port}}:{{http_port}}" + - "5000" + + front: + restart: unless-stopped + image: funkwhale/front:${FUNKWHALE_VERSION:-latest} + depends_on: + - api + env_file: + - .env + environment: + # Override those variables in your .env file if needed + - "NGINX_MAX_BODY_SIZE=${NGINX_MAX_BODY_SIZE-100M}" + volumes: + - "data:${MEDIA_ROOT}:ro" + #- "${STATIC_ROOT}:${STATIC_ROOT}:ro" + ports: + # override those variables in your .env file if needed + - "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80" volumes: - data: \ No newline at end of file + data: + redis: + database: \ No newline at end of file diff --git a/roles/docker-funkwhale/templates/env.j2 b/roles/docker-funkwhale/templates/env.j2 index c11d9f99..880d91e3 100644 --- a/roles/docker-funkwhale/templates/env.j2 +++ b/roles/docker-funkwhale/templates/env.j2 @@ -1,12 +1,112 @@ +# If you have any doubts about what a setting does, +# check https://docs.funkwhale.audio/configuration.html#configuration-reference + +# If you're tweaking this file from the template, ensure you edit at least the +# following variables: +# - EMAIL_CONFIG and DEFAULT_FROM_EMAIL if you plan to send e-mails) +# On non-docker setup **only**, you'll also have to tweak/uncomment those variables: +# - DATABASE_URL +# - CACHE_URL +# +# You **don't** need to update those variables on pure docker setups. +# +# Additional options you may want to check: +# - MUSIC_DIRECTORY_PATH and MUSIC_DIRECTORY_SERVE_PATH if you plan to use +# in-place import +# +# Docker only +# ----------- + +FUNKWHALE_VERSION={{funkwhale_version}} + +# End of Docker-only configuration + +# General configuration +# --------------------- + +FUNKWHALE_API_IP=127.0.0.1 +FUNKWHALE_API_PORT={{http_port}} +# The number of web workers to start in parallel. Higher means you can handle +# more concurrent requests, but also leads to higher CPU/Memory usage +FUNKWHALE_WEB_WORKERS=4 +# Replace this by the definitive, public domain you will use for +# your instance. It cannot be changed after initial deployment +# without breaking your instance. FUNKWHALE_HOSTNAME={{domain}} FUNKWHALE_PROTOCOL=https -# This limits the upload size -NGINX_MAX_BODY_SIZE=100M -# Bind to localhost -FUNKWHALE_API_IP=127.0.0.1 -# Container port you want to expose on the host -FUNKWHALE_API_PORT={{http_port}} -# Generate and store a secure secret key for your instance + +# Log level (debug, info, warning, error, critical) +LOGLEVEL=error + +# Configure e-mail sending using this variale +# By default, funkwhale will output e-mails sent to stdout +# here are a few examples for this setting +# EMAIL_CONFIG=consolemail:// # output e-mails to console (the default) +# EMAIL_CONFIG=dummymail:// # disable e-mail sending completely +# On a production instance, you'll usually want to use an external SMTP server: +# If `user` or `password` contain special characters (eg. +# `noreply@youremail.host` as `user`), be sure to urlencode them, using +# for example the command: +# `python3 -c 'import urllib.parse; print(urllib.parse.quote_plus +# ("noreply@youremail.host"))'` +# (returns `noreply%40youremail.host`) +# EMAIL_CONFIG=smtp://user:password@youremail.host:25 +# EMAIL_CONFIG=smtp+ssl://user:password@youremail.host:465 +# EMAIL_CONFIG=smtp+tls://user:password@youremail.host:587 + +# Make e-mail verification mandatory before using the service +# Doesn't apply to admins. +# ACCOUNT_EMAIL_VERIFICATION_ENFORCE=false + +# The e-mail address to use to send system e-mails. +# DEFAULT_FROM_EMAIL=noreply@yourdomain + +# Depending on the reverse proxy used in front of your funkwhale instance, +# the API will use different kind of headers to serve audio files +# Allowed values: nginx, apache2 +REVERSE_PROXY_TYPE=nginx + +# API/Django configuration + +# Number of worker processes to execute. Defaults to 0, in which case it uses your number of CPUs +# Celery workers handle background tasks (such file imports or federation +# messaging). The more processes a worker gets, the more tasks +# can be processed in parallel. However, more processes also means +# a bigger memory footprint. +CELERYD_CONCURRENCY=1 + +# Where media files (such as album covers or audio tracks) should be stored +# on your system? +# (Ensure this directory actually exists) +MEDIA_ROOT=/srv/funkwhale/data/ + +# Where static files (such as API css or icons) should be compiled +# on your system? +# (Ensure this directory actually exists) +STATIC_ROOT=/srv/funkwhale/data/static + +# which settings module should django use? +# You don't have to touch this unless you really know what you're doing +DJANGO_SETTINGS_MODULE=config.settings.production + +# Generate one using `openssl rand -base64 45`, for example DJANGO_SECRET_KEY={{funkwhale_django_secret}} -# Remove this if you expose the container directly on ports 80/443 -NESTED_PROXY=1 \ No newline at end of file + +# LDAP settings +# Use the following options to allow authentication on your Funkwhale instance +# using a LDAP directory. +# Have a look at https://docs.funkwhale.audio/installation/ldap.html for +# detailed instructions. + +# LDAP_ENABLED=False +# LDAP_SERVER_URI=ldap://your.server:389 +# LDAP_BIND_DN=cn=admin,dc=domain,dc=com +# LDAP_BIND_PASSWORD=bindpassword +# LDAP_SEARCH_FILTER=(|(cn={0})(mail={0})) +# LDAP_START_TLS=False +# LDAP_ROOT_DN=dc=domain,dc=com + +FUNKWHALE_FRONTEND_PATH=/srv/funkwhale/front/dist + +# Nginx related configuration +NGINX_MAX_BODY_SIZE=100M \ No newline at end of file