Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8244403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:50:27+00:00 2026-06-07T21:50:27+00:00

I am trying to write a custom capistrano task that compiles my assets locally

  • 0

I am trying to write a custom capistrano task that compiles my assets locally and then uses rsync to push them up to the production server. The problem is I cannot figure out how to access the IP address of my app server when using using capistrano’s run_locally.

Here is an excerpt from my config/deploy.rb:

server "[some_ip_address]", :web, :app, :db, :primary => true

...

namespace :assets do
  desc 'Run the precompile task locally and rsync with shared'
  task :precompile, :roles => :web, :except => { :no_release => true } do

    run_locally "bundle exec rake assets:precompile"
    run_locally "rsync -zvrh --progress -e 'ssh -i #{ssh_options[:keys][0]}' public/assets #{user}@$CAPISTRANO:HOST$:#{shared_path}"
    puts "cleaning up locally compiled assets"
    run_locally "bundle exec rake assets:clean"
  end
end

The problem is that $CAPISTRANO:HOST$ does not expand out to the ip. I know I could hard code it, but I would like to do it properly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:50:29+00:00Added an answer on June 7, 2026 at 9:50 pm

    Try to define capistrano variable with host IP and reference it anywhere in capistrano scripts to keep them DRY:

    set :host, "some IP addresss"
    server host, :web, :app, :db, :primary => true
    

    and in your task definition:

    run_locally "... #{host} ..."
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a custom powershell script that will create a local user
I am trying to write a custom script that will keep a list of
I'm trying to write a custom MarkupExtension that allows me to use my own
I'm trying to write a custom SQL query that will create a list of
I'm trying to write a custom JSPX tag that reads the value of a
I'm trying to write a custom filter method that takes an arbitrary number of
I'm trying to write a custom validation class that validates that an email is
I'm trying to write a custom in-window confirm dialog (based on jQuery UI) that
I’m trying to write a custom TCP based long polling server that will serve
I'm new to Matlab and I'm trying to write custom function in matlab that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.