Closed loranger closed 2 years ago
Bonjour Laurent, I will try to analyse your problem in the next days.
Merci ! 👍🏻
Hi Laurent, when I try to setup an environment with single docker commands everything works correct and you can login with the credentials set in WT_ADMIN and WT_ADMINPW.
So, when you execute:
docker run --name mariadb -p 3306:3306 -e MARIADB_ROOT_PASSWORD=rootpw -e MARIADB_USER=example-user -e MARIADB_PASSWORD=my_secret -d mariadb:10
and following
docker run -d -p 80:80 --name webtrees -e DISABLE_SSL=TRUE -e PORT=80 -e DB_USER=root -e DB_PASSWORD=rootpw -e DB_HOST=192.168.1.131 -e DB_PORT=3306 -e DB_NAME=webtrees_db -e WT_ADMIN=admin -e WT_ADMINPW=admin dtjs48jkt/webtrees:latest
Everything works as expected and I would rule out that the implementation in general does not work.
Since you are using docker-compose I also tried to do a test with docker-compose. But I could not use your provided files directly due to a completely different environment (no Traefik, ..). After some modifications I got it running and had the effect that the database was created but no tables at all were contained the database. Currently it is not yet clear why this happens since the data is created with the single command:
mysql -u root --password=rootpw -h webtrees-mariadb < /mod_webtrees.sql
When you connect to the shell of the container you can execute the command and the database is successfully created. Also a successful login is possible.
Currently I would assume here a timing problem that the database is not ready while the webtrees container yet tries to write to the database. You could try to add the following to your docker-compose.yml:
command:
- '/bin/sh'
- '-c'
- '/bin/sleep 30 && ./start.sh'
depends_on:
- "mariadb"
I will try to analyze it further and check if there could be some enhancement in the webtrees image itself.
With https://github.com/H2CK/webtrees/commit/893591388c93c9165ebb8d15d4f1150e366bfcf6 a delay was added when initially setting up the database. This gives the database the time to startup before the SQL script is executed.
Please try the latest version for setting up webtrees with the database using docker-compose. Previously described modification is no longer necessary.
My local tests proved that the database was created successful. Hope you could confirm that too.
Hi,
Thanks for your hard work.
I just tried, but I'm afraid it still does not work for me. You could find the log I did prune all the containers and datas. I started the project and waited 2 minutes (as you can see on the logs) before opening adminer, but the database was empty
Maybe I forgot a step ?
You didn't do anything wrong. From the logs it seems that the added static delay of 30 seconds is not sufficient for your database to fully start up.
I will have to modify the routine to check periodically if the database is already up an running.
I will inform you when the implementation is changed.
With commit https://github.com/H2CK/webtrees/commit/e8226371a0cbfb094dc9556347ce0bc1df49815f now a dynamic delay is added before writing to the database. In a loop the readiness of the database is checked and only if it is available the data is written. It should be soon available in the latest docker image for version 2.1.x Please try if this solves the problem on your side.
Hi,
Thanks for your support. I did prune everything and get the lateste version, but I'm afraid it does not work
Please don't be offended, but I think I'm going to use this docker image instead which seems to work out of the box…
In the log file it is possible to find the entry:
ERROR: Configuration file /var/www/html/data/config.ini.php to set base_url not found.
This is caused by the situation that there is no environment variable DB_PASSWORD set.
If this variable is not set the database initialization is not started and even the config.ini.php is not generated.
But anyhow please feel free to used whatever webtrees docker image you want.
Hello, I try to setup webtrees using docker-compose. Everything works fine database is created, and populated, but no user is created and I can't figure out why.
Could you help me, please ?
.env
```env APP_NAME="webtrees" APP_PROJECT=webtrees APP_DOMAIN=webtrees.mydomain.com MARIADB_RANDOM_ROOT_PASSWORD=true MYSQL_DATABASE=webtrees MYSQL_USER=app_user MYSQL_PASSWORD=secret TZ=Europe/Paris # https://github.com/H2CK/webtrees#parameters # UPDATE_ON_START=true GROUP_ID=999 DISABLE_SSL=TRUE PORT=80 PRETTYURLS="1" BASE_URL="http://${APP_DOMAIN}" DB_HOST="${APP_PROJECT}-mariadb" DB_USER="${MYSQL_USER}" DB_PASSWORD="${MYSQL_PASSWORD}" # DB_PORT= DB_NAME="${MYSQL_DATABASE}" WT_ADMIN="loranger" WT_ADMINPW="my_password" WT_ADMINMAIL="loranger@free.fr" ```docker-compose.yml
```yaml version: '3' services: webtrees: container_name: ${APP_PROJECT}-webtrees image: dtjs48jkt/webtrees:latest # volumes: # - ./datas:/var/www/html/data env_file: - .env restart: always depends_on: - mariadb labels: - "traefik.http.routers.${APP_PROJECT}.rule=Host(`${APP_DOMAIN}`)" - "traefik.http.services.${APP_PROJECT}-service.loadbalancer.server.port=80" mariadb: container_name: ${APP_PROJECT}-mariadb image: mariadb:latest env_file: - .env volumes: - ./database:/var/lib/mysql labels: - "traefik.enable=false" adminer: container_name: ${APP_PROJECT}-adminer image: adminer:latest environment: ADMINER_DEFAULT_SERVER: ${DB_HOST} ADMINER_DESIGN: flat profiles: - adminer labels: - "traefik.http.routers.${APP_PROJECT}-adminer.rule=Host(`adminer.${APP_DOMAIN}`)" - "traefik.http.services.${APP_PROJECT}-adminer-service.loadbalancer.server.port=8080" networks: default: name: web ```