Deploy HTML only app to Heroku? - deployment

Can I use Heroku to deploy an HTML prototype?
My HTML prototypes live on Github and Heroku would be a nice way to deploy them so clients can view them.
It seems that this is unsupported, since Heroku expects a Rails/NodeJS/[insert language here] structure or it won't run.
Push rejected, no Cedar-supported app detected
Are there any tricks to circumvent this?

The best solution would be to use a buildpack designed for hosting static content.
I'd suggest the experimental heroku/heroku-buildpack-static buildpack. In brief, just set the buildpack:
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-static.git
And add a static.json indicating which directory contains your static assets:
{"root":"public"}

The least effort solution is to rename your default file to index.php and redeploy. Heroku will detect it as a PHP site and use that buildpack.
Alternatively, you can follow this guide https://devcenter.heroku.com/articles/static-sites-ruby to set up a sinatra app to host it.

I've not done it before but since you mentioned using github. Why not use Github Pages to show the prototype.

You can always use an nginx buildpack to run nginx on heroku:
https://github.com/neilmiddleton/heroku-buildpack-nginx
I've used it with great success to handle a large batch of complex redirects and act as a reverse proxy to a new heroku app for an old, defunct application. Here's a simple config example that will get a static site up and running: https://gist.github.com/leklund/5877422.

Related

How to debug custom slug crashing

For various reasons we have decided to try to sidestep the slug-compilation and build our own slug locally to deploy through the API (as described here: https://devcenter.heroku.com/articles/platform-api-deploying-slugs).
The slug is built mostly like the java/scala buildpack using that buildpack jvm and is then combined with our play framework application dist file. Looking at the app dir of a normal/git-deployed app it looks aboutish the same.
Now, after deploying the slug through the api we get the expected dynos listed in the config page but the app crashes right away without giving any further information. Trying to attach a bash shell through heroku run bash it just times out.
Is there any way to get more information about why the app crashed out of heroku?
Ok, after some help from heroku support we figured out the following:
The slug tar files must be created so that the paths start with './' regular relative paths doesn't cut it. When we had that figured out we didn't really have any more big problems and now we have got a working alternative build and deploy to heroku pipeline that allows us to build or app locally and then deploy that.

Facebook API Integration: testing on different URL?

I'm trying to develop a website which uses Facebook Connect for authentication and other things. However, it seems that FBConnect in general requires the URL of the website to be the same one as you registered the app with. This is a problem, because although I'm running the site at
www.example.com
i am testing the site at
localhost:9000
So all the facebook stuff breaks on my local machine. Currently I'm simply working around this by doing testing on the actual server. So each time I want to test my code after doing stuff, I perform a
// local machine
git commit -a
git push origin master
// remote server
git pull origin master
Which apart from being annoying to do for every small change, is obviously going to be a problem when real people are actually reaching the website, and I want to continue development & testing without breaking it over and over while people are using it.
Is there a better way of doing this sort of thing? I'm sure others (i.e. everyone else who has ever used FBConnect) have run into this problem before. Is it possible to trick my DNS to point www.example.com at localhost during testing, so the Facebook Javascript is tricked to continue working?
One way around this is to edit your system's hosts file to point your domain to localhost. Add a line like this to your /etc/hosts file (or %SystemRoot%\system32\drivers\etc\hosts on windows):
127.0.0.1 www.yourdomain.com
Another approach is to create a second app on facebook for you in-development version, and use localhost as the URL for that version. Just don't forget to update the app id and secret to the production version when you deploy :)
The real answer here is to set up a staging server not located on your own localhost and create a staging application in FB pointing to that staging URL.
I like to use an entirely separate server for this purpose so I can develop and experiment at will without worrying about crashing my production application due to an errant loop or something.
--or--
Create a subdomain (staging.example.com) and stick a clone of your code in a separate root folder with the same directory structure as your application.
Yes, you will need some small conditional code to determine if you're looking at the staging or the production version of your site and then call the appropriate FB keys accordingly.
I ran into this problem when trying to move my code from development (localhost) to production. I was able to use localhost as the canvas url and my production domain for the secure canvas url. That way I was able to

Moving app to production mode in Symfony 2

Can someone help me to move my Symfony 2 application into production mode?
Currently, the application is running properly in /app_dev.php.
I'm googling, but I'm not finding a definite guide for deployment in Symfony 2.
Couple more things to consider:
php app/console cache:clear --env=prod --no-debug
php app/console assets:install web_directory
php app/console assetic:dump web_directory
You might also run into permission issues with the cache directory. I would actually first make sure everything works in development mode on the server before switching to production mode. And if all you get is blank screens in production mode then set debug to true. And of course know how to check your error logs.
Moving Symfony2 to production means :
access the application through : app.php/
Test dev bundles won't be loaded since there is a condition into the AppKernel.php when you use app.php. If you want to unload bundle that should be used only in dev, you can place them into the this section (in appKernel.php)
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Sf2gen\Bundle\GeneratorBundle\Sf2genGeneratorBundle();
}
You also need to make some server tuning by désactivating xdebug and adding eacclerator (or someting else for caching performance)
I also advice to rename app_dev.php to disactivate dev mode
Basic configuration information can be found here:
http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html
One important spot where many people stumble is asset management. When accessing the app via the app.dev front controller (see fist link), it may be necessary to dump the assets first. Read all about it here:
http://symfony.com/doc/current/cookbook/assetic/asset_management.html#cookbook-assetic-dumping
The Symfony CookBook has now a few recipes about deployment covering:
standard linux-based web-server: How to Deploy a Symfony2 Application,
Microsoft Azure Website Cloud: Deploying to Microsoft Azure Website Cloud,
Heroku Cloud: Deploying to Heroku Cloud.
Symfony2
How to Master and Create new Environments
http://symfony.com/doc/current/cookbook/configuration/environments.html

