kshitij10496 / hercules

The mighty hero helping you build projects on top of IIT Kharagpur's academic data
https://hercules-10496.herokuapp.com/api/v1/static/index.html
MIT License
34 stars 18 forks source link

Complete the docker and docker-compose files for development setup #50

Closed icyflame closed 5 years ago

icyflame commented 5 years ago

Note: Originally, opened as #49 with the wrong target branch. Discussion there applies.


Started from what @kshitij10496 had with #48. I have made some choices to optimize the development setup and make it easy to get started with:

Code is loaded as a volume instead of copying

While copying the binary is great for deployment, during development, we need a solution that will be easy to test out when the code changes (as it does during the dev phase)

Using pilu/fresh, it's possible to make it so that whenever a file on the host machine changes, the code is automatically rebuilt and the server is restarted.

Connect the containers using networks and aliases instead of links.

links is deprecated.

image

Write a script for restoring the init tables, databases, etc to Postgres

The data is not part of the DB container itself. In fact, the API will work fine without the DB being restored. All endpoints will return an error, but that's not part of the functionality. Restoring data is a separate step (done once), from starting the containers itself (might be done multiple times)

icyflame commented 5 years ago

@kshitij10496 I have the same code here, as in #49. You can merge this in! 🙂