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

How to create admin user when using docker #1128

Open
sepastian opened this issue Dec 6, 2022 · 10 comments
Open

How to create admin user when using docker #1128

sepastian opened this issue Dec 6, 2022 · 10 comments

Comments

@sepastian
Copy link

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
Copy link
Collaborator

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
Copy link
Author

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
Copy link
Collaborator

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

@sepastian
Copy link
Author

With admin/[blank] I get:

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

@sepastian
Copy link
Author

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

@StephanMa
Copy link
Collaborator

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

@sepastian
Copy link
Author

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
Copy link
Collaborator

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
Copy link
Collaborator

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

@StephanMa
Copy link
Collaborator

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

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