How to deploy a Zend Framework app on Heroku?

Basically for a Facebook tab I have a PHP app and want Heroku to use the 'public' folder as the web server's root folder instead of pointing to the very root of the app. Any help would be awesome as it seems Heroku doesn't have a ton of documentation around it's config options. Thank you.
I hosted my php codeigniter project on heroku lastmonth, so unless there is a server side configuration needed for your project. You should be able to host your zend project by pushing it as git repository to heroku. Just follow these tutorials.
http://www.youtube.com/watch?v=L2YlEIMrGxA
https://devcenter.heroku.com/articles/facebook
Not sure of that but Heroku's website says "Agile deployment for Ruby, Node.js, Clojure, Java, Python, and Scala.". But since there's no mention of PHP I think you can't deploy your Zend app on Heroku.
EDIT : my assertion was false, see comments
Thats not entirely correct (or no longer correct) - if you put a repository with an index.php in the root up it seems to recognise that as a php app.
The answer is not yet at least. They only offer the Facebook app hosting. I have gone with PHPFog for quick PHP hosting now.
EDIT: PHPFog is no more, now they have AppFog.

Best way for deploying websites?

How do you deploy your websites?
For example: I am developing a site with a php framework and have it under version controle with git with all my local configs. When I want to put it on a web server for testing or updating the live application i have to copy it onto the server, change the config files, delete my test stuff etc.
So how do you handle these tasks?
I thought about using ant and write a deployment script for this.
Does there already exists a common solution for this "problem"? Because I don't think im the only one who need something like this.
There are quite a bunch of stuff available, but you might like Phing (like ANT for java).
Questions related to PHP+Phing:
Do you use Phing?
How do you manage your build [using Phing] process?
Setting up a deployment / build / CI cycle for PHP projects
what can Phing do that Ant can't?
Also read this questions sounds very interesting How To Deploy Your PHP Applications Correctly?
There is a specific question (a possible duplicate of your questions) has been answered a while ago, take a look at it Deploy a project using Git push
It seems you are using php, you should be good to go with capistrano. It is very easy to use capistrano for deployment with rails but it can also be tricked a bit to use for php.
Basically what you do with capistrano is -
Tell it which is you application server
Tell you database server
Tell web server (in most cases web server, app server and db server are same)
Specify you git repository with branch you want to deploy from
Once configured, you can deploy with capistrano with single command. You can even rollback your deployments from some of backup releases created by capistrano.
Now form some the repetitive tasks like, copying configs files like database configs (which generally are ignored in git), you create some tasks, which just creates symlinks or copies the files at appropriate location. These tasks will be called with deploy_hookes e.g. after_symlink hook.
You can find more about capistrano here - https://github.com/capistrano/capistrano/wiki
It comes with very good documentation, after getting overview, you may search for your framework specific approach to do this.