DocPad websites can be deployed anywhere. Here are a few of the most common deployments.

To a Node.js Hosting Provider

Inside your website's directory

  1. Add the following to your website's package.json file. Add all the dependencies you are using and make sure their versions are correct - as well as ensure all commas are correctly placed.

     "engines" : {
         "node": "0.10",
         "npm": "1.4"
     },
     "dependencies": {
         "docpad": "6.x",
         "docpad-plugin-blah": "2.x"
     },
     "main": "node_modules/docpad/bin/docpad-server",
     "scripts": {
         "start": "node_modules/docpad/bin/docpad-server"
     }
    

For deployment to Heroku

  1. Create a Procfile file inside your project that contains:

     web: node_modules/docpad/bin/docpad-server
    
  2. Set your heroku instance to run in production mode

     heroku config:add NODE_ENV=production
    
  3. Follow the rest of the Heroku guide here

For deployment to AppFog

  1. Create a app.js file inside your project that contains:

     module.exports = require(__dirname+'/node_modules/docpad/out/bin/docpad-server');
    
  2. Follow the rest of the AppFog guide here

For deployment to Windows Azure

  1. Create a deployment script that triggers the static content generation. To create the script run the following command using the Windows Azure CLI Tools:

     azure site deploymentscript --basic -t bash
    
  2. Modify the deploy.sh file by chaning the # Deployment section to the following lines. You can see a complete example of the deploy.sh file here.

     echo Handling deployment.
    
     # 1. Install npm packages
     if [ -e "$DEPLOYMENT_SOURCE/package.json" ]; then
       cd "$DEPLOYMENT_SOURCE"
       npm install --production --silent
       exitWithMessageOnError "npm failed"
       cd - > /dev/null
     fi
    
     # 2. Build DocPad Site
     echo Building the DocPad site
     cd "$DEPLOYMENT_SOURCE"
     node ./node_modules/docpad/bin/docpad generate
     exitWithMessageOnError "Docpad generation failed"
    
     # 3. KuduSync
     echo Kudu Sync from "$DEPLOYMENT_SOURCE/out" to "$DEPLOYMENT_TARGET"
     $KUDU_SYNC_COMMAND -q -f "$DEPLOYMENT_SOURCE/out" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.deployment;deploy.sh" 2> /dev/null
     exitWithMessageOnError "Kudu Sync failed"
    
  3. Last, create a web.config file in the static directory of your site with the URL rewrite rules shown below. These rules remove the HTML extensions from your URLs. You can see the main portions of this web.config file below. You can download the complete file here.

     <rule name="RemoveHTMLExtensions" stopProcessing="true">
         <match url="^(.*)\.html$" />
         <action type="Redirect" url="{R:1}" appendQueryString="true" />
     </rule>
     <rule name="RewriteHTMLExtensions" stopProcessing="true">
         <match url="(.*)" />
         <conditions>
             <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
             <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
         </conditions>
         <action type="Rewrite" url="{R:1}.html" />
     </rule>
    
  4. Follow the rest of the Azure guide here

For deployment to Nodejitsu

  1. Follow the rest of the Nodejitsu guide here

For deployment to Modulus

  1. Follow getting started guide

For deployment to Docker

  1. Checkout the DocPad Docker Forge guide

Optional: Custom domains

If you're also wanting to use custom domains for your website, follow the Heroku Guide here, or alternatively here is a generic guide:

  1. Ping your server (e.g., ping balupton.herokuapp.com)

  2. Grab the IP address from the output

  3. Login to your domain's DNS manager

  4. Create an A Record for your domain pointing to that IP address

To Static Servers (Apache, Nginx, etc.)

  1. Perform a generation for a static production environment using docpad generate --env static

  2. Upload the generated directory to your server's public_html or htdocs directory

    1. If you use rsync, checkout our DocPad rsync deploy script

For deployment to GitHub Pages

  1. Install the GitHub Pages Plugin

     docpad install ghpages
    
  2. Deploy to GitHub Pages using the plugin

     docpad deploy-ghpages --env static
    

For deployment to a Cloud Data Storage Provider (AWS S3, Google Storage, etc.)

  1. Checkout the DocPad Sunny Plugin
IRC Chat