Has any one used Capistrano 3.0.0 ?
I'm new to rails and web development in general, and I've never used Capistrano before, and I need to deploy my app on Heroku with Capistrano in order to user sidekiq and redis-server.
Should I use an older version of Capistrano, where I could find more resource to help get started, or is this considered a bad thing ?
Any suggestions or tips would be very much appreciated.
Capistrano and Heroku are not compatible technology.
Heroku provides a git source control remote server. When you want to deploy code onto your Heroku app, you use git to push a copy of the code. This triggers a Heroku deployment through their process.
Capistrano is an SSH based system deployment framework. It allows you to connect via SSH to each server in your environment and issue commands with a large library of built-in functionality. Heroku does not allow SSH access to configure systems.
Do you have deploys/configuration working on Heroku at all? If not, you should start there with the basic Heroku Rails setup documents.
If you do have your web app running, but need Redis and Sidekiq, you will need to:
Provision a Redis database provider, like OpenRedis via a Heroku Addon: http://addons.heroku.com/
Setup Sidekiq in your Rails application (See Sidekiq docs: https://github.com/mperham/sidekiq)
Add a Sidekiq worker process in your Heroku Procfile within your app
Your app will then have a number of web processes from the Procfile running your Rails app front-end and a number of back-end asynchronous workers running Sidekiq.
Related
I've developed my Rails project locally and want to deploy it on my Ubuntu VPS. Now I've installed the gems on the VPS and copied my Rails App code to it. I can execute rails s --binding=0.0.0.0 in a putty session to the VPS and the website can be access from the Internet. The problem is when I close putty, the website is down. How to start my Rails App in a way that it still alive even if I closed putty?
Using rails s is not the way to go. It will use Webrick(or a different one if you choose) to handle the requests and it can be quite slow.
You should setup a production stack for serving your website.
Here is one of the best tutorials I've seen about how to deploy a Rails app to a production server(VPS).
In short you gonna need install RVM or Rbenv, Ruby, some libs, Database, Nginx and Passenger. You have alternatives too. But this is the basic.
I recommend using Capistrano for deploy. You can choose another deployment tool also, or none.
rails s it is best for development only.
I have a nodeJS app that does some calculations. I'm curious if there's a way(and makes sense) creating a rails gem for my app that'd run that nodeJS app and communicate with rails (I'm using heroku)
I ended up running nodejs app as a separate app with a shared REDIS. I used REDIS subscribe (pub/sub) to communicate between rails app and nodejs up, and a constantly running rake task on rails side that'd create sidekiq jobs for messages from nodejs app.
However, it's as easy just to run nodejs app on a worker specifying it in the Procfile, like:
nodejs: node nodeapp/index.js
I have a Rails app hosted on Heroku and I want to add Server Sent Events functionalities, but I can't find any documentation or blog post specific for Heroku.
As not all servers (e.g. WEBrick) support ActionController::Live I was wondering what is the default server on Heroku and whether is possible to configure the environment (i.e. change server) to support SSEs.
Any further advice about the server to use and how to configure would be greatly appreciated.
I think my answer is not so widely helpfull, but you can try.
For the first thing:
create Procfile in rails root within the following content:
web: bundle exec rails server puma -p $PORT -e $RACK_ENV
then add to Gemfile:
gem 'puma'
In above you can switch to thin, but consider link below (and many more details)
http://tenderlovemaking.com/2012/07/30/is-it-live.html
Heroku wouldn't necessarily be the issue here - it's an environment which allows your app to run (on Amazon EC2 I think)
Multi-Threaded Servers
The thing you've got to look for is the server software you use to run your app. Heroku basically takes your server gem & allows it to run with their processors, and other computing power; so it's really whether their platform can play ball with the right server
You're really looking for multi-threaded servers, which you can find here Is puma the ONLY multi-threaded rails 4 http server?
Puma
Rainbows! supports multiple concurrency models, including multithreading
Zbatery - Rack HTTP server without a fork stuck in it
Phusion Passenger 4 has supported multithreading since its beta stages
Thin does have a threaded mode which can be enabled by passing
--threaded or by setting threaded: true in the appropriate configuration file (e.g. bundle exec thin start --threaded)
Net::HTTP::Server, despite the lack of advertising, supports
multithreading; very minimalist
I have the following in the Gemfile of a Rails project, yet workless (https://github.com/lostboy/workless) is not working (it is not starting a Heroku worker dyno when a job is added to the Delayed::Job queue).
gem 'delayed_job_active_record'
gem 'workless'
gem 'daemons'
Unfortunately this is a silent error, so I just ended up figuring it out after quite some time.
As per the gem's instructions: Add your Heroku app name / API key as config vars to your Heroku instance.
heroku config:add HEROKU_API_KEY=yourapikey APP_NAME=yourherokuappname
Get yourapikey from https://dashboard.heroku.com/account and yourherokuappname from https://dashboard.heroku.com/apps
Also, if you are using a Procfile to declare what commands are run by your application's dynos on the Heroku platform, there is NO need for a worker line (worker: bundle exec rake jobs:work) in Procfile -- that would only be need if you were not using workless.
So this is something I ran into setting up a new Heroku account for a friend. No credit card on file. Although their is free time on the account, the account will be blocked from doing the sort of things that might incur charges without credit information on file.
Just FYI for anyone that runs into this and has everything set up correctly.
For people who will have similar problems, if you have some worker which you need to run all the time (not delayed job e.g) and you have some other which you would like to run with workless.
Define the independent worker as a separate process in the Procfile and don't use the word 'worker' in it's name, because of https://github.com/lostboy/workless/blob/master/lib/workless/scalers/heroku_cedar.rb#L18
How do I launch a Rails 3 app on Heroku.
I am using PHPmyadmin.
I would start here
yep, you need to read the manual. Heroku is entirely managed system, you can only deploy via a git push. By default it uses Postgresql as it's DB - you can use mySQL but you'd have to pay for an Amazon mySQL server
Perhaps you should read through the Ruby on Rails tutorial. It guides you through the process of developing an app in RoR and pushing it to Heroku. Good luck.
This part, especially, has information on deployment to heroku:
Heroku Deployment