Skip to content

Instantly share code, notes, and snippets.

@dirkk0
Created November 7, 2012 07:25
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dirkk0/4030008 to your computer and use it in GitHub Desktop.
Save dirkk0/4030008 to your computer and use it in GitHub Desktop.
deploy dillinger.io to heroku
# Thanks to Joe McCann for Dillinger!!!!!
# https://github.com/joemccann/dillinger
# this script doesn't work just by itself, you need to
# insert uris and keys that get created by heroku, dropbox and github
####### heroku ######
# install heroku toolbelt
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
heroku login
# get a key and tell heroku about it
cd ~/.ssh
ssh-keygen -t rsa -f id_rsa
heroku keys:add "id_rsa.pub"
cd -
####### node/npm ######
# we need that
apt-get install --yes libssl-dev
apt-get install --yes npm
####### dillinger.io ######
# get dillinger, perform install operations
git clone https://github.com/joemccann/dillinger.git
cd dillinger
mkdir -p public/files
mkdir -p public/files/md && mkdir -p public/files/html
# overwrite existing .gitignore file
# which contains a *-config.json
## throw away *-config.json
echo "
.DS_Store
node_modules/*
logs/*
public/files/*
backup/* " > .gitignore
####### Dropbox/Github #######
## create plugins
# Create your app with dropbox: https://www.dropbox.com/developers/apps
# -----
vi plugins/dropbox/dropbox-config.json
{
"app_key": "YOUR_KEY",
"app_secret": "YOUR_SECRET",
"callback_url": "http://YOUR_URI/oauth/dropbox",
"auth_url": "https://www.dropbox.com/1/oauth/authorize",
"request_token_url": "https://api.dropbox.com/1/oauth/request_token",
"access_token_url": "https://api.dropbox.com/1/oauth/access_token"
}
# Create your app with Github: https://github.com/settings/applications/new
# -----
vi plugins/github/github-config.json
{
"client_id": "YOUR_ID",
"redirect_uri": "http://YOUR_URI",
"client_secret": "YOUR_SECRET",
"callback_url": "http://YOUR_URI/oauth/github"
}
###### Prepare to start ######
## add this to package.json
## (see https://devcenter.heroku.com/articles/nodejs-support )
## (see https://github.com/isaacs/npm/issues/2563)
# "engines": {
# "node": "0.8.x",
# "npm": "1.1.x"
# },
## and this because lodash has some problems
## (see https://github.com/bestiejs/lodash/issues/101 )
# "lodash": "0.8.x",
# compile
npm i
## run, to see if it works
# node app.js
# prepare start file for heroku/foreman
echo "web: node app.js" > Procfile
## run, to see if it works with foreman
# foreman start
# if everything works, create the git
git init
git add .
git commit -m 'init'
#
heroku create
git push heroku master
# some commands you might need to debug
# heroku run bash
# heroku logs -n 500
# heroku logs --tail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment