Srinivasa Varma D

Joined

1,580 Experience
12 Lessons Completed
0 Questions Solved

Activity

Hi, the production deployment is failing for me. I'm using Capistrano for the deployment, below you can find the details.

jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/jsbundling-rails-1.0.2/lib/tasks/jsbundling/build.rake:5:in `block (2 levels) in <main>'
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `load'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `<main>'
Tasks: TOP => assets:precompile => javascript:build

Do I have to add any Capistrano task?

Please help me to resolve this issue.

Thanks.

I'm getting the below error message

Could not locate Gemfile or .bundle/ directory

As I mentioned that I'm using Capistrano gem for production deployment, it will take care of executing the commands.

The yarn is installed in the server.

Correct me if I’m wrong, the yarn build can be run in the application current folder. Because this is first deployment the folder will not get created until the successful deployment.

Hello there,

I'm using Capistrano for production deployment, getting below error when I try to deploy my rails 7 application to DigitalOcean server.

00:43 deploy:assets:precompile
      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
      01 Parsing scenario file install
      01 ERROR: [Errno 2] No such file or directory: 'install'
      01 rake aborted!
      01 jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors
      01 /home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/jsbundling-rails-1.0.2/lib/tasks/jsbundling/build.rake:5:in `block (2 levels) in <main>'
      01 /home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
      01 /home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `load'
      01 /home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `<main>'
      01 Tasks: TOP => assets:precompile => javascript:build
      01 (See full trace by running task with --trace)
#<Thread:0x0000000106748860 /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
/Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@137.184.28.52: rake exit status: 1 (SSHKit::Runner::ExecuteError)
rake stdout: Parsing scenario file install
rake stderr: ERROR: [Errno 2] No such file or directory: 'install'
rake aborted!
jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/jsbundling-rails-1.0.2/lib/tasks/jsbundling/build.rake:5:in `block (2 levels) in <main>'
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `load'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `<main>'
Tasks: TOP => assets:precompile => javascript:build
(See full trace by running task with --trace)
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/command.rb:97:in `exit_status=': rake exit status: 1 (SSHKit::Command::Failed)
rake stdout: Parsing scenario file install
rake stderr: ERROR: [Errno 2] No such file or directory: 'install'
rake aborted!
jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/jsbundling-rails-1.0.2/lib/tasks/jsbundling/build.rake:5:in `block (2 levels) in <main>'
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `load'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `<main>'
Tasks: TOP => assets:precompile => javascript:build
(See full trace by running task with --trace)
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/backends/netssh.rb:170:in `execute_command'
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
    from <internal:kernel>:90:in `tap'
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:80:in `execute'
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/capistrano-rails-1.6.2/lib/capistrano/tasks/assets.rake:69:in `block (6 levels) in <top (required)>'
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:100:in `with'
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/capistrano-rails-1.6.2/lib/capistrano/tasks/assets.rake:68:in `block (5 levels) in <top (required)>'
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:92:in `within'
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/capistrano-rails-1.6.2/lib/capistrano/tasks/assets.rake:67:in `block (4 levels) in <top (required)>'
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `run'
    from /Users/varma/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@137.184.28.52: rake exit status: 1
rake stdout: Parsing scenario file install
rake stderr: ERROR: [Errno 2] No such file or directory: 'install'
rake aborted!
jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/jsbundling-rails-1.0.2/lib/tasks/jsbundling/build.rake:5:in `block (2 levels) in <main>'
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `load'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `<main>'
Tasks: TOP => assets:precompile => javascript:build
(See full trace by running task with --trace)


