failed capistrano deploy with missing manifest.*json - ruby-on-rails

Capistrano 3.0 deploy failed on rails 3.2 because there is not manfest.*json with the following error.
However, there is manifest.yml which is expected for rails 3.2 while rails 4.0 expects manifest.json. any idea why this happening or how i can go about it.
INFO [b38cf17e] Running /usr/bin/env cp /var/www/html/webapp/releases/20140102161642/public/assets/manifest*.json /var/www/html/webapp/releases/20140102161642/assets_manifest_backup.json on 208.68.39.56
DEBUG [b38cf17e] Command: cd /var/www/html/webapp/releases/20140102161642 && /usr/bin/env cp /var/www/html/webapp/releases/20140102161642/public/assets/manifest*.json /var/www/html/webapp/releases/20140102161642/assets_manifest_backup.json
cap aborted!
cp stdout: Nothing written
cp stderr: Nothing written
Thank you in advance..

Related

AppEngine Flexible Ruby environment, application startup error: /usr/bin/env: 'ruby2.5': No such file or directory

I'm trying to deploy an API-only Rails 5 application to AppEngine Flex w/ the standard Ruby runtime, and I'm getting the following error at the very end:
Updating service [default] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
/usr/bin/env: 'ruby2.5': No such file or directory
I'm specifying ruby '2.5.1' in my Gemfile and I've added an explicit .ruby-version file to the root of my project set to 2.5.1 as well.
I have no other debugging information available to me in the logs, no other fancieness. My entrypoint command is:
bundle exec rails server Puma -p $PORT
I can provide more details if needed, not sure what else might be relevant. Any pointers? As far as I can tell, nothing on my side is asking for a version of ruby that specifically at execution time.
Thanks!
EDIT: Here's my app.yaml file
entrypoint: bundle exec rails server Puma -p $PORT
env: flex
runtime: ruby
UPDATE:
I can verify that I'm having similar problems when trying to exec rake tasks like db:migrate:
--------- EXECUTE COMMAND ----------
bundle exec rake db:migrate
/usr/bin/env: 'ruby2.5': No such file or directory
ERROR
ERROR: build step 0 "gcr.io/google-appengine/exec-wrapper:latest" failed: exit status 127
--------------------------------------------------------------------------------------------------------------------------------------------------------
OK I now see what has happened after debugging the docker image locally. Because I was on ubuntu and had used system ruby to install gems it had embedded /usr/bin/env ruby2.5 into every executable script that was bundled into my app. I deleted all gems and switched to rbenv for managing Ruby version which mitigated this odd behavior between unbuntu's ruby and my app.

Capistrano/Sidekiq task not working

I am using rails 4.0 and ruby 2.3.
I am using following gems for capscript.
capistrano (3.4.0)
capistrano-bundler (1.1.4)
capistrano-rails (1.1.5)
I am using capistrano/sidekiq module for running sidekiq related tasks.
When I am running
cap staging sidekiq:start
I get the following error:
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy#10.50.11.190: sidekiq exit status: 1
sidekiq stdout: Nothing written
sidekiq stderr: Nothing written
SSHKit::Command::Failed: sidekiq exit status: 1
sidekiq stdout: Nothing written
sidekiq stderr: Nothing written
Below is the command which failed on running the above task.
cd /opt/optimus_apps/merchant_tracking/current && /usr/bin/env sidekiq --index 0 --pidfile /opt/optimus_apps/merchant_tracking/shared/server/tmp/pids/sidekiq-0.pid -- environment staging --logfile /opt/optimus_apps/merchant_tracking/shared/server/log/sidekiq.log --config /opt/optimus_apps/merchant_tracking/shared/server/config/sidekiq.yml --daemon
I tried running the above command directly on the staging server with a small change and it worked. I ran the following command.
cd /opt/optimus_apps/merchant_tracking/current/server && /usr/bin/env sidekiq --index 0 --pidfile /opt/optimus_apps/merchant_tracking/shared/server/tmp/pids/sidekiq-0.pid --environment staging --logfile /opt/optimus_apps/merchant_tracking/shared/server/log/sidekiq.log --config /opt/optimus_apps/merchant_tracking/shared/server/config/sidekiq.yml --daemon
I changed the rails path from
/opt/optimus_apps/merchant_tracking/current --> /opt/optimus_apps/merchant_tracking/current/server
The problem is my rails app lies inside current/server folder.
So my question is how can I make sidekiq task to pick current/server folder rather than the current folder?
Thanks in advance.

