Deployment on EC2 using poolparty and Chef server - ruby-on-rails

Does anyone have done the rails application deployment on EC2 using poolpary gems and Chef server(not Chef solo). Please share your experiences if you know some blogs or code links(except poolpartyrb.com and related to it).
The poolparty script must be able to launch an selected AMI instance with two EBS blocks(data and DB) use one elastic ip,fetch code repo and install Chef server on selected instance. Or if you have used Chef server for rails deployment please share your exp.
Thanks,
Pravin

How far did you get with your pool party script?
launching EC2 instances is explained in this detailed example
the EBS part is explained in this github issue
to deploy an application from git, use chef's deploy resource
installing chef is done using gem install chef
Maybe you can share what you have and where exactly you're currently stuck.

Related

Dokku error /var/lib/dokku/plugins/available/pg-plugin/plugin.toml: no such file or directory

So here what I did and the following output:
root#ubuntu-512mb-sfo1-01:/var/lib/dokku/plugins# dokku postgres:link DATABASE ubuntu-512mb-sfo1-01
2016/02/18 05:24:38 open /var/lib/dokku/plugins/available/pg-plugin/plugin.toml: no such file or directory
2016/02/18 05:24:38 open /var/lib/dokku/plugins/available/pg-plugin/plugin.toml: no such file or directory
no config vars for ubuntu-512mb-sfo1-01
Can someone help me? I try to deploy rails to digital ocean.
I use http://blog.flatironschool.com/using-digital-ocean-and-dokku-for-easier-rails-app-deploys/ - this tutorial but it seems to be horribly outdated. I ran into so many errors so I am thinking of giving this up and staying with heroku hosting.
It means that you don't have a Postgres docker container active. Take a look at the dokku-pg-pluging to know how to configure and instantiate a postgres docker container.
By the way, since your objective is to change from Heroku to DigitalOcean, and you're having trouble using dokku, may I suggest you using deploy bot instead? I did managed to successfully deploy an rails 4 app to DigitalOcean using deploy bot. Follow this tutorial. And you can easily follow this guide with deploy bot, adapting the unicorn and nginx stop/start services with the hooks that deploy bot provides.
Edit:
Since you wanted a more specific answer for the deploy bot solution, here goes my approach (this was +/- 3/4 months ago):
Create the droplet and follow the guide to create a droplet, install ruby, rails, unicorn and nginx and the script to control unicorn (it's in the tutorial).
Configure the deploy bot and make sure you run bundle install and another rails' specific commands (changing environments and so on) after the upload (this is a predefined hook).
The last command should be service nginx restart to restart the server (using the script from step 1).
Profit!

Ruby on Rails application deployment on local computer with postgresql

I am new to Ruby on Rails. We have developed an small application with Postgresql. Now we have to deploy it. But when i searched over internet i found lot of suggestion is to deploy them on Heroku or some premium servers. where we are not in a position now to deploy it on cloud.
How can i deploy the application on local computer? Is this similar to setting up a development environment?
Any link or lead will be much appreciated!
I hope you have your application already running on your development environment.
Create another database in your postgres, to use it for production in local system. And make necessary changes in database.yml
I feel passenger is the easiest way to deploy application, you can follow the steps in this link https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-apache-on-ubuntu-14-04 to deploy your app.
Heroku also have free deployment for few application. You can use heroku.
There are some more option like AWS, Digital Ocean. AWS is also free for one year.
Yes setting up a development environment is like set up your environment. But best practice is use a deployment automation like capistrano.
You can run it in a production environment and make it public. I had written a blog post regarding this.
Please check here
ps - Make sure your system is up for public access and i am hoping that this is for test purpose only and to show it to your clients.
Yes, it would be fairly similar to setting up your development environment.
In addition to setting up Passenger as described in the Digital Ocean post from Rajuk's answer, I use Capistrano for deployment to my Ubuntu servers. You can set up the Capistrano deployment configuration to deploy to any machine.
The possible configuration variables are too numerous to address here without further details about your specific situation.
Check out Railscast #335 Deploying to a VPS where Ryan talks about deploying to a Linux machine (a cloud VPS in this case) with Capistrano.

deploy a rails app with capistrano without a rails environment

I've been working on a rails project for a client that isn't technical. However, they want me to send over a deployment script, which their networks guys will use to deploy the application.
I've been using capistrano. But the problem is, cap is heavily dependent on the app itself. What i need is a script, that'd use the cap and config/deploy.rb but needs minimal setup on their local systems. The repo in the backbone is git based.
If this cant be achieved by capistrano, anyone knows of any other deployment utilities, that'd allow me stuff cap does and works independently? .. (i create symlinks and run some rake tasks in my :after_update block).
Thanks,
Hassan
If setting up a ruby environment to run cap deploy is not something that the "network guys" will be willing to do, then you're in for quite an uphill battle. Some suggestions to help alleviate this:
Have them use the railsready script to set up their environment
Give them a virtual machine (maybe a Vagrant box?) that can be used to deploy the instance
If you're doing a git-based deploy, you'll either have to set up a deployer key (and give this to them) or add them to your github project (assuming you're using github)
Consider bundling up the entire project and delivering as a tarball (or putting it into an rpm) and having them deploy this way (a quick&dirty way to do this is to deploy to a machine running the same distro as production, and tarring up the deployment directory)
Consider using a stack that more aligns with their network stack, like JRuby and warbler for deploying to Tomcat
Do some pair programming or at least screen sharing for the initial install. Sometimes the difference between loving and hating a platform comes down to the availability of help when problems arise.
Mina is like Capistrano but doesn't rely on being inside the rails application directory.
One option could be to setup something like Jenkins that will use capistrano to deploy. And your client can curl the jenkins build url to trigger a deploy.

Ruby on Rails application deployment on multiple servers

What are the useful gems or softwares that will help deployment of RoR 3.2 application on the clouds?
There is no specific requirements since I just want to get experience with it. But I am thinking of Amazon EC2 as a primary environment to test the application. The goal is to deploy it in the multiple servers.
I guess the most naive way would be launching the same application on multiple servers at the same time, but that will requires a lot of manual restart/reboot which requires a lot of human resources.
Is a single application of ruby on rails just not suited well for deployment on multiple servers?
We use Capistrano (https://github.com/capistrano/capistrano) to communicate with multiple EC2 instances on AWS.
We use Chef (https://github.com/opscode/chef) to do the system management configuration.
You can get cookbooks for various applications that you want to install (eg nginx, monit, logrotate...) from Opscode (http://community.opscode.com/cookbooks)
You will need both Capistrano and Chef to setup and deploy to AWS.
Puppet is another system management configuration that you can use too. (https://github.com/puppetlabs/puppet)
This is what Capistrano is for.
https://github.com/capistrano/capistrano/wiki/

Hosting rails on ec2

I want to deploy a rails onto amazon ec2. I've had a look at poolparty and ec2onrails but neither seem to be maintained anymore.
What are people using to do this? Is it all homebrewed puppet and capistrano or is there a project that will get me going?
I can recommend two projects:
If you have a single Rails app, take a look at Rubber. It's a gem that can provision EC2 instances for you, install software and deploy your app. It's based on Capistrano. There are recipes for the most common components (mysql, apache, passenger, postgres, etc.).
In case you have more complex setup (e.g. multiple apps or specific needs that aren't covered by Rubber) I recommend Chef. It does have quite a learning curve, so prepare yourself. Take a look at OpsCode to get started with Chef.
You may want to take a look at our Rubystack AMIs. They are free and we keep them up to date. You still need to do work for automating deployment and integrating in your workflow, the AMIs mainly address the environment and runtime setup.

Resources