linuxserver / docker-lychee

GNU General Public License v3.0
43 stars 16 forks source link

Lychee does not create the database. #43

Closed dexter74 closed 3 years ago

dexter74 commented 3 years ago

Hello, Lychee does not create the database.

Docker-compose is default:

version: "3"
services:
  mariadb:
    image: ghcr.io/linuxserver/mariadb:latest
    container_name: lychee_mariadb
    restart: always
    volumes:
      - mariadb:/config
    environment:
      - MYSQL_ROOT_PASSWORD=rootpassword
      - MYSQL_DATABASE=lychee
      - MYSQL_USER=lychee
      - MYSQL_PASSWORD=dbpassword
      - PGID=1000
      - PUID=1000
      - TZ=Europe/London
  lychee:
    image: ghcr.io/linuxserver/lychee:latest
    container_name: lychee
    restart: always
    depends_on:
      - mariadb
    volumes:
      - config:/config
      - pictures:/pictures
    environment:
      - DB_HOST=mariadb
      - DB_USER=lychee
      - DB_PASS=dbpassword
      - DB_NAME=lychee
      - DB_PORT=3306
      - PGID=1000
      - PUID=1000
      - TZ=Europe/London
    ports:
      - 80:80

volumes:
  mariadb:
  config:
  pictures:

APP_NAME=Lychee
APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_URL=http://localhost

# enable or disable debug bar. By default it is disabled.
DEBUGBAR_ENABLED=false

LOG_CHANNEL=stack

##############################################################################
# IMPORTANT: To migrate from Lychee v3 you *MUST* use the same MySQL/MariaDB #
#            server as v3.                                                   #
##############################################################################

# Table prefix (e.g. lychee_) of a Lychee v3 instance for migration
DB_OLD_LYCHEE_PREFIX=

# DB_CONNECTION can be sqlite, mysql or pgsql. For sqlite the other entries are
# not required, but an existing sqlite3 database may be specified if desired. In
# this case, please use an absolute path. DB_DATABASE may be omitted but should
# *not* be left blank.
DB_CONNECTION=sqlite
DB_HOST=
DB_PORT=
#DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
DB_LOG_SQL=false

TIMEZONE=UTC

# folders in which the files will be stored
# LYCHEE_DIST="/var/www/html/Lychee-Laravel/public/dist/"
# LYCHEE_UPLOADS="/var/www/html/Lychee-Laravel/public/uploads/"

# url to access those files
# LYCHEE_DIST_URL="dist/"
# LYCHEE_UPLOADS_URL="uploads/"

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

SECURITY_HEADER_HSTS_ENABLE=false

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

image

github-actions[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

aptalca commented 3 years ago

It's not expected to. Mariadb creates the database based on the env vars. However, those vars only have effect the very first time the mariadb container is created. Once there is an existing config folder, changing those vars will have no effect.

Delete the config folder for mariadb and recreate the container with the db vars

ghost commented 3 years ago

I have the same problem. did you manage to solve it?

dexter74 commented 3 years ago

NO .

J’ai le même problème. avez-vous réussi à le résoudre?

jtommi commented 3 years ago

The variable names are wrong in the documentation https://github.com/linuxserver/docker-lychee/blob/06796b62c5afaa720282193eddded0198592d6a6/root/etc/cont-init.d/40-config#L31 As you can see in the code, it expects DB_USERNAME (not DB_USER), DB_PASSWORD (not DB_PASS) and DB_DATABASE (not DB_NAME)

If found this by checking the logs, where it said "No upgrade or variables provided - set up application via the web interface", so I searched for that and found the relevant code. So change the variable names in your docker-compose and it should work. This is the first badly done linuxserver image that I've come across

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Moonjer commented 3 years ago

I had the same problem, It drove me crazy image

Roxedus commented 3 years ago

2 things probably happen here.

  1. The current readme does indeed have the wrong variables.
  2. If you use the compose file provided in the current readme, lychee usually comes up before mariadb has created the database