It seems that I can't install capistrano with rails-less. Why is this?
I'm struggling here with no success in order to install capistrano on my Ubuntu dev machine.
Here is the list of commands issued:
1) sudo apt-get update
2) sudo apt-get install build-essential git-core curl
3) bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
4) echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
5) (close and reopen terminal window)
6) rvm notes
(looked for: "For Ruby (MRI & ree) you should install the following OS dependencies:"
and did:
7) sudo aptitude install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
Now we can install ruby by doing:
8) rvm install 1.9.2
Then we tell rvm to use it:
9) rvm 1.9.2
And to do it always:
10) rvm --default use 1.9.2
With ruby properly instaled we can now:
11) gem install capistrano
And then:
12) gem install railsless-deploy
Despite all those steps being successful steps, when I do: cap -T
I'm unable to see the deploy tasks listed as expected.
I only getting: cap invoke cap shell
listed.
Why?
Do I need a Capfile ? With some require setting开发者_Go百科s? If so, then, does that mean that we need to issue or capistrano command line commands only after we move the project directory? Please advice, I'm absolutely newbie on Capistrano here.
Thanks a lot, MEM
Yes you still need a Capfile.
STEP 1. Create a Capfile with the following command, running it from within the project directory:
capify .
(This will also create config/deploy.rb)
STEP 2. Edit this new Capfile as per the railsless-deploy readme, so that it has the following content:
require 'rubygems'
require 'railsless-deploy'
load 'config/deploy'
At this point you can run
cap -T
and you should see tasks such as "cap deploy" listed. However, capistrano knows nothing about your target server(s), etc, yet.
STEP 3. Edit config/deploy.rb to provide the details of your SCM, server name(s), etc.
For help on this, see the section "Configuration" in the Capistrano "From The Beginning" wiki.
You may also override the deploy task here if the default provided by railsless-deploy is unsuitable.
A minimal config/deploy.rb might look as follows:
set :user, "myuser"
set :application, "myapp"
set :repository, "https://github.com/me/myapprepo"
set :scm, :git
default_run_options[:pty] = true
role :web, "myhost.example.com"
role :app, "myhost.example.com"
Of course you must correct the above with your app, host and login details.
You can then follow the typical path of
cap deploy:setup
cap deploy:check
cap deploy
# ... etc
However, after cap deploy:setup has created the deploy directory tree (by default something like /u/apps/myapp/) on the remote server(s), you may have to alter ownership (or permissions) in order for cap deploy to run. The following will recursively change the owner and group of /u/apps/myapp/ to user "myuser".
sudo chown -R myuser. /u/apps/myapp
On our servers, I actually create this /u/apps/ directory and change its ownership on server preparation (say, with puppet), long before capistrano sees them. That way, developers can use cap deploy:setup and cap deploy, etc, without hitting these issues.
"does that mean that we need to issue or capistrano command line commands only after we move the project directory?"
I'm not sure I understand this part of your question. If you move your project directory, you'll still be able to execute capistrano commands, but you must always execute them from within the project directory.
精彩评论