Automated CI
/CD
of MongoDB
with docker-compose.yml
and .github/workflows
for GitHub Actions
.
Whitelist IPs so we can connect to the database from our local machine.
sudo ufw enable
sudo ufw allow from <IP-ADDRESS> to any port 27017
I set up a default root account and required authentication to access the database.
Note that when you pass a password you need to escape certain characters such as $
becomes %24
.
# connect from inside the linode
mongosh mongodb://root:password@localhost:27017/
# connect from local use connection string in compass
mongodb://admin:[email protected]:27017/
I named the volume dereck-mongo-data
.
docker volume ls
docker volume inspect dereck-mongo-data
# delete volume
docker volume rm dereck-mongo-data