Deploying a rails app to Elastic Beanstalk keeps failing - ruby-on-rails

When I run eb deploy on the application, I get this error:
-hidden-#ruby:~/-hidden-$ eb deploy
WARNING: You have uncommitted changes.
Creating application version archive "app-9115-160205_135915".
Uploading -hidden-/app-9115-160205_135915.zip to S3. This may take a while.
Upload Complete.
INFO: Environment update is starting.
INFO: Deploying new version to instance(s).
ERROR: [Instance: i-024e83b0ed9b09096] Command failed on instance. Return code: 5 Output: (TRUNCATED)...ies/ruby-2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/tiny_tds-0.6.2/gem_make.out
An error occurred while installing tiny_tds (0.6.2), and Bundler cannot
continue.
Make sure that `gem install tiny_tds -v '0.6.2'` succeeds before bundling.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
ERROR: Unsuccessful command execution on instance id(s) 'i-024e83b0ed9b09096'. Aborting the operation.
ERROR: Failed to deploy application.
ERROR: Failed to deploy application.
I can install tiny_tds successfully on my local machine and on the EC2 instance, but I get this error when I deploy. I'm extremely new to ruby, rails, git and anything programming. Basically, I'm taking an application made for heroku and converting it into en EB environment.

Please remove the version of tiny_tds in Gemfile
And try again.

Related

I would like to see the rails application in elastic beanstalk, but I can be angry at the ruby ​version

I would like to see the rails application in elastic beanstalk, but I can be angry at the ruby ​​version.
However, no description of 2.4.1 can be found anywhere.
What kind of problem do you think?
Creating application version archive "xxx".
Uploading xxx.zip to S3. This may take a while.
Upload Complete.
2019-06-17 12:33:43 INFO Environment update is starting.
2019-06-17 12:33:49 INFO Deploying new version to instance(s).
2019-06-17 12:33:57 ERROR [Instance: xxx] Command failed on instance. Return code: 18 Output: (TRUNCATED)...e ']'
+ bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Your Ruby version is 2.6.3, but your Gemfile specified 2.4.1.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-06-17 12:33:57 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-06-17 12:33:57 ERROR Unsuccessful command execution on instance id(s) 'xxx'. Aborting the operation.
2019-06-17 12:33:57 ERROR Failed to deploy application.
ruby '2.6.3'
local ruby version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
Elastic Beanstalk
Puma with Ruby 2.6 running on 64bit Amazon Linux/2.9.5
The Elastic Beanstalk instance is set up to use Ruby 2.6, but in the Gemfile in the root of your application, you have a line like:
# Gemfile
ruby '2.4.1'
which declares that you are using Ruby 2.4.1.
You need to either change the Ruby version to '2.6.3' in the Gemfile and re-run bundle install to update the Gemfile.lock version, or you need to recreate your Elastic Beanstalk environment using the Ruby 2.4 version platform. If you recreate the Elastic Beanstalk environment, they may use a different patch version of Ruby 2.4, so you may have to update your Gemfile to match the Ruby version that Elastic Beanstalk is using anyway.

Why does Elastic Beanstalk keep asking me to change from a root user for Bundler in a Rails app after I've changed it?

I'm trying to deploy a Ruby on Rails app online using Elastic Beanstalk from AWS as part of a project. I'm using the AWS and EB CLI and I can run eb init without a problem. However, when I try to run eb create myproject-env it leads to this warning:
{DATE} ERROR [Instance: myInstance] Command failed on instance. Return code: 20 Output: (TRUNCATED)...dor/cache ']'
+ bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
You must use Bundler 2 or greater with this lockfile.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
I've tried googling the problem and I keep being lead back to this link, which makes sense as far as I can tell. The thing is, I can't figure out how to get past this error. I've tried making new IAM users and using --profile myProfile, I've changed the user in Command Prompt, and I've uninstalled and reinstalled Bundler, awscli, and awsebcli. I'd like to keep this in the CLI just because I want to be able to use eb deploy in the future. And I can run the app locally using Puma with no problem, so I feel like I just haven't configured something correctly with AWS.
I also can't figure out the error about using a version of Bundler 2 or higher, because I am using a higher version on my computer right now.
I'm using Rails 5.2.2, Ruby 2.4.4, and Bundler 2.0.1 and I'm using Windows Command Prompt.
Any help would be appreciated!

ElasticBeanstalk - Rails Nokogiri Deployment Issue

I have a working rails application deployed to EC2 through ElasticBeanstalk. I update the website every few weeks without issue. Today I'm running into a problem after committing changes and running "eb deploy":
An error occurred while installing nokogiri (1.7.0.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.7.0.1'` succeeds before bundling.
I haven't changed anything aside from a few views. The host is the same and the Gemfile is the same. On my local machine, I can run that command and then bundle install/update without issue. I can SSH to the EC2 host and successfully run that command to install that version of Nokogiri, too.
When I deploy, I get that error message (with no other details). I'm stuck - Any idea what I should look into next? Note that this started happening to a working setup, so I don't think it's the host missing libxml or another dependency.
Found it. There was a line in the log file that I was missing.
"Cannot allocate memory"
Rails was using a lot more memory than I thought. Just sitting there it was using 1.7GB out of 2.0GB. I temporarily added 1GB of swap and the deployment succeeded.

Elastic Beanstalk and Github gem failure to deploy error

My Gemfile for my rails app has a gem that I'm pulling off of Github using the following entry;
gem 'markable', github: 'chrome/markable'
I have a lot of other gems in the Gemfile but if I remove this one line it works fine so clearly this line is the issue.
This is the deploy output:
$ eb deploy
Creating application version archive "899e".
Uploading: [##################################################] 100% Done...
INFO: Environment update is starting.
INFO: Deploying new version to instance(s).
ERROR: [Instance: i-8c21232c] Command failed on instance. Return code: 11 Output: (TRUNCATED)...ps://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
You need to install git to be able to use gems from git repositories. For help
installing git, please refer to GitHub's tutorial at
https://help.github.com/articles/set-up-git.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
ERROR: Unsuccessful command execution on instance id(s) 'i-8c21232c'. Aborting the operation.
ERROR: Failed to deploy application.
How do I get EB to correctly pull that gem or fix it so that this works?
I see other similar questions but they are old at this point and often refer to a .ebextensions/ruby.config file which doesn't exist anywhere in my system.
Thoughts?

Start sidekiq bundler: command not found: sidekiq with mina - Spree

I have tried to deploy rails spree commerce project to ubuntu 14.04 server on digitalocean. Everything were well. But when I trying to deploy the project first time I get sidekiq error. I goggling something about that issue but I didn't get any solution.
after the
mina deploy
commad.
bundling and migrations work properly till the restarting of sidekiq.
The part of the deploying code which include the error is here:
-----> Launching
-----> Stop sidekiq
Skip stopping sidekiq (no pid file found)
-----> Start sidekiq
bundler: command not found: sidekiq
Install missing gem executables with `bundle install`
! ERROR: Deploy failed.
-----> Cleaning up build
Deleting release
Unlinking current
OK
I also experienced same problem when I execute command 'mina deploy' after I update version of mina. My workaround for this problem is by modifying my gemfile to return to the older version of
'kgio' to version 2.9.2
'mina' to version 0.3.1
'mina-sidekiq' to version 0.3.0
'mina-unicorn' to version 0.0.3
After that, it works again like before

Resources