Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anhcaooo/electric-mongo
Primary database for electric application
https://github.com/anhcaooo/electric-mongo
docker-image mongodb
Last synced: about 1 month ago
JSON representation
Primary database for electric application
- Host: GitHub
- URL: https://github.com/anhcaooo/electric-mongo
- Owner: AnhCaooo
- Created: 2024-09-07T17:40:16.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-10-26T17:43:48.000Z (about 2 months ago)
- Last Synced: 2024-11-11T03:04:51.359Z (about 1 month ago)
- Topics: docker-image, mongodb
- Language: Makefile
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# electric-mongo
A database for electric application
## Prerequisite
- Make sure you have [Mongosh](https://www.mongodb.com/docs/mongodb-shell/install/) installed on your machine.
- Docker in your machine or environment is up and running## Useful commands
### Access to MongoDB
In order to access to MongoDB, you can use the following command
```bash
docker exec -it mongosh -u -p
```### Navigate to specific database - collection
1. After access to MongoDB successfully, navigate to specific database
```bash
use
```2. If you want to navigate to a specific collection inside database
```bash
use
```### More options
If you are looking for more options, please see the [Run commands documentation](https://www.mongodb.com/docs/mongodb-shell/run-commands/)## Build Docker image
**Note**: in case you are planning to push your docker image, you first need to log in Docker (only in case you have not logged in)```bash
docker login -u "" -p "" docker.io
```#### Step 1
Build image locally
```bash
# Option 1 (not recommended)
docker build --tag : .# Option 2 (not recommended)
docker build -t : .# Option 3 (recommended)
# this command by default will build image with tag version 'latest'.
# this is an enhancement when before the image is built, all unit tests will be executed
make docker
```#### Step 2
**Note**: firstly need to log in Docker (only in case you have not logged in)```bash
docker login -u "" -p "" docker.io
```Tag image
```bash
docker tag : /:
```#### Step 3
Push image to Docker hub
```bash
docker push /:
```## Run Docker image locally
```bash
docker run --name electric-mongo -d -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME= -e MONGO_INITDB_ROOT_PASSWORD= :
```