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

DB Replica for local development #21

Closed kshitij10496 closed 5 years ago

kshitij10496 commented 5 years ago

Here is my 2-fold proposal for sharing DB for local testing and development:

Exporting Production DB to a Dump

Importing Dump Locally

Considerations:

This is the simplest and the minimalist solution to the problem I could come up with. I have unapologetically prioritised ease of setup and involvement from beginner developers (KGP community centric) over other factors such as maintainance, contraptions of 3rd party cloud services.

Basically, I considered the points raised by @icyflame in the discussions and incorporated my personal trade-off choices while coming up with the solution. References:

  1. Importing and Exporting Heroku Postgres Databases
  2. How To Backup PostgreSQL Databases on an Ubuntu VPS

Resolves #8

cc @icyflame @thealphadollar @themousepotato @Ayushk4

icyflame commented 5 years ago

@kshitij10496 Looks good. This is a good way to make it easier for developers to contribute to hercules!

kshitij10496 commented 5 years ago

@icyflame Thanks for the support! ❤️

Being a pragmatist, I would request you guys to set up the database locally using the above method and share your feedback. This should help us evaluate the effectiveness of the proposed solution in practice. I plan on wrapping this up over the weekend and writing the Development Workflow. 😄

thealphadollar commented 5 years ago

LgTM too, :+1: I think this should be merged ASAP. I would also suggest adding the steps explained in the PR to the readme file.

kshitij10496 commented 5 years ago

Thanks @thealphadollar for the nod!

I would also suggest adding the steps explained in the PR to the readme file.

Sure. I will add this to the Development Workflow wiki and link it in the README. 😃

To rephrase what I said above, I would be more comfortable to merge this is if somebody can successfully import the DB using the steps I've outlined and report back here.

kshitij10496 commented 5 years ago

I will be merging this in as soon as I get 2 review approvals or 24 hours pass, whichever happens, the earliest. 😄

thealphadollar commented 5 years ago

Adding the below instruction link would be usefulf to anyone trying to restoring the DB.

https://www.godaddy.com/garage/how-to-install-postgresql-on-ubuntu-14-04/

@kshitij10496 , correction in the restoration command: pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgres -d hercules_testdb path/to/dump