ubyssey/ubyssey.ca

Create testing database

Closed this issue · 1 comments

When I test the site locally I use a copy of the database I downloaded from the google cloud. This is really nice because I don't have to set up everything manually for my local site to look like the actual site. But volunteers can't do this because they don't get access to the google cloud and there might be things in the database we don't want shared outside of the organization. We used to people to run a command to populate the local database but this was never updated once we moved from dispatch to wagtail. So now volunteers have to manually recreate their database which is bad. So this issue is about bringing back that ability to populate the database from a single command.

I think the easiest way to do this would be to download a copy of the database and use sql workbench to selectively delete rows.

What to delete/what to keep

  1. Delete all users and then run python manage.py createsuperuser to add email: volunteer@ubyssey.ca, password: volunteer
  2. Delete all but ~15 pages from every section. Make sure the remaining pages represent all the features in the site
  3. Delete all unused rows in other tables (authors, categories, etc)
  4. Upload the images used in articles to the repository so that volunteers don't have to enter cloud storage as an env variable when running the server

After that you run the sql flush command to get a file that creates the database you set up. We upload that to google cloud and make it publicly accessible so that volunteers can run curl https://storage.googleapis.com/ubyssey/dropbox/ubyssey.sql | mysql -u root ubyssey -p to run it on their local database to populate it

I added the database along with the image directory on our Google Cloud.