Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose not working #115

Open
Surfer2010 opened this issue Jan 4, 2023 · 4 comments
Open

docker-compose not working #115

Surfer2010 opened this issue Jan 4, 2023 · 4 comments

Comments

@Surfer2010
Copy link

Surfer2010 commented Jan 4, 2023

Hello,
the docker compose file like this is not working. for some reason the login and db credentials are not working together
here my compose file:
`version: "3"

services:
app:
depends_on:
- db
environment:
PRETTY_URLS: "1"
HTTPS: "0"
HTTPS_REDIRECT: "0"
LANG: "de"
BASE_URL: "http://192.168.178.105"
DB_TYPE: "mysql"
DB_HOST: "db"
DB_PORT: "3303"
DB_USER: "webtrees"
DB_PASS: "webtreesUser"
DB_NAME: "webtrees"
DB_PREFIX: "wt_"
WT_USER: "admin"
WT_NAME: "Full Name"
WT_PASS: "secretpassw"
WT_EMAIL: "me@example.com"
image: ghcr.io/nathanvaughn/webtrees:latest
ports:
- 8080:80
restart: unless-stopped
volumes:
- app_data:/var/www/webtrees/data/
- app_media:/var/www/webtrees/media/

db:
environment:
MARIADB_DATABASE: "webtrees"
MARIADB_USER: "webtrees"
MARIADB_ROOT_PASSWORD: "webtreesUser"
MARIADB_PASSWORD: "webtreesUser"
image: docker.io/library/mariadb:latest
ports:
- 3303:3306
restart: unless-stopped
volumes:
- db_data:/var/lib/mysql
volumes:
db_data:
driver: local
app_data:
driver: local
app_media:
driver: local`

the error at the db container is:
2023-01-04 22:23:56 11 [Warning] Access denied for user 'root'@'192.168.144.3' (using password: NO) 2023-01-04 22:24:24 12 [Warning] Access denied for user 'root'@'192.168.144.3' (using password: NO)

