muety / anchr

⚓️ Anchr provides you with a toolbox for tiny tasks on the internet, especially bookmark collections
https://anchr.io
GNU General Public License v3.0
278 stars 27 forks source link

MongoServerError: Authentication failed #74

Closed USFAkbari closed 3 months ago

USFAkbari commented 3 months ago

MongoDB Server Error

Authentication failed

While attempting to execute the docker compose up command, I encountered an "Authentication failed" error related to MongoDB.

Despite my efforts to address this issue across various commits that were verified within the repository, I found that all versions exhibited this persistent bug. Although I successfully resolved other related issues, the specific problem of MongoDB authentication not being properly managed remains unresolved. This has significantly hindered the deployment process, and I am currently seeking a comprehensive solution to ensure smooth authentication and functionality within the application environment.

I would be glad to assist you in resolving the error you are encountering. Please provide specific details about the error message or issue, including any relevant context or steps that led to its occurrence. This information will help me offer more targeted guidance to effectively address the problem.

USFAkbari commented 3 months ago

I Want to Use Anchr Locally on My Virtual Machine

muety commented 3 months ago

You'll need to create an .env file (possibly use .env.example as a template), choose a database password (and other config options) there (see configuration), then source the env file (see here) and run the Docker compose.

USFAkbari commented 3 months ago

I completed all configurations, but I can't authenticate the user from Mongosh.

USFAkbari commented 3 months ago

I handle this error with edit Mongo script you can change .env argument to

mongosh -u userAdmin -p userPassword --authenticationDatabase admin <<EOF
use $MONGO_INITDB_DATABASE;
db.createUser({
  user: "$DB_USER",
  pwd: "$DB_PASSWORD",
  roles: [
    {
      role: "dbOwner",
      db: "$MONGO_INITDB_DATABASE"
    }
  ]
});
EOF

I encountered a bug while using "Bower install" and a Dockerfile.