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

[WIP] docker-compose up #48

Closed kshitij10496 closed 5 years ago

kshitij10496 commented 5 years ago

Fixes #39

icyflame commented 5 years ago

@kshitij10496 To make what we discussed during the demo day, the steps would look something like this:

  1. a docker-compose file like the present one, but where the api container has a link to the postgres container
  2. A script like this one to restore the dump using pg_restore to the appropriate database.

The script should be fairly simple, I think this list of commands should give you a good idea of what you need to write (I will write it when I get time, posting this here just in case you are also working on this parallelly)

PG_CONTAINER=`docker ps --format '{{ .Names }}' | grep pg`
docker cp $1 $PG_CONTAINER:/
docker exec $PG_CONTAINER pg_restore -h postgres -U postgres $DB_NAME < $1

I think this should allow us to configure the hostname, database, user and password on the API container. (The last line of the above script will just be pg_restore $DB_NAME < $DUMP_FILE_NAME once we use the pgpass file)

kshitij10496 commented 5 years ago

Thanks a lot @icyflame for the follow-up. 😃

Feel free to send in a fix anytime you get time. I hope you have push access to this branch, if not, let me know.

icyflame commented 5 years ago

@kshitij10496 I opened a new PR. :slightly_smiling_face: I hope that's okay? Your commits are preserved in that as well.

kshitij10496 commented 5 years ago

Closing this in favour of #50