Got error while deploy rails code on server

I am getting below error when tried to deploy using capistrano
/usr/local/rvm/bin/rvm-shell - No such file or directory
** [deploy:update_code] exception while rolling back: Capistrano::CommandError, failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-2.0.0-p353' -c 'rm -rf /home/xxx/xxxxxx/releases/20151019095324; true'" on xx.xx.xxx.xxx
Any one have a solution.
Rvm is probably not installed or not accessible from the user "declared" in capistrano.
Refer to https://rvm.io/rvm/install to check if rvm is correctly installed on your server.

Debugging Capistrano

I'm deploying to a VPS using capistrano, based on the guide at RailsCasts.
http://railscasts.com/episodes/335-deploying-to-a-vps?view=asciicast
It's failing on the deploy:cold command, with a conflict with Ruby. I actually can't see what the problem is, as when I shell into the same user the Ruby version looks correct.
$ cap shell
cap> which ruby
[establishing connection(s) to 192.xxx.xxx.xxx]
** [out :: 192.xxx.xxx.xxx] /home/deployer/.rbenv/shims/ruby
cap> ruby -v
** [out :: 192.xxx.xxx.xxx ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
This is the error:
command finished in 655ms
* 2013-07-01 16:40:39 executing `bundle:install'
* executing "cd /home/deployer/rails/assay/releases/20130701144038 && bundle install -- gemfile /home/deployer/rails/assay/releases/20130701144038/Gemfile --path /home/deployer/rails/assay/shared/bundle --deployment --quiet --without development test"
servers: ["192.xxx.xxx.xxx"]
[192.xxx.xxx.xxx] executing command
** [out :: 192.xxx.xxx.xxx] rbenv: version `1.9.3' is not installed
command finished in 662ms
*** [deploy:update_code] rolling back
My question is: how can I debug this? When I read the deploy.rb file I can't see where it even references the Ruby version. Pretty frustrating, I am about ready to ftp the repo up, which is not ideal obviously.
Well I finally got to the bottom of the issue - a mismatch between ruby versions use by Capistrano and what was actually on the server.
To debug Capistrano run it like this:
cap deploy:cold -d
That was you can step through the commands and access the temporary directories on the remote server before they are deleted.
I just had similar issue, the reason was .ruby-version file pointing at 1.9.3 (file was generated by rails-composer), while there was 1.9.3-p392 installed via rbenv on remote machine.
Debug info of capistrano can be shown by tail -f log/capistrano.log.

Could not find rake on capistrano deploy

So I am attempting to get a capistrano deployment setup with an nginx/unicorn server, using RVM.
The deploy works, but when I attempt to interact with unicorn via capistrano i get an error like:
[~/source/quibbler/config]
$ cap unicorn:start
* executing `unicorn:start'
* executing "cd /u/apps/quibbler/current && bundle exec unicorn_rails -c /u/apps/quibbler/current/config/unicorn-production.rb -E production -D"
servers: ["wwwtestvm.whf.app"]
[wwwtestvm.whf.app] executing command
** [out :: wwwtestvm.whf.app] Could not find rake-0.9.2 in any of the sources
command finished in 553ms
failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.2-p290#quibbler' -c 'cd /u/apps/quibbler/current && bundle exec unicorn_rails -c /u/apps/quibbler/current/config/unicorn-production.rb -E production -D'" on wwwtestvm.whf.app
I have searched the interwebs all night and can not find the solution. If I copy paste the command into my shell it works so I am 99% sure it has to do with the RVM environment not being correct.
I have created a gist of my deploy and unicorn configs:
https://gist.github.com/1375736#file_deploy.rb
https://gist.github.com/1375736#file_unicorn_production.rb
Any help or guidance would be appreciated.
Thanks to sannankhalid answer on this other question i was able to resolve it.
Short answer: add rake to your Gemfile, make sure you run bundle install so your Gemfile.lock gets updated, then deploy to your server, ayay!

Resources