Not able to push my code into AWS EB - ruby-on-rails

I have been facing issue with pushing my ruby on rails code into AWS ElasticBeansTalk server. I first time was able to initialize the EB, commit and push the code and tried to run the EB server. Everything was fine, but after a few commits, suddenly it is raising the exception as following.
remote: error: Unable to create application version: You cannot have more than 500 Application Versions. Either remove some Application Versions or request a limit increase.
I am not able to find what to do with that. Can anybody help me out to achieve the solution clearly please?
Thanks in advance.

The error code suggests you've pushed a very large number of builds onto the Elastic Beanstalk environment. Try going in to your AWS Console, and go to Elastic Beanstalk, and from the Actions button for your application, select View Application Versions.
Most probably, you'll find 500 different versions of your application here. Select as many old ones as you wish, and do Delete to remove these. Then you should be able to continue.
(Of course, if my hunch is correct, a more interesting question is how on earth you've managed to upload 500 different versions of your application. I'm not running Ruby on Rails, so I'm not too familiar with that environment...)
Good luck!

Use eb labs cleanup-versions --num-to-leave=some_value to leave "some_value" number of last application versions and eb labs cleanup-versions --help to get a full list of available commands. Notice, that eb labs is experimental branch and its syntax may differ based on eb cli version.

After deleting the older application versions, git aws.push started to work again. It would be nice if the version limit error was returned by git aws.push as it would have saved a lot of time.
So follow below steps to resolve this isue.
logged in to console
Go to Elastic Beanstalk and select you application and environment
Find button "Upload and deploy" below text 'running version' and click it
To deploy a previous version, go to the "Application Versions page".
Select your last commit and delete this version label.
6 Again try to deploy with the new version.

Related

Digital Ocean clone droplet with Rails 5 app deployed with Capistrano

I lost the access to a droplet where I am running a rails 5 app that I've deployed with Capistrano. The stack of technologies I am using is
-Ruby 2.3.0 (RVM 2.9.1)
-Rails 5.0.1
-Puma
-Capistrano 3.7.2 (the first time I deployed the app I've used 3.6.0, but I was getting an error and I decided to upgrade it)
-Postgresql
- Nginx
I am able to take an snapshot and recreate the server and get the access again. However I am not able to make the app work again.
First things first, these are the steps I made
Take an snapshot of the server
Create a droplet based on the spanshot I did before
Setup access to the server (the user I used for deployment is there and I didn't need to do anything)
While I was trying to deploy Capristano I was getting an error that I didn't have access permissions to a folder o the folder didn't exists (the error was I haven't enough memory), but it turned out that I solved this adding swap memory.
Then I was getting an error that there was another puma.sock instance (or something like that), and I solved deleting the files from /apps/myapp/shared/tmp
Now it seems that when I try to deploy the app, The app does not have access to the database (the database is there with all the data)
Has anyone done something similar? is there a more magical/easy way?
Finally I was able to solve it. The problem was that I needed to add this line of config to my deploy.rb file
set :linked_dirs, %w{tmp/pids tmp/sockets log}
the lack of that line was causing that puma could not deploy. The message was something like this
Socket 'already in use'
is there a more magical/easy way?
I would suggest you to use heroku over digital ocean if you dont have alot of experience working with linux server configurations, its a lot more "magical and easy" and its free for basic stuff
if you choose to keep using digital ocean, i would make sure rails is working on the correct ip address, take a look at this guide: https://www.digitalocean.com/community/tutorials/deploying-a-rails-app-on-ubuntu-14-04-with-capistrano-nginx-and-puma

Opening Heroku | Page not found

I'm following this tutorial to a tee and so far so good. I ran into a problem on step 2.6
On my terminal I input
heroku open
After which it opened a new webpage on Chrome.
The terminal then displayed
Opening aqueous-forest-3891... done
The webpage that opened was https://aqueous-forest-3891.herokuapp.com/ and unfortunately it says the webpage may have been moved or does not exist.
I've followed the tutorial exactly (as far as I can tell) and can't figure out what I've done wrong. I'm very new to Rails (and Ruby....and Heroku...).
I'm not exactly sure how to troubleshoot my problem or if there's a command I can use in my terminal for debugging - etc.
Good news: a Rails error means your app is running on the server
Bad news : your routes are likely causing a problem.
According to this blog (which has exactly the same issue), the problem is that Heroku won't host the "default" Rails page. You'll need to create a default page & redeploy:
#config/routes.rb
root "application#index"
#app/views/application/index.html.erb
Hello world
$ git add .
$ git commit -a -m "Default Page"
$ git push heroku master
Context
The error you're seeing is one from Rails:
This is good, as it means your Rails app is actually on the Heroku server & being picked up. This type of error is either suggestive that you have an error with your server (500 error), or a missing page (404 error).
-
If you had the following error, it would be a Heroku (platform) centric issue:
This is normally caused either by a lack of database connectivity, or some sort of environment issue (ENV vars missing etc).
The best way to debug Heroku is to use the Heroku logs.
These are written - as with most event-based software - on the server, allowing you to see what's going on. Heroku recently upgraded their software to include a new real-time logging system:
Checking in there will tell you what's going on, allowing you to take direct action to resolve it.
To debug your issue you will need to view the logs. A quick way is to add the Papertrail add on to your app (there's a free option). Add-ons can be added via the resources tab from Heroku.
Another option is to to view the heroku logs in the terminal with the command
heroku logs -t --app appName
By viewing the logs, you should get some error messages that will help you debug why your app isn't showing.
In my case I deployed custom branch to heroku master, which; heroku usually does not build itself.
If you want to deploy custom branch to heroku use this command.
git push -f heroku your_branch_name:master

Heroku Cedar-14 and libjpeg.so.62

After upgrading a production application on Heroku to cedar-14, I am running into issues with carrierwave-video-thumbnailer. In particular, I get the error:
ffmpegthumbnailer: error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory
After looking into this, I found that other people are having issues with libjpeg after upgrading to cedar-14 (for other gems besides ffmpegthumbnailer)
My questions are:
Is there a way to fix this?, or otherwise
How can I revert back to cedar-10?
(I tried heroku stack:set cedar-10 but get the error resource not found)
You only have a limited time left on cedar-10, so you'd do well to try to fix the issue. However, if you need to revert it temporarily, read on.
heroku stack:set cedar doesn't seem to be working anymore, probably because it is a ticking time bomb.
To rollback, you can use the heroku rollback functionality.
First, get the version number of the most recent release before you upgraded.
heroku releases
Then, do:
heroku rollback v65
(using the version you identified from the previous step instead of v65)
Good luck!

Many problems with deploying a rails application to Elastic Beanstalk

I'm at a breaking point with trying to get a rails application deployed to EB. I cannot user heroku for dependency reasons so I'm trying out AWS. The ruby/rails tutorials online all are very clear in setting up an environment, but I am met with many challenges, and at this point I'm starting to think it's because of Amazon's service and not my configuration.
Lets say I start with something very simple, I run
rails new
I start of with a barebones rails app, and I add the necessary routes and index.html.erb file to say hello word. I run
git init && git add . && git commit -m "hello world"
eb init
I run through the necessary steps, I've tried creating a 32 and 64 bit ubuntu instances with ruby 1.9.3 (Which is what my local environment is set up as), I dont set up RDS, and then run
eb start
which prompts me to deploy my latest git commit, I say yes, and it deploys!
Good news? Not so much, Yes my url given by EB does say Hello World, but if at ANY point I try to deploy new code, lets say a change to the gemfile, and there is an error in building my gemfile.. the environment completely blocks me out to the point where.
I cannot access any logs, and If I try, the env goes into a grey state, and reboots
I cannot redeploy any previous git commit, the env just spends 10 minutes and times out
I'm getting frustrated having to rebuild an ENTIRE environment every time there is a slight error in the code.
In general, I'm looking for an alternative to heroku, from which I can deploy changes from the command line. I don't think my question is phrased well enough for anyone to spot out exactly what I'm doing wrong - If I am even doing something wrong. If there are any best-practices with deploying to EB.. please let me know. Thanks!
What size instance are you using? I've found that trying to use a micro instance doesn't work as it runs out of memory when building any native extensions.
Try using a t2.small instance at a minimum.

Heroku: Deploying rails application troubles

I'm trying to deploy my rails application with heroku (as shown here). I've created a very simple rails application (using ruby 1.9.2 and rails 3.0.3; i'm sure heroku supports these - see heroku docs), created and pushed github repo, created heroku repo and pushed it (all commiting is done). And when i'm trying to access my application controller, it throws 404 rails page like it's saying 'there is no such controller'. I've done heroku rake db:migrate but first time i ran it i got 'host not found' error. Running this again fixed that. Well, i'm not sure if i should run heroku addons add:postgresql - i though postgres is on by default, but heroku says i should pay in order to get DB (running command i've mentioned asks me to confirm billing it).
May be it sounds stupid, but how can i deploy my rails application (it's a very simple one) without paying any fees and such troubles as 404 pages like i mentioned in the beginning of my post? (and this is my question). Maybe i should choose other hosting (if it exists in our world) or am i doing something wrong with heroku?
You forgot to push your quotes_controller.rb to git and heroku probably.
git add controllers/quotes_controller.rb
it seems you forgot models also, and probably lot of files.

Resources