Start the production container with .env
same as .env.production
docker compose -f docker-compose.yml up -d
Then enter the course-mongo
container with
docker exec -it course-mongo mongosh
And execute the following commands:
use admin
db.auth("eeinfo", "R9ujPAQBk4X2fdkv")
use ntuee-course
db.createUser(
{
user: "eeinfo",
pwd: "R9ujPAQBk4X2fdkv",
roles:[
{
role: "dbOwner",
db: "ntuee-course"
}
]
}
)
db.grantRolesToUser("eeinfo", ["dbOwner"])
Quit from the mongo container, then enter the course-backend
container
docker exec -it course-backend sh
Execute the command to reset database
npm run database reset
And set the admin password
npm run database admin -- -p ${ADMIN_PASSWORD}