Authorization configuration in Docker
Creating backup and clearing MongoDB data
Creating backup
Navigate to the root directory of the Passwork installation:
cd /<passwork>/
Run the backup creation script:
- shell
./db-backup.sh
Clearing collections and data
Please ensure that the backup was created correctly before proceeding further.
Stop and remove the passwork_db container:
- shell
docker compose down db --volumes
Creating MongoDB user and starting container
Creating user
Edit and supplement the .env variables file. Insert the following lines and substitute your own values:
- shell
# Database username during initialization.
MONGO_INITDB_ROOT_USERNAME=adminuser
# Database user password during initialization.
MONGO_INITDB_ROOT_PASSWORD=password
The following characters are prohibited in the username and password as they may cause connection failures to MongoDB: . @ $ : % " ' / \ |
Starting container
Start the passwork_db container:
- shell
docker compose up -d db
Check the running container:
- shell
docker ps | grep passwork_db
Restoring from backups and connecting Passwork
Restoring databases
Run the restore script:
- shell
./db-restore.sh
Specify the backup created in the first step:
Enter the backup file name to restore: mongo-xxxx-xx-xx-xx:xx:xx.dump
Verify connection to MongoDB with authorization:
- shell
docker exec -it passwork_db mongosh "mongodb://adminuser:password@localhost:27017"
Configuring and connecting Passwork with authorization
Edit the Passwork configuration file /<passwork>/conf/keys/config.env:
MONGODB_USERNAME=adminuser
MONGODB_PASSWORD=password
Save the changes and refresh the Passwork page to verify connection with MongoDB authorization.