Question

I'm trying to deploy my first DocPad website to the Gandi.net hosting provider, with this service : https://www.gandi.net/hebergement/simple?language=nodejs&grid=A

My code is here : https://github.com/nylnook/nylnook-website
It's running fine locally on my computer.

Technically it seem to be a 'vhost', and I'm supposed to write a "server.js" file to deploy DocPad in production to the gandi server, after I used :

git push gandi master

('gandi' being my git remote repo at their server)
and also used a custom command (XXX instead of my login) :

ssh XXXXX@git.XXX.gpaas.net 'deploy default.git'

They have a guide for their Node.js instance : http://wiki.gandi.net/en/simple/instance/nodejs?s[]=node and a guide for git usage on their servers : http://wiki.gandi.net/en/simple/git

that suggest to use this code : https://github.com/visionmedia/express/blob/master/examples/vhost/index.js

but I a newbie to node.js, learning with DocPad, so I can't figure how to do that !

Last link, the DocPad guide for deployment I followed so far : http://docpad.org/docs/deploy

Thanks for you help !

Edit : another lead maybe :http://docpad.org/docs/api#using-with-express

Était-ce utile?

La solution

Answering myself for documentation : you need to modify 3 files

in server.js (thanks plflannery : https://github.com/bevry/docpad/issues/819) :

var spawn = require('child_process').spawn

var args = ['server'];
spawn('node_modules/.bin/docpad', args, {stdio:'inherit'}).on('close', function(err) {

if (err)
    console.log("docpad failed");
else
    console.log("docpad running");

});

in docpad.coffee, put :

port: 8080

in docpadConfig fonction, to change default port (9778) to 8080, as required by Gandi, explanations here : https://github.com/bobobo1618/docpad-docum...

and in package.json put

"main": "server.js"

instead of

"main": "node_modules/docpad/bin/docpad-server"

So to launch docpad and install dependencies when deployment via Git.

Example of a working code : https://github.com/nylnook/nylnook-website

Good luck in your projects !

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top