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 #49

Closed icyflame closed 5 years ago

icyflame commented 5 years ago

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)

kshitij10496 commented 5 years ago

Thanks a lot for the PR! ❤️

Works for me locally so this should be good to go. I'll give it a more thorough review later tonight. 😄

kshitij10496 commented 5 years ago

@icyflame This PR targets merge to my other PR in #48. Was this intentional? Should I merge both of them in now?

P.S: The reason that Circle CI was not working on this PR was probably that the merge branch was not master.

icyflame commented 5 years ago

@kshitij10496 That was my mistake. I should have selected master. I will fix this. Since you are okay to merge, I will go ahead and merge this in.