Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Add Database Seeds #362

Merged
merged 5 commits into from
Jun 9, 2014
Merged

Add Database Seeds #362

merged 5 commits into from
Jun 9, 2014

Conversation

bascht
Copy link
Member

@bascht bascht commented Apr 25, 2014

For development it would be great to have a database seed

@bascht
Copy link
Member

bascht commented Apr 25, 2014

I'm in the happy position to have an SQL dump from @moonbeamlabs - but I'd appreciate solid seeds - so I'm gonna look into this. :)

@bascht
Copy link
Member

bascht commented Apr 25, 2014

@bitboxer if you're onto some hacken.in hacking tomorrow, it'd be great if you could take a look at this. I'm far away from being a rails-newbie, so this is just the result of me doing rake db:reset the whole 🚋 ride.

Some things are still beyond me:

  • db:reset creates 36 single_events with empty descriptions for the next months - so I had do start the database-seeds at 100 - I guess that's the normal behaviour?
  • I used the seed_dump gem to create some test-data - but I didn't know what to put in the ActAs_Something_ tables (ActsAsTaggableOn seemed to double the Tags table!?)
  • I didn't know what to fill in for the RadarEntry tables

So – long story short – I'd love to get some feedback. :)

@bascht bascht closed this Apr 25, 2014
@bascht
Copy link
Member

bascht commented Apr 25, 2014

dammit, waffle.io! 🎯

@bascht bascht reopened this Apr 25, 2014
@bitboxer
Copy link
Contributor Author

bitboxer commented May 1, 2014

Two questions:

What are the passwords of the users? I think it would be more clear if it doesn't use the encrypted passwords to create them. Use unencrypted in the seed would make this more readable.

Where are the images coming from? Mayby they should be downloaded from placekitten during seeding?

@bascht
Copy link
Member

bascht commented May 1, 2014

Good point.
I kicked the hashes & added the passwords (I'd love to have admin/admin and user/user but the Devise restrictions wouldn't let me :sob).

About the images: Downloading place-kittens only for bootstrapping the app is a bit over-the-top, imho. Would it be okay to supply three demo images in the fixtures folder and copy them over to the uploads-folder with the rake db:seed task?

@bitboxer
Copy link
Contributor Author

bitboxer commented May 1, 2014

it would be totally okay to put the files in there. The final thing that is missing would be the radar stuff. I will take over after you finished the images. Thanks!

bascht added a commit that referenced this pull request May 2, 2014
@bascht
Copy link
Member

bascht commented May 2, 2014

@bitboxer Done with 4374508 – so you can take over from here. I tested the file fixtures with my local VM and carrierwave picked up the files & resized them correctly (MAGIC!):

> tree public/uploads 
public/uploads
├── picture
│   └── box_image
│       ├── 1
│       │   ├── dog_barks_at_cloud.jpg
│       │   ├── small_dog_barks_at_cloud.jpg
│       │   └── thumb_dog_barks_at_cloud.jpg
│       ├── 2
│       │   ├── loads_of_cats.jpg
│       │   ├── small_loads_of_cats.jpg
│       │   └── thumb_loads_of_cats.jpg
│       └── 3
│           ├── happy_squirrel.jpg
│           ├── small_happy_squirrel.jpg
│           └── thumb_happy_squirrel.jpg
└── tmp

@bascht bascht assigned bitboxer and unassigned bascht May 5, 2014
bascht added a commit that referenced this pull request May 10, 2014
@bitboxer
Copy link
Contributor Author

@moonglum can you look at this when your system is setup? That would be the ideal time to run this and check if the seed is working for you 😉

@moonglum
Copy link
Member

I will try this together with the Vagrant thing!

@bitboxer
Copy link
Contributor Author

@moonglum as soon as you found time to check this, feel free to merge after it worked for you 😉

@bitboxer
Copy link
Contributor Author

@moonglum any news on this?

@moonglum
Copy link
Member

moonglum commented Jun 9, 2014

FINALLY!!! After a lot of fiddling around hacken.in is now finally running again on my machine 😆 It's running inside the VM!! Great work, DevOp department! I can now finally fiddle around with this ticket here!

screen shot 2014-06-09 at 21 01 53

@moonglum
Copy link
Member

moonglum commented Jun 9, 2014

What's the best practice of running unit tests when my app is running inside of the VM? Should I just boot up guard in there?

@moonglum
Copy link
Member

moonglum commented Jun 9, 2014

Rebased.

@moonglum
Copy link
Member

moonglum commented Jun 9, 2014

Ok, it works:

With Seed data

BUT: Only after I removed localeapp ENTIRELY (nuked from the Gemfile). It threw nil errors and everything... 👎

moonglum added a commit that referenced this pull request Jun 9, 2014
@moonglum moonglum merged commit 64dabdc into master Jun 9, 2014
@moonglum moonglum deleted the issues/362 branch June 9, 2014 19:26
@moonglum
Copy link
Member

moonglum commented Jun 9, 2014

Thanks, @bascht – step by step setting up hacken.in becomes easy (both locally and on the server) 👍

@bascht
Copy link
Member

bascht commented Jun 9, 2014

@moonglum up to you. The VM has both memcache and postgres tunneled to your computer, so you could also run the unit tests from your machine. :)

@moonglum
Copy link
Member

moonglum commented Jun 9, 2014

Ok, if I vagrant ssh and do the following:

cd /vagrant
bundle exec rake

I will get the following error:

rake aborted!
FATAL:  Peer authentication failed for user "travis"
/vagrant/app/models/user.rb:7:in `<class:User>'
/vagrant/app/models/user.rb:1:in `<top (required)>'
/vagrant/config/routes.rb:3:in `block in <top (required)>'
/vagrant/config/routes.rb:1:in `<top (required)>'
/vagrant/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => default => spec => test:prepare => db:test:prepare => environment
(See full trace by running task with --trace)

If I run it locally (with Vagrant running):

rake aborted!
could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

I use the database.yml_example as my database.yml

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants