Skip to content

Commit

Permalink
fix: docker compose dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Pradumnasaraf committed May 27, 2023
1 parent f1b6979 commit 60b9503
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .env.docker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MONGO_URL=mongodb://go-mongodb:27017
MONGO_URL=mongodb://db:27017
MONGO_DB=opensource
MONGO_COLLECTION=contributors
PORT=8088
Expand Down
21 changes: 2 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
## GO API
## Contributors

A simple API to do CRUD operations on a database.

## Tech Stack

- [Golang](https://golang.org/)
- [MongoDB](https://www.mongodb.com/)
- [Gin](https://github.com/gin-gonic/gin)
Contributors is a GraphQL API written in Go. It uses MongoDB as a database. It is a simple API to manage Open Source Contributors and their contributions.

## Using and developing

Expand Down Expand Up @@ -43,17 +37,6 @@ Then, run the following commands to start the server. It will step up a MongoDB
docker compose up
```

## API Endpoints

- `GET /` - Homepage
- `GET /api/movie/{id}` - Get a movie
- `GET /api/movies` - Get all movies
- `POST /api/movie` - Create a movie
- `PUT /api/movie/{id}` - Mark a movie as watched
- `DELETE /api/movie/{id}` - Delete a movie
- `DELETE /api/movies` - Delete all movies


## License

This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) for details.
Expand Down
28 changes: 21 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,30 @@ services:
dockerfile: Dockerfile
image: go-api
ports:
- 8088:8088
env_file:
- .env.docker
database:
- 8080:8080
environment:
- MONGO_URI=mongodb://db:27017
- MONGO_DB=opensource
- MONGO_COLLECTION=contributors
- PORT=8080
- BASIC_AUTH_USERNAME=opensource
- BASIC_AUTH_PASSWORD=greensquare
depends_on:
- db
networks:
- go-network

db:
container_name: go-mongodb
image: mongo:5.0
ports:
- "27017:27017"
image: mongo:6.0
volumes:
- dbdata:/data/db
networks:
- go-network

volumes:
dbdata:

networks:
go-network:
driver: bridge

0 comments on commit 60b9503

Please sign in to comment.