Deploy Morpheus on Heroku

This blog is hosted on Heroku.

This is the procedure.

Work on local

Currently, Morpheus isn't published to npm yet.

https://github.com/vesparny/morpheus/issues/14

You need to set up Morpheus in reference to README

% mkdir morpheus-sample && cd morpheus-sample
% git init
% git remote add morpheus -m master https://github.com/vesparny/morpheus.git
% git pull -s recursive -X theirs morpheus master
% npm install
% gulp install
% gulp watch

Now you can access your blog at http://localhost:3000/ .

Create Application on Heroku

  • You need to create an application on Heroku for your blog.

create application

Heroku Config Variables

  • Set NODE_ENV as production to config variable.

heroku config

Setting production.json

  • Add URL, IP and Port to production.json.
module.exports = {
  siteUrl: 'http://{YOUR_APP_NAME}.herokuapp.com',
  ip: '0.0.0.0',
  port: process.env.PORT
};

Build

% gulp build --env=production
[01:08:52] Using gulpfile ~/work/github/morpheus-sample/gulpfile.js
[01:08:52] Starting 'clean'...
[01:08:52] Finished 'clean' after 7.47 ms
[01:08:52] Starting 'build'...
[01:08:52] Starting 'styles'...
[01:08:53] gulp-ruby-sass: directory
[01:08:53] gulp-ruby-sass: overwrite main.css
[01:08:53] Finished 'styles' after 1.53 s
[01:08:53] Starting 'browserify'...
[01:09:05] Finished 'browserify' after 12 s
[01:09:05] Starting 'replace'...
[01:09:05] Finished 'replace' after 56 ms
[01:09:05] Starting 'server'...
[01:09:05] Finished 'server' after 142 ms
[01:09:05] Starting 'watchers'...
[01:09:05] Finished 'watchers' after 33 ms
[01:09:05] Finished 'build' after 14 s
[gulp] [nodemon] v1.3.2
[gulp] [nodemon] to restart at any time, enter `rs`
[gulp] [nodemon] watching: *.*
[gulp] [nodemon] starting `node server.js`
[2015-01-23T16:09:13.427Z]  INFO: app/morpheus/64856 on koba04.local: creating express application
[2015-01-23T16:09:13.592Z]  INFO: app/morpheus/64856 on koba04.local: Worker 64856 is running morpheus@0.0.1-alpha1 in production mode on port NaN
  • Now dist *.min.js and *.min.css were generated for production environment.

Deploy

% git add .
% git commit -m 'first commit'
% heroku login
Enter your Heroku credentials.
Email: xxxxx
Password (typing will be hidden):
Authentication successful.
% heroku git:remote -a morpheus-sample
Git remote heroku added
% git push heroku master
Counting objects: 2160, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (659/659), done.
Writing objects: 100% (2160/2160), 1.06 MiB | 404.00 KiB/s, done.
Total 2160 (delta 1304), reused 2160 (delta 1304)
remote: Compressing source files... done.
:
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing... done, 10.4MB
remote: -----> Launching... done, v4
remote:        https://morpheus-sample.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/morpheus-sample.git
 * [new branch]      master -> master

Now you can access http://{YOUR_APP_NAME}.herokuapp.com/ !

Heve fun!

Note

> Apps that have only one 1X or 2X web dyno running will have that web dyno sleep after one hour of inactivity.

https://devcenter.heroku.com/articles/dynos#dyno-sleeping

Built with love using Morpheus - blablabla theme inspired by Casper