Deploy
DocPad websites can be deployed anywhere. Here are a few of the most common deployments.
Deploying DocPad
Preparing DocPad for Deployment
Ensure your project's
package.json
file contains the following:package.jsonCorrect dependencies with what you are actually using.
To Static Servers (Apache, Nginx, etc.)
For deployment to a Custom Static Server
Perform a generation for a static production environment using
docpad generate --env static
Upload the generated directory to your server's
public_html
orhtdocs
directory
Deploy to GitHub Pages using the plugin
For deployment to a Cloud Data Storage Provider (AWS S3, Google Storage, etc.)
To a Node.js Hosting Provider
Create a
Procfile
file inside your project that contains:ProcfileSet your heroku instance to run in production mode
Login to your domain's DNS manager
Create an CNAME Record for your domain pointing to your app url (e.g.,
balupton.herokuapp.com
)
Create a new OpenShift application for your project:
Set environment variables using:
If you'd like a custom domain, run:
Then create CNAME record with your DNS host pointing
PROJECTWEBSITE.COM
toPROJECTNAME-YOUR_OPENSHIFT_NAMESPACE.rhcloud.com
If you don't know what your OpenShift namespace is, run:
And it will be listed within the SSH URL.
Deploy your project's code to openshift:
You should be all good now! Check the logs of your app with:
- deploy.sh
- web.config
Continuous Deployment
To GitHub Pages
Inside your project directory, do the following:
Add a deploy script to your
package.json
"scripts"
section:package.jsonRemove the
regenerateEvery
property from your DocPad Configuration File if you have set it, as it will no longer be needed.
Using Travis CI
Inside your GitHub account, do the following:
Enable Travis CI for the repository, then inside the repository directory, do the following:
Run the following commands (with the appropriate substitutions):
Commit and push the changes.
If you want to regenerate your website when an external GitHub Repository changes (for instance updating the DocPad Website when the DocPad Documentation repository changes), you will need to Enable Travis CI for that repository, then inside that repository directory, do the following:
Run the following commands (with the appropriate substitutions):
Commit and push the changes.
All done, your next push to master will be automatically deployed.
Using Circle CI
Inside your project directory, do the following:
Commit and push the changes.
Create a SSH Key that will be used by Circle CI to deploy to GitHub Pages, do this by:
Create the SSH Key, make note of where it goes, don't bother with a password, use the email that was inside your
circle.yml
file:Make note of it's location. Two files will be generated. One with
.pub
at the end, which is the public key, and one without.pub
which is the private key.
Inside your Circle CI account, do the following:
Add any environment variables you may need via
Project Settings -> Tweaks -> Environment Variables
Add the private key to CircleCI via
Project Settings -> Permissions -> SSH Permissions
. Set the hostname togithub.com
. Use the contents of the private key file for the private key text area.
Inside your GitHub Project Settings, do the following:
Add the public key to your GitHub Project by going to
Settings -> Deploy Keys -> Add deploy key
. Specify the title asCircleCI Deployment
or whatever you like and set the key text area to the contents of the public key. Allow write access.
If you want to regenerate your website when an external GitHub Repository changes (for instance updating the DocPad Website when the DocPad Documentation repository changes), you will need to:
Go to the settings of the GitHub Repository that should cause the regeneration, and access
Webhooks & Services -> Add webhook
Specify the
Payload URL
to be:Specify
Content type
to beapplication/json
, selectJust the push event
, and checkActive
You can hit that Payload URL whenever you want to retest and rebuild your project.
All done, your next push to master will be automatically deployed.
You can now delete the local SSH key files that were made, as they serve no further purpose.
To GitLab Pages
Just add single file .gitlab-ci.yml
to project root:
Last updated
Was this helpful?