Skip to content

Commit

Permalink
🔨 Add recipe to start existing DB container
Browse files Browse the repository at this point in the history
  • Loading branch information
MaoDeMatos committed Feb 3, 2023
1 parent 546bc31 commit 603a2b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ start: ## Run Production build
clear: ## Clear generated files
rm -rf ${BUILD_PATH}

.PHONY: db-start
db-start: ## Start MongdoDB, in a Docker container
.PHONY: db-create
db-create: ## Create MongdoDB Docker container
docker run --rm -d --name ${MONGO_CONTAINER_NAME} -v mongodb-volume:/data/db -p 27017:27017 mongo:latest

.PHONY: db-start
db-start: ## Start MongdoDB container
docker start ${MONGO_CONTAINER_NAME}

.PHONY: db-stop
db-stop: ## Stop MongdoDB container
docker stop /${MONGO_CONTAINER_NAME}
docker stop ${MONGO_CONTAINER_NAME}

# Self-Documenting part
.PHONY: help
Expand Down
1 change: 1 addition & 0 deletions pkg/database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

var MongoClient *mongo.Client

// TODO: Fix app not throwing an error when database is not running
func StartMongoDB() {
fmt.Println("🔌 Connecting to database at " + config.Current.MONGO_URI + "...")

Expand Down

0 comments on commit 603a2b7

Please sign in to comment.