Seeding with production Node environment

20 views
Skip to first unread message

Jef Harkay

unread,
Aug 4, 2014, 4:39:22 PM8/4/14
to
I'm trying to seed my production database, and it appears that seeding just won't take with this... I've got my production seed directory as a sibling to the development directory, and I've got the exact same seeds in both dirs.

schema.js

schema('mongodb', {
  host
: 'localhost',
  database
: 'blah-' + process.env.NODE_ENV
}, function() {
 
require(process.cwd() + '/app/Blah.js')(define, property);
});
console
.log(process.env.NODE_ENV);

Blah.js

module.exports = function(describe, property) {
 
var Blah = describe('Blah', function() {
    property
('id', String);
    property
('name', String);
 
});
 
return Blah;
};

db/seeds/production/Blah.coffee
and db/seeds/development/Blah.coffee

Blah.seed ->
  id
: ""
  name
: "blah"



NODE_ENV=development compound seed
(works, and I can see the DB entry)
NODE_ENV=production compound seed returns Compound's usage:

Warning: connect.session() MemoryStore is not
designed
for a production environment, as it will leak
memory
, and will not scale past a single process.
Usage: compound command [argument(s)]

Commands:
  h
,  help [topic]        Display compound man page
  i
,  init                Initialize compound app
  g
,  generate [smth]     Generate something awesome
  r
,  routes [filter]     Display application routes
  c
,  console             Debug console
  s
,  server [port]       Run compound server
  x
,  install [module]    Install compound module
  db
, db [migrate|update] Migrate or update database(s)

Available generators:

  app

In seedjs/lib/railway-tools.js, compound.tools.seed is never executed for production, as I tried putting a console.log in there (and it didn't output the console.log for prod).  Any ideas?  What am I doing wrong?

Jef Harkay

unread,
Aug 5, 2014, 9:45:20 AM8/5/14
to compo...@googlegroups.com
Easy fix... in config/autoload.js, move seedjs from developmentModules to defaultModules.
Reply all
Reply to author
Forward
0 new messages