0921_compressed.mov
-
Connect to your project env vault (visit dotenv website and login to your account first).
npx dotenv-vault@latest new vlt_your-project-vault
-
Pull the existing env vault.
npx dotenv-vault@latest pull
-
Open the env vault in your local workspace.
npx dotenv-vault@latest open
-
Make folder for env files (if you haven't created any)
# From the root project, create "env/" folder. mkdir env # Move all the .env related files into the "env/" folder. mv .env .env.me .env.vault env/
-
Make sure
start.sh
and the other shell scripts in/.docker
is executable.chmod +x .docker/keyfile.sh .docker/entrypoint.sh start.sh chmod +x start.sh
-
Run the script.
./start.sh # OR bash start.sh # OR zsh start.sh
-
(Optional): Open the Mongo DB shell (
mongosh
) in your bash terminalYou can open the MongoDB shell (mongosh) in your bash terminal to interact with your Mongo DB instance after your script has started the MongoDB containers. NOTE:
${DATABASE_NAME}
should usually be "admin".cd ./docker docker exec -it mongo1 mongosh -u ${USERNAME} -p ${PASSWORD} --authenticationDatabase ${DATABASE_NAME}
OR
cd ./docker # Opens a bash shell inside the mongo1 container first docker exec -it mongo1 bash # Then run mongosh (Mongo Shell) mongosh -u ${USERNAME} -p ${PASSWORD} --authenticationDatabase ${DATABASE_NAME}
-
Testing connection string as if connecting from client
You can login from the CLI as following:
mongosh --username ${USERNAME} --password ${PASSWORD} --host mongo1
OR
# Just directly pass a connection string. mongosh "mongodb://${USERNAME}:${PASSWORD}@localhost/${DB_NAME}"
Run the following script (Specify -v
to also remove volumes):
# From .docker folder:
cd .docker
docker-compose down -v
OR
# From root folder:
docker-compose -f .docker/docker-compose.yaml down -v
- Improving Code Quality in React with ESLint, Prettier, and TypeScript
- How to set up ESLint and Prettier in React TypeScript 5 project? 2023
- Setup a Node.js project with Typescript, ESLint, Prettier, Husky
- Https on Localhost for Vite and React, Vue, Vanilla, Svelte
- How to Secure Your NodeJS App with HTTPS and SSL Certificates
- How to configure docker container with https
- Real-Time Data Exchange: Building a Socket.io Backend Server in Node.js
- Real-Time Chat in a Phaser Game with MongoDB and Socket.io
- Prevent multiple socket connections and events in React (useContext)
- [Example] Building a chat app with Socket.io and React