I\'m trying to deploy an open source project of mine to heroku, it is by necessity very simple with just static html and javascript. But do they not support static sites?
Here is a more elegant method: Just add a file called package.json
which tells Heroku to use harp as your server:
{
"name": "my-static-site",
"version": "1.0.0",
"description": "This will load any static html site",
"scripts": {
"start": "harp server --port $PORT"
},
"dependencies": {
"harp": "*"
}
}
and then deploy to Heroku. Done!
Further information: https://harpjs.com/docs/deployment/heroku
Here is what worked for me:
cd myProject
git init
heroku create myApp
heroku git:remote -a myApp
If the entry point is main.html
, create index.php
with this single line of content:
<?php include_once("main.html"); ?>
and then perform the following steps:
echo '{}' > composer.json
git add .
git commit -am "first commit"
git push heroku master
Go to http://myApp.herokuapp.com/ and your app should be online now.
You can use rack to do this:
https://devcenter.heroku.com/articles/static-sites-on-heroku
or you can use something like Octopress/Jekyll who uses sinatra.
But you need a minimum stack to serve html static content
I know this might be a little old but I ended up using Vienna Gemw to deploy this, basically its a small Rack application that will let you serve everything in your public folder (css, images, js, html) with just a couple of lines of Ruby:
require 'vienna'
run Vienna
Also, for deploying this on heroku you need to create a Gemfile:
source 'https://rubygems.org'
gem 'rack'
gem 'vienna'
Then run bundle install, in case you don't have the bundle gem installed just run on your terminal:
sudo gem install bundle
And thats pretty much of it, you can have more information on: http://kmikael.com/2013/05/28/creating-static-sites-in-ruby-with-rack/