Caused by:
SSHKit::Command::Failed: rake exit status: 1
rake stdout: Parsing scenario file install
rake stderr: ERROR: [Errno 2] No such file or directory: 'install'
rake aborted!
jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/jsbundling-rails-1.0.2/lib/tasks/jsbundling/build.rake:5:in `block (2 levels) in <main>'
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `load'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `<main>'
Tasks: TOP => assets:precompile => javascript:build
(See full trace by running task with --trace)

Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@137.184.28.52: rake exit status: 1
rake stdout: Parsing scenario file install
rake stderr: ERROR: [Errno 2] No such file or directory: 'install'
rake aborted!
jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/jsbundling-rails-1.0.2/lib/tasks/jsbundling/build.rake:5:in `block (2 levels) in <main>'
/home/deploy/truemango/shared/bundle/ruby/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `load'
/home/deploy/.rbenv/versions/3.1.1/bin/bundle:25:in `<main>'
Tasks: TOP => assets:precompile => javascript:build
(See full trace by running task with --trace)

Posted in GoRails Screencast to setup Algolia ?

Any more thoughts on this? it would be really great if you do a screencast with Algolia places search using StimulusJS.

Posted in Rails Engines for Decoupled Architecture

@Alexander Miasoiedov

Have you found any solution to it? please share if you have any. I am also looking for the same architecture. 

Posted in A/B Split Testing with the Split gem Discussion

How to start ab_test on Javascript/StimulusJs click events?

In a product page I have multiple lead capturing forms, the form get opend in a popup by clicking in the link/button. Now I want to test which link/button click is giving more leads.

Thanks!

Posted in A/B Split Testing with the Split gem Discussion

Any luck? I am also getting the same.

@jacob Montgeomery

I've checked all the required folders for file storage and all are there. The form submitting smoothly when i added single file, but when i add multiple file it showing only redirection and nothing happening after that.

Posted in How to perform bulk update in rails?

Hi there,

Here is the problem in more detail. I tried to perform bulk update on rails model, but ended up with normal save method. I have some number of records and i wanted to update their values with respect to performed calculations. But i could not find a solution to do that. Any ideas appereciated.

Below is my rails task code:

  wsp = Wsp.includes(:collections)
    wsp.each do |ws|
         ws.set_margin_attributes
         ws.save(validate: false)
    end

and Wsp model contains set_margin_attributes method like below

    def set_margin_attributes(ws_calculations)
            self.attributes = {
                total_amount: ws_calculations[:total_amount],
                margin: ws_calculations[:margin],
                margin_percent: ws_calculations[:margin_percent],
                inr_margin: ws_calculations[:inr_margin]
            }
        end

Can some one suggest is there any otherway to do this.

Thanks in advance

Hi Jacob,

I've already checked in nginx conf and it has client_max_body_size 50M; For uploading images i'm using paperclip for one image upload and manually moving another image. Both are different kinds of upload.

Hi Jacob,

The files aren't large in size. I'm trying to upload two image files from a single form. So, i think size does not matter then.

Hi there,

I'm trying to upload multiple file inputs from single form. The form is working fine in development, but in production the form showing that redirecting for long time and returns nothing. Can some one help me to resolve this issue.

Thanks in advance.

Hi Guys.

Recently i ran into a problem which does not allowing me to render a partial as a JSON response for .json requests. Below you can get in more detail.

I have a partial resides in below path:
views/sales/manage_data/_spoc_li.html.erb

I have tried two approaches to render that partial as a response.

  1. Using normal controller action as html response ( i have accessed localhost:3000/sales/spocs)
    Following is my controller action code:

    def index
    @products = Product.all
    @spocs = Spoc.all
    render json: {
      html_data: render_to_string(partial: 'sales/manage_data/spoc_li', locals: {spoc: @spocs[0]})
    }
    end
    

    It did not raised any error and i can see json response in browser.

  2. Using .json request ( i have accessed localhost:3000/sales/spocs.json)

def index
    @products = Product.all
    @spocs = Spoc.all
    respond_to do |format|
      format.html
      format.json { render json:{
          html_data: render_to_string(partial: 'sales/manage_data/spoc_li', locals: {spoc: @spocs[0]})
        }
      }
    end
  end

This time it raised an error saying that

Missing partial sales/manage_data/_spoc_li with {:locale=>[:en], :formats=>[:json], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in: * "/home/enigma/workspace/collections/app/views" * "/home/enigma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/ckeditor-4.2.2/app/views" * "/home/enigma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/devise-4.2.0/app/views"

Some please tell how formats are working and how can i get rid of this?

Thanks

Hi

I changed my server also for this reason. Even then the problem still exist.
I just deployed app using capistrano and during deploy process my cpu reaches to 100%.

I used 'top -ic' command then i get following result

top - 10:48:14 up 23:51, 2 users, load average: 7.47, 7.58, 7.13
Tasks: 167 total, 1 running, 166 sleeping, 0 stopped, 0 zombie
%Cpu(s): 35.9 us, 0.0 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 64.1 st
KiB Mem : 4045040 total, 169484 free, 2827428 used, 1048128 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 1108364 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

3637 deploy 20 0 499564 165644 10436 S 35.8 4.1 305:37.51 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)
6669 deploy 20 0 494112 178280 7352 S 34.8 4.4 291:43.09 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)
3650 deploy 20 0 494204 177568 7392 S 33.1 4.4 298:59.78 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)
8735 deploy 20 0 563904 180032 10540 S 31.8 4.5 97:30.69 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)
8743 deploy 20 0 494216 174424 7388 S 30.5 4.3 94:15.07 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)
10114 deploy 20 0 428576 171136 7364 S 29.1 4.2 91:26.35 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)

Hi Jacob Montgomery,

I ran top command and it showing following

top - 10:48:14 up 23:51, 2 users, load average: 7.47, 7.58, 7.13
Tasks: 167 total, 1 running, 166 sleeping, 0 stopped, 0 zombie
%Cpu(s): 35.9 us, 0.0 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 64.1 st
KiB Mem : 4045040 total, 169484 free, 2827428 used, 1048128 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 1108364 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

3637 deploy 20 0 499564 165644 10436 S 35.8 4.1 305:37.51 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)
6669 deploy 20 0 494112 178280 7352 S 34.8 4.4 291:43.09 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)
3650 deploy 20 0 494204 177568 7392 S 33.1 4.4 298:59.78 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)
8735 deploy 20 0 563904 180032 10540 S 31.8 4.5 97:30.69 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)
8743 deploy 20 0 494216 174424 7388 S 30.5 4.3 94:15.07 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)
10114 deploy 20 0 428576 171136 7364 S 29.1 4.2 91:26.35 Passenger RubyApp: /home/deploy/testprep_rails/current/public (production)

My Nginx error log says that some passenger ruby processes are running long time and taking too much CPU usage. Still problem exist please have look at my app nginx error log.

[ 2016-10-24 23:02:18.7328 21683/7fec0566a700 age/Cor/CoreMain.cpp:532 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2016-10-24 23:02:18.7328 21683/7fec0c265780 age/Cor/CoreMain.cpp:901 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2016-10-24 23:02:18.7328 21683/7fec0c265780 age/Cor/CoreMain.cpp:819 ]: Checking whether to disconnect long-running connections for process 21780, application /home/deploy/testprep_rails/current/public (production)
[ 2016-10-24 23:02:18.7329 21683/7fec0c265780 age/Cor/CoreMain.cpp:819 ]: Checking whether to disconnect long-running connections for process 21788, application /home/deploy/testprep_rails/current/public (production)
[ 2016-10-24 23:02:18.7329 21683/7fec0c265780 age/Cor/CoreMain.cpp:819 ]: Checking whether to disconnect long-running connections for process 26979, application /home/deploy/testprep_rails/current/public (production)
[ 2016-10-24 23:02:18.7329 21683/7fec0c265780 age/Cor/CoreMain.cpp:819 ]: Checking whether to disconnect long-running connections for process 29348, application /home/deploy/testprep_rails/current/public (production)
[ 2016-10-24 23:02:18.7329 21683/7fec0c265780 age/Cor/CoreMain.cpp:819 ]: Checking whether to disconnect long-running connections for process 624, application /home/deploy/testprep_rails/current/public (production)
[ 2016-10-24 23:02:18.7329 21683/7fec0c265780 age/Cor/CoreMain.cpp:819 ]: Checking whether to disconnect long-running connections for process 3289, application /home/deploy/testprep_rails/current/public (production)
[ 2016-10-24 23:02:18.7329 21683/7fec0c265780 age/Cor/CoreMain.cpp:819 ]: Checking whether to disconnect long-running connections for process 22519, application /home/deploy/testprep_rails_staging/current/public (staging)
[ 2016-10-24 23:02:18.7330 21683/7febe7fff700 Ser/Server.h:817 ]: [ApiServer] Freed 0 spare client objects
[ 2016-10-24 23:02:18.7330 21683/7febe7fff700 Ser/Server.h:464 ]: [ApiServer] Shutdown finished

[ 2016-10-24 23:02:18.7331 21688/7f5c3c815700 age/Ust/UstRouterMain.cpp:422 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2016-10-24 23:02:18.7331 21688/7f5c4344f780 age/Ust/UstRouterMain.cpp:492 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2016-10-24 23:02:18.7348 21688/7f5c2ffff700 Ser/Server.h:817 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2016-10-24 23:02:18.7355 21688/7f5c2ffff700 Ser/Server.h:464 ]: [UstRouterApiServer] Shutdown finished
[ 2016-10-24 23:02:18.7357 21688/7f5c3c815700 Ser/Server.h:464 ]: [UstRouter] Shutdown finished
[ 2016-10-24 23:02:18.7359 21688/7f5c4344f780 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished
2016/10/24 23:02:19 [info] 3530#3530: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:71
[ 2016-10-24 23:02:19.8095 3538/7fe734526780 age/Wat/WatchdogMain.cpp:1291 ]: Starting Passenger watchdog...
[ 2016-10-24 23:02:19.8169 3541/7fc6d76d2780 age/Cor/CoreMain.cpp:982 ]: Starting Passenger core...
[ 2016-10-24 23:02:19.8170 3541/7fc6d76d2780 age/Cor/CoreMain.cpp:235 ]: Passenger core running in multi-application mode.
[ 2016-10-24 23:02:19.8185 3541/7fc6d76d2780 age/Cor/CoreMain.cpp:732 ]: Passenger core online, PID 3541
[ 2016-10-24 23:02:19.8266 3546/7fd1a4535780 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2016-10-24 23:02:19.8290 3546/7fd1a4535780 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 3546

Hi

My rails app production server CPU usage sometimes reaches to 100% and making app to be unresponsive. We are using Ubuntu 16.04.1 LTS server and configured Rails app along with Nginx and passenger as suggested in gorails deploy ruby on rails tutorial. I don't know why this is happening and it leads to website down for so many times. If anyone has any solution to fix this please tell me.