Error at the webtree container ist:
File "/docker-entrypoint.py", line 399, in setup_wizard resp = request.urlopen( File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.9/urllib/request.py", line 517, in open response = self._open(req, data) File "/usr/lib/python3.9/urllib/request.py", line 534, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain result = func(*args) File "/usr/lib/python3.9/urllib/request.py", line 1375, in http_open return self.do_open(http.client.HTTPConnection, req) File "/usr/lib/python3.9/urllib/request.py", line 1349, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 111] Connection refused> [NV_INIT] PRETTY_URLS found in environment variables [NV_INIT] HTTPS found in environment variables [NV_INIT] HTTPS_REDIRECT found in environment variables [NV_INIT] SSL_CERT_FILE NOT found in environment variables, using default: /certs/webtrees.crt [NV_INIT] SSL_CERT_KEY_FILE NOT found in environment variables, using default: /certs/webtrees.key [NV_INIT] BASE_URL found in environment variables [NV_INIT] LANG found in environment variables [NV_INIT] DB_TYPE found in environment variables [NV_INIT] DB_HOST found in environment variables [NV_INIT] DB_PORT found in environment variables [NV_INIT] DB_USER found in environment variables [NV_INIT] DB_PASS found in environment variables [NV_INIT] DB_NAME found in environment variables [NV_INIT] DB_PREFIX found in environment variables [NV_INIT] WT_USER found in environment variables [NV_INIT] WT_NAME found in environment variables [NV_INIT] WT_PASS found in environment variables [NV_INIT] WT_EMAIL found in environment variables [NV_INIT] DB_KEY NOT found in environment variables, using default: None [NV_INIT] DB_CERT NOT found in environment variables, using default: None [NV_INIT] DB_CA NOT found in environment variables, using default: None [NV_INIT] DB_VERIFY NOT found in environment variables, using default: None [NV_INIT] PHP_MEMORY_LIMIT NOT found in environment variables, using default: 1024M [NV_INIT] PHP_MAX_EXECUTION_TIME NOT found in environment variables, using default: 90 [NV_INIT] PHP_POST_MAX_SIZE NOT found in environment variables, using default: 50M [NV_INIT] PHP_UPLOAD_MAX_FILE_SIZE NOT found in environment variables, using default: 50M [NV_INIT] Setting up folder permissions for uploads [NV_INIT] Updating php.ini [NV_INIT] Setting value for memory_limit in php.ini [NV_INIT] Setting value for max_execution_time in php.ini [NV_INIT] Setting value for post_max_size in php.ini [NV_INIT] Setting value for upload_max_filesize in php.ini [NV_INIT] Attempting to automate setup wizard [NV_INIT] Automating setup wizard [NV_INIT] Starting Apache in background [NV_INIT] Disabling site webtrees-redir Site webtrees-redir already disabled [NV_INIT] Disabling site webtrees-ssl Site webtrees-ssl already disabled [NV_INIT] Enabling site webtrees Site webtrees already enabled [NV_INIT] Sending setup wizard request Traceback (most recent call last): File "/usr/lib/python3.9/urllib/request.py", line 1346, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/usr/lib/python3.9/http/client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib/python3.9/http/client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/lib/python3.9/http/client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.9/http/client.py", line 1010, in _send_output self.send(msg) File "/usr/lib/python3.9/http/client.py", line 950, in send self.connect() File "/usr/lib/python3.9/http/client.py", line 921, in connect self.sock = self._create_connection( File "/usr/lib/python3.9/socket.py", line 843, in create_connection raise err File "/usr/lib/python3.9/socket.py", line 831, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/docker-entrypoint.py", line 520, in <module> main() File "/docker-entrypoint.py", line 505, in main setup_wizard() File "/docker-entrypoint.py", line 399, in setup_wizard resp = request.urlopen( File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.9/urllib/request.py", line 517, in open response = self._open(req, data) File "/usr/lib/python3.9/urllib/request.py", line 534, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain result = func(*args) File "/usr/lib/python3.9/urllib/request.py", line 1375, in http_open return self.do_open(http.client.HTTPConnection, req) File "/usr/lib/python3.9/urllib/request.py", line 1349, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

A second issue i noticed is:
if u use local mapped folders instead of docker volumes for persistant data, there are permission and ownership problems creating or starting the db container the first time, so it will not create the db files properly

thanks for your help

@Surfer2010
Copy link
Author

Hello,
I found the problem/solution:

the enviroment variables have to fit the database, so in case of mariaDB like in the docker compose file it has to be

  MARIADB_USER: "webtrees"
  MARIADB_PASSWORD : "webtreesUser"
  MARIADB_DATABASE : "webtrees"

(this led me to the answer: https://www.webtrees.net/index.php/en/forum/help-for-2-0/37332-docker-startup-failing)
Still the auto-setup does not work, but you have to go thru the assistant step by step but at least it works :)
thanks

@NathanVaughn
Copy link
Owner

NathanVaughn commented Jan 7, 2023

The environment variables for webtrees, don't really matter since the setup script I wrote accepts a number of options:

  • DB_USER
  • MYSQL_USER
  • MARIADB_USER
  • POSTGRES_USER

for example. For the MariaDB container, yes, they need to be the correct form, but your Compose file already has that. I think your issue is that you have DB_PORT: "3303" and not 3306.

@Surfer2010
Copy link
Author

I did try both ... Port 3303 and 3306 didn't change anything. I have a second mariadb container running on the same host which i want to keep seperate so i did change the db to publish on 3303 so webtrees should also look for 3303.
New error I got while it was working for a while:
[NV_INIT] Attempting to automate setup wizard [NV_INIT] Automating setup wizard [NV_INIT] Starting Apache in background [NV_INIT] Disabling site webtrees-redir Site webtrees-redir already disabled [NV_INIT] Disabling site webtrees-ssl Site webtrees-ssl already disabled [NV_INIT] Enabling site webtrees Enabling site webtrees. To activate the new configuration, you need to run: service apache2 reload [NV_INIT] Sending setup wizard request Traceback (most recent call last): File "/usr/lib/python3.9/urllib/request.py", line 1346, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/usr/lib/python3.9/http/client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib/python3.9/http/client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/lib/python3.9/http/client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.9/http/client.py", line 1010, in _send_output self.send(msg) File "/usr/lib/python3.9/http/client.py", line 950, in send self.connect() File "/usr/lib/python3.9/http/client.py", line 921, in connect self.sock = self._create_connection( File "/usr/lib/python3.9/socket.py", line 843, in create_connection raise err File "/usr/lib/python3.9/socket.py", line 831, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/docker-entrypoint.py", line 520, in <module> main() File "/docker-entrypoint.py", line 505, in main setup_wizard() File "/docker-entrypoint.py", line 399, in setup_wizard resp = request.urlopen( File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.9/urllib/request.py", line 517, in open response = self._open(req, data) File "/usr/lib/python3.9/urllib/request.py", line 534, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain result = func(*args) File "/usr/lib/python3.9/urllib/request.py", line 1375, in http_open return self.do_open(http.client.HTTPConnection, req) File "/usr/lib/python3.9/urllib/request.py", line 1349, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 111] Connection refused>
Thanks for hints where to check

@NathanVaughn
Copy link
Owner

Okay, with how you have your docker-compose file setup, I think you want to set DB_HOST to db and DB_PORT to 3306. Since webtrees and the database container are running in the same Docker network, you don't actually have to expose any ports on the host. The name db resolves to the database container, and MySQL talks on 3306 by default.

Regardless, the connection refused error you're getting means my script that tries to run the setup wizard is timing out waiting for webtrees. I would recommend trying to run the setup wizard manually, it's likely hitting some kind of error, like being unable to talk to the SQL server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants