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

Can't get the application to run at all #103

Open
SvbZ3r0 opened this issue Jun 11, 2022 · 8 comments
Open

Can't get the application to run at all #103

SvbZ3r0 opened this issue Jun 11, 2022 · 8 comments

Comments

@SvbZ3r0
Copy link

SvbZ3r0 commented Jun 11, 2022

I'm unsure if the issue is with Webtrees or with the container or with me.

fisharebest/webtrees#4473

@NathanVaughn
Copy link
Owner

Thanks, downgrade to 2.1.4 for the time being, I will look into this

@NathanVaughn
Copy link
Owner

It looks like the named tags of 2.1.4 and 2.1.5 are fine, but for some reason the latest tag got broken, and is still pointing to 2.0.24. And the 2.0.x versions of webtrees don't like php 8, hence it doesn't work.

@NathanVaughn
Copy link
Owner

This should be fixed now by e5bce82 and re-publishing 2.1.5 and 2.0.24

@SvbZ3r0
Copy link
Author

SvbZ3r0 commented Jun 12, 2022

Thanks for the quick update! I think the latest tag is still broken because it still shows the same error but the 2.1.5 tag doesn't. But that might be a caching issue.

I still can't get it to work however. I'll be the first to admit I don't know a peep about getting docker to work well. I'm on unRaid, and all the popular containers come with templates, so I haven't had a problem before.
Would you mind taking a look at my configuration and telling me what I'm doing that is wrong.

I am currently getting a HTTP 500 or a HTTP 408 instead of the Fatal Error that I got before.

Edit: I switched to MariaDB and was able to get all the way up to the login page.
However, the username and password provided using WT_USER and WT_PASS do not work. I checked the wt_user table and it was empty. Is there a default admin user I'm supposed to use?

Edit: So I guess that's the wrong table to be looking at. I manually inserted a user into the table, but the credentials still don't work.

Edit: It's been a couple hours but I've managed to get in by setting canadmin, verified, and verified_by_admin to 1 in wt_user_setting. I got to the home page but there's just a huge error message that begins with Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails ("webtrees"."wt_block", CONSTRAINT "wt_block_user_id_foreign" FOREIGN KEY ("user_id") REFERENCES "wt_user" ("user_id")) (SQL: insert into wt_block (user_id, location, block_order, module_name) values (-1, main, 1, todays_events)) …/vendor/illuminate/database/Connection.php:712. I checked wt_block and it is empty. I think there is a problem with the database initiation, since every table in the database is empty. I will continue to investigate.

Edit: Got it working finally. Made dummy entries in wt_user and wt_gedcom with -1 as user_id and gedcom_id. Everything works perfectly now. Although I still think this entire process should either be documented or automated.

@NathanVaughn
Copy link
Owner

I think you just need to repull the latest tag, I pulled ghcr.io/nathanvaughn/webtrees:latest and it works fine.

As for the other issues, my best guess is that because the application was erroring out, while in the middle of the setup, it ended up in a corrupted state. I ran the example docker-compose.yml file and had no problems. If you haven't loaded much real data in, you may want to try clearing everything and starting fresh.

@SvbZ3r0
Copy link
Author

SvbZ3r0 commented Jun 13, 2022

I ended up taking a backup of all the data I entered and tried to start from scratch.
What I noticed is that the Setup wizard only runs automatically if a config file doesn't already exist.

else:
print2("Config file does NOT exist")
# make sure all the variables we need are not set to None
try:
assert lang is not None
assert table_prefix is not None
assert base_url is not None
assert wt_name is not None
assert wt_user is not None
assert wt_pass is not None
assert wt_email is not None
assert db_type is not None
assert db_name is not None
if db_type in ["mysql", "pgsql"]:
assert db_host is not None
assert db_port is not None
assert db_user is not None
assert db_pass is not None
elif db_type == "sqlite":
assert db_name is not None
db_host = ""
db_port = ""
db_user = ""
db_pass = ""
else:
raise ValueError(f"Unknown database type: {db_type}")
except AssertionError:
print2("WARNING: Not all required variables were found for setup wizard")
return
print2("Automating setup wizard")

I do not know if this is intended behaviour, but since a config file was present for me from previous installs, the setup wizard didn't trigger.

So I went ahead, deleted the config file and tried again. This time (and every consecutive time that I tried), it failed here:

resp = request.urlopen(
"http://127.0.0.1:80/",
urlencode(
{
"lang": lang,
"tblpfx": table_prefix,
"baseurl": base_url,
"dbtype": db_type,
"dbhost": db_host,
"dbport": db_port,
"dbuser": db_user,
"dbpass": db_pass,
"dbname": db_name,
"wtname": wt_name,
"wtuser": wt_user,
"wtpass": wt_pass,
"wtemail": wt_email,
"step": "6",
}
).encode("ascii"),
)

with a ConnectionRefusedError: [Errno 111] Connection refused.

Any idea why this might be happening?

Edit:
I created an empty config file, and ran it again. Waited a minute or two to let the tables be created in the database, and then sent this request:

resp = request.urlopen(
    "http://webtreesurl:port/",
    urlencode(
        {
            "lang": lang,
            "tblpfx": table_prefix,
            "baseurl": base_url,
            "dbtype": db_type,
            "dbhost": db_host,
            "dbport": db_port,
            "dbuser": db_user,
            "dbpass": db_pass,
            "dbname": db_name,
            "wtname": wt_name,
            "wtuser": wt_user,
            "wtpass": wt_pass,
            "wtemail": wt_email,
            "step": "6",
        }
    ).encode("ascii"),
)

from an external machine. I got a HTTP 200, but nothing really happened server side. wt_user remained empty. So, I'm back to square one.
I can wait a bit and test further if you want. If not, I'll restore my old data and close this issue.

Edit: I tried dtjs48jkt/webtrees and faced no issues. So I don't think this problem is unique to me.

@NathanVaughn
Copy link
Owner

Sorry I haven't gotten a chance to look at this until now.

Only running the setup wizard if a config file doesn't exist is deliberate, yes. The webtrees setup wizard is what creates that config file, and does some database initialization, and once that's done, there's no way to get back to it.

I don't know why the connection would be refused. The Apache server will have already started on a generic HTTP-only config such that the Python script can send that request to trigger the first-time setup. I've had 0 issues with it when running from a blank slate.

Running the docker-compose file in the repo:
image
You can see at the bottom the request gets sent and accepted.

I also tried a different database type

      DB_TYPE: "sqlite"
      DB_NAME: "webtrees"

and no issues again.

@SvbZ3r0
Copy link
Author

SvbZ3r0 commented Jun 22, 2022

This is extremely weird. My logs are, word for word, same as yours. But the issue is 100% reproduceable on my end. Pretty ironic considering Docker is supposed to fix exactly this issue XD
Anyway.. I'm using a different container now since that one doesn't cause me any issues.
However, if there's any way I can assist in testing and debugging this, let me know and I'll be happy to help.

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