Closed MattiaFailla closed 1 year ago
Hail, @MattiaFailla 👋 Welcome to Fief's kingdom!
Our team will get back to you very soon to help.
In the meantime, take a minute to star our repository ⭐️
Farewell!
Hello @MattiaFailla 👋
Hmm, that's indeed an error during the creation of the database schema. It's strange because Fief is tested against MySQL during CI.
Could you tell me which version of MySQL you are using?
Hey @frankie567
I'm using MySQL Server 8.0.31-1.el8
Here is the docker-compose file: (Please note that I've specified the 0.18 Fief-server version just for testing but this issue is present in every Fief version.)
version: '3'
services:
db:
image: mysql
ports:
- "0.0.0.0:3308:3306"
env_file:
- .env
fief-server:
image: ghcr.io/fief-dev/fief:0.18
command: fief run-server --port 8585
depends_on:
- db
expose:
- 8585
env_file:
- .env
fief-worker:
image: ghcr.io/fief-dev/fief:latest
command: fief run-worker -p 1 -t 1
env_file:
- .env
redis:
image: redis:alpine
command: redis-server --save 60 1 --loglevel warning
volumes:
- redis-data:/data
volumes:
redis-data:
And this is the .env
DEBUG=True
MYSQL_DATABASE=fastapi
MYSQL_ROOT_PASSWORD=root
# Reference: https://docs.fief.dev/self-hosting/environment-variables/
SECRET=XXX
FIEF_CLIENT_ID=XXX
FIEF_CLIENT_SECRET=XXX
ENCRYPTION_KEY=XXX=
PORT=8000
ROOT_DOMAIN=localhost:8000
FIEF_DOMAIN=localhost:8000
FIEF_MAIN_USER_EMAIL=test@example.com
FIEF_MAIN_USER_PASSWORD=exampleexample
CSRF_COOKIE_SECURE=False
LOGIN_SESSION_COOKIE_SECURE=False
SESSION_COOKIE_SECURE=False
FIEF_ADMIN_SESSION_COOKIE_SECURE=False
# Read more: https://docs.fief.dev/self-hosting/deployment/setup-database/
DATABASE_TYPE=MYSQL
DATABASE_HOST=db
DATABASE_PORT=3306
DATABASE_USERNAME=root
DATABASE_PASSWORD=root
DATABASE_NAME=fastapi
REDIS_URL=redis://redis:6379
LOGIN_SESSION_COOKIE_NAME=login_session_data
REGISTRATION_SESSION_COOKIE_NAME=registration_session_data
Hail, @MattiaFailla 👋
I've noticed you shared secret values: SECRET
, FIEF_CLIENT_ID
, FIEF_CLIENT_SECRET
, ENCRYPTION_KEY
. Those are highly sensitive and you should keep them secret.
For your security, I've taken the liberty to replace them with dummy values.
Thank you for those details!
So it turns out it works with MariaDB, but not MySQL (🙄). I've added it to our CI so we can catch those errors earlier.
The culprit is actually an index on the message column of the AuditLog model. It's a TEXT column, so it's indeed a bit weird to have an index on this, don't really know why I did this.
I'll push a fix soon!
Describe the bug
Hi Team, following the self-hosted docker-compose guide with MYSQL database the following error is issued:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Fief server should start and migration should be performed with a MySQL backend.
Configuration
Additional context
Here is the full log:
errorlog.txt