Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

StuFaqs

Stu Salsbury edited this page Oct 6, 2013 · 8 revisions

Really just questions Stu had to answer for himself while learning Calipso. Might be handy if organized into the guide

Contents

I see layouts in themes, but how are they associated with URLs?

The router is the ulimate "decider". In the example of the "home" layout, the router is configured by the core content module to respond with the home layout when a URL of '/' is seen by the express server.

Exhibits:

content.js:

module.router.addRoute('GET /', homePage, {template:'list', block:'content.home'}, this.parallel());

further down in same file:

/**
 * Default home page, only specify the layout.
 */
function homePage(req, res, template, block, next) {
  res.layout = "home";
  next();
}

How can I move my data between environments?

There is no magic bullet, but the following has worked (for a simple configuration without a lot of content!)

echo 'dumping source database to directory'
mongodump -h <sourceServerName>:<sourceServerPort> -d <sourceDbName> -u <sourceDbUser> -p <sourceDbPassword> -o <pathToSourceDumpDirectory>

echo 'avoiding confs so we can handle it seperately'
rm -rf <pathToSourceDumpDirectory>/<sourceDbName>/confs.*

echo 'exporting confs as json -- do this only if you are migrating parts of your configurations'
mongoexport -h <sourceServerName>:<sourceServerPort> -d <sourceDbName> -c confs -u <sourceDbUser> -p <sourceDbPassword> -o <pathToSourceDumpDirectory>/confs.json

now tweak your confs.json file -- for example, change the URL and the environment to suit the destination environment

echo 'importing confs -- do this only if you are migrating parts of your configurations'
mongoimport -h <destServerName>:<destServerPort> -d <destDbName> -c confs -u <destDbUser> -p <destDbPassword> --file <pathToSourceDumpDirectory>/confs.json

echo 'restore everything else'
mongorestore -h <destServerName>:<destServerPort> -d <destDbName> -u <destDbUser> -p <destDbPassword>  <pathToSourceDumpDirectory>/<sourceDbName>

echo 'clean up -- do not automate this -- you might want to inspect stuff'
rm -rf <pathToSourceDumpDirectory>