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?
Hmmm... one reason that heroku is rejecting the app could be that it is trying to detect asset pipeline in rails 3.1.x apps i think.
Why not create your app on the default stack Bamboo by running just
heroku create
Then all your js and css can go into public folder in rails app with asset pipeline deactivated.
A simple way is to masquerade the HTML app as a PHP App. Heroku properly identifies PHP apps.
Create an index.php file and include your entry html file. If your HTML entry file is named home.html as recommended, your index.php should look like:
<?php include_once("home.html"); ?>
In your command line on the machine you are pushing from, type:
git add .
git commit -m 'your commit message'
git push heroku master
Heroku should properly detect your app now as a php app:
-----> PHP app detected
-----> Bundling Apache version 2.2.22
-----> Bundling PHP version 5.3.10
-----> Discovering process types
Procfile declares types -> (none)
Default types for PHP -> web
-----> Compiled slug size: 9.9MB
-----> Launching... done, v3
...
Mad Thanks to lemiffe for his blog post: http://www.lemiffe.com/how-to-deploy-a-static-page-to-heroku-the-easy-way/
2020 Update:
If you get a blank page with the PHP answer mentioned here, try this -
If your homepage is at index.html
:
echo '<?php header( 'Location: /index.html' ) ; ?>' > index.php
echo '{}' > composer.json
Creating a Git repo and committing after adding files :
git init
git add .
git commit -m "My site ready for deployment."
Heroku deployment -
heroku login
heroku apps:create my-static-site-example
git push heroku master
Well , whenever your Web-page's contain HTML, CSS and JavaScript , so follow just 2 steps :
1) Make one file give name as index.html (keep evreything in it) ex:script,stylesheet & body.
2) Now, change these file, copy and paste these same file but change domain to index.php
Then deploy on a Heroku.
Hence this method will help you to deploy your Web-Pages
Follow this steps
Step 1
Type touch composer.json index.php index.html
Step 2 in the index.php type:
<?php include_once("index.html"); ?>
and in the composer.json type {}
Step 3
git add .
git commit -m "[your message]"
git push ['yourrepo'] ['yourbranch']
There's a very easy way to do it just in case anyone found the above answers hard to follow.
You have your static website with the root at index.html
(say), now you want to diploy it to Heroku, how?
git init # initialise a git repo
git add -A # add the files
git commit -m "init commit" # commit the files
# Now add two files in the root, composer.json and index.php like so -
touch composer.json
touch index.php
# Then add this line to index.php, making a PHP app and just asking it to display index.html -
<?php include_once("index.html"); ?>
# Now open composer.json and add an empty object -
{}
Now simply run git push heroku master
and you're done!