Hello Everyone
I have a problem in "Set up your Install Funkwhale on Debian", follow the doc to the "6. Set up your database" part
cd /srv/funkwhale
sudo -u funkwhale venv/bin/funkwhale-manage migrate
I got the error
sudo -u funkwhale venv/bin/funkwhale-manage migrate
2024-05-19 20:06:26,551 funkwhale_api.config INFO Loaded env file at /srv/funkwhale/config/.env
2024-05-19 20:06:26,551 funkwhale_api.config INFO Running with the following plugins enabled: funkwhale_api.contrib.scrobbler, funkwhale_api.contrib.listenbrainz, funkwhale_api.contrib.maloja
2024-05-19 12:06:27,943 funkwhale_api.typesense.utils INFO Typesense is not activated. You can enable it by setting the TYPESENSE_API_KEY env variable.
2024-05-19 12:06:27,943 funkwhale_api.typesense.tasks INFO Typesense is not activated. You can enable it by setting the TYPESENSE_API_KEY env variable.
Operations to perform:
Apply all migrations: account, admin, audio, auth, authtoken, common, contenttypes, dynamic_preferences, favorites, federation, history, moderation, music, playlists, radios, requests, sessions, sites, socialaccount, tags, users
Running migrations:
Traceback (most recent call last):
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.errors.InsufficientPrivilege: permission denied for schema public
LINE 1: CREATE TABLE "django_migrations" ("id" serial NOT NULL PRIMA...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/db/migrations/recorder.py", line 68, in ensure_schema
editor.create_model(self.Migration)
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 345, in create_model
self.execute(sql, params or None)
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 145, in execute
cursor.execute(sql, params)
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 66, in execute
return self.execute_with_wrappers(sql, params, many=False, executor=self.execute)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in _execute
with self.db.wrap_database_errors:
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/db/utils.py", line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.ProgrammingError: permission denied for schema public
LINE 1: CREATE TABLE "django_migrations" ("id" serial NOT NULL PRIMA...
^
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/funkwhale/venv/bin/funkwhale-manage", line 8, in <module>
sys.exit(main())
^^^^^^
File "/srv/funkwhale/api/funkwhale_api/main.py", line 30, in main
execute_from_command_line(sys.argv)
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(args, **cmd_options)
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/core/management/base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/core/management/commands/migrate.py", line 244, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/db/migrations/executor.py", line 91, in migrate
self.recorder.ensure_schema()
File "/srv/funkwhale/venv/lib/python3.11/site-packages/django/db/migrations/recorder.py", line 70, in ensure_schema
raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (permission denied for schema public
LINE 1: CREATE TABLE "django_migrations" ("id" serial NOT NULL PRIMA...
^
)
It looks like permission error, and change funkwhale to superuser in database will bypass this, is this propose to?
My base sys is debian 12 /w minimum setup
and this is .env I use
# 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:
# - DJANGO_SECRET_KEY
# - FUNKWHALE_HOSTNAME
# - 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
# - TYPESENSE_API_KEY if you want to enable typesense to experiment with
# the recommendation system set this. You can
# generate one using openssl rand -base64 45
, for example
#
# Docker only
# -----------
# The tag of the image we should use
# (it will be interpolated in docker-compose file)
# You can comment or ignore this if you're not using docker
#FUNKWHALE_VERSION=latest
# End of Docker-only configuration
# General configuration
# ---------------------
# Set this variables to bind the API server to another interface/port
# example: FUNKWHALE_API_IP=0.0.0.0
# example: FUNKWHALE_API_PORT=5678
#FUNKWHALE_API_IP=127.0.0.1
FUNKWHALE_API_IP=127.0.0.1
FUNKWHALE_API_PORT=5000
# 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=16
# 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=funkwhale-bak.nekomimi-miko.com
FUNKWHALE_PROTOCOL=https
# 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
# Database configuration
# Examples:
# DATABASE_URL=postgresql://<user>:<password>@<host>:<port>/<database>
# DATABASE_URL=postgresql://funkwhale:passw0rd@localhost:5432/funkwhale_database
# Use the next one if you followed Debian installation guide
# DATABASE_URL=postgresql://funkwhale@:5432/funkwhale
# Cache configuration
# Examples:
# CACHE_URL=redis://<host>:<port>/<database>
# CACHE_URL=redis://localhost:6379/0c
# With a password:
# CACHE_URL=redis://:password@localhost:6379/0
# (the extra semicolon is important)
# Use the next one if you followed Debian installation guide
#
# CACHE_URL=redis://127.0.0.1:6379/0
#
# If you want to use Redis over unix sockets, you'll actually need two variables:
# For the cache part:
# CACHE_URL=unix:///run/redis/redis.sock?db=0
# For the Celery/asynchronous tasks part:
# CELERY_BROKER_URL=redis+socket:///run/redis/redis.sock?virtual_host=0
# 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=0
# 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/media
# 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=Something from generated
# You don't have to edit this, but you can put the admin on another URL if you
# want to
# DJANGO_ADMIN_URL=api/admin/
# In-place import settings
# You can safely leave those settings uncommented if you don't plan to use
# in place imports.
# Typical docker setup:
# MUSIC_DIRECTORY_PATH=/music # docker-only
# MUSIC_DIRECTORY_SERVE_PATH=/srv/funkwhale/data/music
# Typical non-docker setup:
# MUSIC_DIRECTORY_PATH=/srv/funkwhale/data/music
# # MUSIC_DIRECTORY_SERVE_PATH= # stays commented, not needed
MUSIC_DIRECTORY_PATH=/srv/funkwhale/data/music
MUSIC_DIRECTORY_SERVE_PATH=/srv/funkwhale/data/music
# 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=500M
## External storages configuration
# Funkwhale can store uploaded files on Amazon S3 and S3-compatible storages (such as Minio)
# Uncomment and fill the variables below
#AWS_ACCESS_KEY_ID=
#AWS_SECRET_ACCESS_KEY=
#AWS_STORAGE_BUCKET_NAME=
# An optional bucket subdirectory were you want to store the files. This is especially useful
# if you plan to use share the bucket with other services
# AWS_LOCATION=
# If you use a S3-compatible storage such as minio, set the following variable
# the full URL to the storage server. Example:
# AWS_S3_ENDPOINT_URL=https://minio.mydomain.com
# AWS_S3_ENDPOINT_URL=
# If you want to serve media directly from your S3 bucket rather than through a proxy,
# set this to false
# PROXY_MEDIA=false
# If you are using Amazon S3 to serve media directly, you will need to specify your region
# name in order to access files. Example:
# AWS_S3_REGION_NAME=eu-west-2
# AWS_S3_REGION_NAME=
# If you are using Amazon S3, use this setting to configure how long generated URLs should stay
# valid. The default value is 3600 (60 minutes). The maximum accepted value is 604800 (7 days)
# AWS_QUERYSTRING_EXPIRE=
# If you are using an S3-compatible object storage provider, and need to provide a default
# ACL for object uploads that is different from the default applied by boto3, you may
# override it here. Example:
# AWS_DEFAULT_ACL=public-read
# Available options can be found here: https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl
# AWS_DEFAULT_ACL=
# Funkwhale allows collecting errors using Sentry compatible APIs. If you want
# to help us improving Funkwhale, feel free to use our instance:
#FUNKWHALE_SENTRY_DSN=https://5840197379c64f65aad3c5c09274994d@am.funkwhale.audio/1
# Settings in doc
DISABLE_PASSWORD_VALIDATORS=true
PROXY_MEDIA=true
EXTERNAL_MEDIA_PROXY_ENABLED=true
PROTECT_FILES_PATH=/_protected
DATABASE_URL=postgresql://funkwhale@:5432/funkwhale
CACHE_URL=redis://127.0.0.1:6379/0