Can I use two languages in a Heroku app? - ruby

I want to use Node.js as a Share.js server and Ruby for the frontend. As far as I know, Heroku only allows one web-facing process called "web". Does anyone have some experience trying to do something like this?

No, Heroku detects the application type when you push your code to Heroku and it compiles the slug. You'd need to have them as seperate applications with a defined API between the two (not always a bad thing)
UPDATE: You can 'stack' buildpacks these days, eg Ruby + PHP so you could have both executed. See https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app for how to use multiple buildpacks in the same app.

As a caveat, you technically can install two languages on a single app — but I'm not sure about running them concurrently. I made this buildpack to combine NodeJS and PHP (so that I could run Grunt during the slug compilation):
https://github.com/gcpantazis/heroku-buildpack-php-gruntjs
The language detection is usually fairly dumb; it'll be looking for a file indicative of the lang, i.e. index.php or a rakefile. You'll have to change the detect bin so that your code will pass.
Update:
Even better, consider using https://github.com/ddollar/heroku-buildpack-multi ; it'll let you install buildpacks sequentially. Depending on your application you might need to find language buildpacks that don't have verification steps, i.e. checking for a package.json file in a NodeJS app.

Yes, it is mostly possible I believe, as long as you're not doing something very tricky. I once deployed a Flask (Python) app that used Stanford's CoreNLP - which is all written in Java. You will need heroku-buildpack-multi.
After adding this, make sure to make a .buildbacks file and add all the buildpacks you will be needing from the Heroku github.
This circumvents Heroku detecting your app type itself and makes it install all necessary buildpacks from the .buildpacks file.

Related

Push but not compile on Heroku

Is it possible to just commit things "quickly" to heroku without to have the whole thing parsed/compiled/reinstalled ? Sometimes i feel like it is not needed (for html or css for example)
Thanks for you help
The short answer is no.
The longer answer is yes, provided you are prepared to write your own custom buildpack. It also depends on your technology. Most Heroku buildpacks compile code from source as part of the application deployment. It is possible to create a custom buildpack that takes a pre-compiled binary instead, only updating the application's data or configuration.
For more information see:
https://devcenter.heroku.com/articles/buildpacks
http://www.petekeen.net/introduction-to-heroku-buildpacks

Can you install Google Protocol Buffers on Heroku?

Context
I'm new to Heroku, and fairly new to Google Protocol Buffers.
Steps Taken
Searched Stack Overflow
Searched Heroku help
Searched Google
Question
Is there way to install the Google Protocol Buffers on the Heroku platform?
You do not need to "install" Protobufs to use it at run-time. Just bundle the Protobuf Python code and the code generated by the Protobuf compiler together with your application's other code. The compiler (protoc) is only needed to generate code; it is not used when your application actually runs. So, there should be no problem.
If you want to use the experimental C-extension-backed implementation (which is off by default), you will also need to include the .so file implementing the extension. I am not personally very familiar with C extensions so I'm not sure exactly where you're supposed to put it, but again, you should be able to bundle it with your application without installing anything. I am also not very familiar with Heroku so I do not know if they will let you run C extensions -- I know that AppEngine, in comparison, does not allow extensions.

Any buildpack that can deploy Meteor with PhantomJS support on heroku?

I'd like to run a Meteor.js app with the "spiderable" package on Heroku. Is there a buildpack or anything else to deploy it on Heroku? (PhantomJS in needed)
This buildpack (which I wrote) works with Meteor > 0.9.3 and includes phantomjs:
https://github.com/AdmitHub/meteor-buildpack-horse
I don't know how you're stuck with this, since in practice it's pretty straightforward to install an NPM module as shown in this guide. You only need to swap underscore in that example with phantomjs.
A very good buildpack to use is oortcloud's meteorite buildpack. I've used the meteor-only buildpack, but I've encountered way to many issues with it, but with the aforementioned I have had no problems with it so far.
As for the spiderable package, meteor add spiderable.
Fair warning though: running Meteor on Heroku requires alot of research on how to actually run your app, especially with providing correct environment variables. If you will have a problem with that, this would probably not a good place to discuss any of that.
On a side note: Next time, I implore you to be a little more clear about your problem and specify what your goals really are, and what have you tried so far. Seriously, who upvotes these things?

Any existing pure PHP "make" tools?

Let me elaborate on the question...
I have a custom CMS (built on codeigniter FTW) that includes many different types of modules.
Every time we have a new project come through the door, it is a variation and amalgamation of a few of the existing modules.
Sometimes a project comes through with requirements that are not satisfied by the existing modules, in that case I will write a new module...
All the modules are separated out in folders and the code is VC-ed using GIT. Every module has it's own Model, View, Controller, SQL and Javascript files. All the dependencies are also separated and folder-ed nicely...
The next step for me is to create some sort of installer script that will take me through the "scaffolding" process step by step, allowing me to choose from the existing modules. A glorified "makefile" if you may...
Rather than rolling my own, does anyone know of any such thing out in the wild.
I know of Apache ANT (java), what I need is something in pure PHP with very low or no dependencies...
I would like something as simple as running a git pull and then php make.php
Thanks.
The "Ant-like" alternative I am aware of in PHP land is phing it is written in PHP and it will allow you to perform several tasks for packaging, deploying and testing your web applications. The documentation is a great starting point if you want to hit the ground running.
It is can also be extended to define new tasks if needed (examples and explanations are provided in the documentation)
Reading through the doco it appears to be possible to install Phing without PEAR as documented here you would have to correctly setup the environment on each machine you wish to use Phing on. I can not confirm this method though as I use PEAR for all my installs.

sharing ruby code within an organisation

Me and my team are starting to build up a few re-usable scripts. They're re-usable within our org only as they work with proprietry apps and our particular server environment. So not really suitable for rubyforge or github, etc.
My question is, what is the best practice for ensuring we're all using the latest and greatest scripts across all users? We pretty much run these scripts on one server, but may need to expand to others.
Should we bundle them into gem(s) and start a private gem server?
Or something simpler like a common, shareable lib directory. Perhaps with a script to download/update from our SCM?
Other ideas?
Thanks....
This depends on some factors, like how many people want to change the code (only your team, or someone else too), or how much money you have for this?
Personally I'd create a build+gem server, where you can upload the scripts using some versioning system (like git or svn, depends on how many people are working on the project), and then create a cron job, that would automatically genereate the gems from the sources at generic intervals and store them as different versions. This way you can be sure that you always have an authorative server that stores your applications gems, and you can always get an earlier version if something breaks. Your script might create separate gem version names, like "appserv-edge" or "appserv-stable"
You might also want to check out github's closed source options too, if you have the money to afford that. I don't know however whether they have gem building and hosting facilities for non open-source programs.
I've created a private gemserver and it's dead easy. The only tricky bit is deciding how you want your users to upload gems. Personally, I just use a PHP upload form, and have it check to make sure that it's not masking any existing gems.
At my office we're using a bit of a hybrid approach for some of our shared scripts and libs. We do bundle them all in to a gem, but rather than using a gem server we keep them in source control, and then build the gem (using newgem) and install it locally as necessary.
The downside of this approach is that it takes two commands instead of one to install the gem, but this is largely mitigated in qa and production environments, since we use Capistrano for deployment.
The upsides are that it's dead simple, and in development there is a very short edit/build/deploy cycle if you're working with something that requires changes to the gem. I'm currently pulling a lot of common functionality in to the shared gem, so I'm really appreciating that aspect.

Resources