icaruseu / mom-ca

Monasterium.net (http://www.monasterium.net/mom) - repository and collaborative archive
https://github.com/icaruseu/mom-ca/wiki
GNU General Public License v3.0
17 stars 11 forks source link

How to create admin user when using docker #1128

Open sepastian opened 1 year ago

sepastian commented 1 year ago

Please describe, how to create an initial admin user when running the Docker image.

I found https://github.com/icaruseu/mom-ca/wiki/Create-an-initial-user, but I can't find the db/mom-data/xrx.user inside the Docker container.

StephanMa commented 1 year ago

What do you mean with admin-user?

There is one created while building mom-ca. The password should be inside of your docker-compose file. Please distinguish between ADMIN (backend) and... moderator/and other frond end... You can still log on with the admin account and gibe yourself permissions

sepastian commented 1 year ago

I tried, without success:

# destroy container, just to be sure
docker compose rm -sf

# my .env file
PASSWORD=admin

# start container
docker compose up

When I try to login at localhost:8181/login2 with admin/admin, I get "Wrong password, please try again."

What am I missing?

StephanMa commented 1 year ago

maybe there is something wrong with mapping the password. Have you tried accessing mom without a password? admin / [blank] ?

sepastian commented 1 year ago

With admin/[blank] I get:

XML Parsing Error: no root element found
Location: http://localhost:8181/mom/
Line Number 1, Column 1:
sepastian commented 1 year ago

Ah, wait... but after reloading the page, I seem to be logged in as admin.

StephanMa commented 1 year ago

Strange... it should work on first try without any errors... But hopefully you're able to work

sepastian commented 1 year ago

I can login, but the password for "admin" is always blank. I also cannot change it to another value.

I'm verifying that the value of PASSWORD from .env is forwarded:

$ cat .env
export PASSWORD=testtest

$ grep PASSWORD docker-compose.yml
        MAIL_PASSWORD: ${MAIL_PASSWORD}
        PASSWORD: ${PASSWORD}

$ docker compose convert | grep PASSWORD
WARN[0000] The "MAIL_USER" variable is not set. Defaulting to a blank string.
WARN[0000] The "MAIL_PASSWORD" variable is not set. Defaulting to a blank string.
WARN[0000] The "MAIL_FROM_ADDRESS" variable is not set. Defaulting to a blank string.
WARN[0000] The "SMTP_URL" variable is not set. Defaulting to a blank string.
        MAIL_PASSWORD: ""
        PASSWORD: testtest

So docker-compose seems to be resolving the password set in .env correctly.

However, when I log into the container, there's no password:

$ docker compose exec momca /bin/bash

$ echo $PASSWORD
(no output produced)

Is something inside the container unsetting "PASSWORD"? Or does the container not pick up the password?

If you try running the docker container, does setting the password through .env work for you?

StephanMa commented 1 year ago

the password is stored in build.properties.xml not as an .env variable in the linux distro. Please have a look at the build.properties.xml in the mom.XRX folder

StephanMa commented 1 year ago

I don't use mom in docker... I have it run bare metal

StephanMa commented 1 year ago

If you really need to... you can always change the password via the exist-db dashboard