我試圖創建一個新用戶來將我的應用程序從本地機器部署到我的外部服務器。從本地機器部署Capistrano
我已經使用root工作,但明白使用root並不安全,因此我想創建一個名爲'deployer'的用戶。我已經將此用戶添加到我的外部服務器和複製我的本地is_rsa.pub關鍵/.ssh/authorized_keys服務器上,但是當我運行cap development deploy
我不斷收到以下錯誤:
failed: "sh -c 'if [ -d /var/www/vhosts/xyz.co.uk/shared/cached-copy ]; then cd
/var/www/vhosts/xyz.co.uk/shared/cached-copy && git fetch -q origin && git fetch --
tags -q origin && git reset -q --hard 2b738f4ca8008dcf9e84c4be5d63d906a7bfd760 && git clean
-q -d -x -f; else git clone -q [email protected]:xyz/xyz.co.uk.git
/var/www/vhosts/xyz.co.uk/shared/cached-copy && cd /var/www/vhosts/xyz.co.uk/shared/cached-
copy && git checkout -q -b deploy 2b738f4ca8008dcf9e84c4be5d63d906a7bfd760; fi'" on
x.xx.xx.xxx
如果我運行SSH -T [email protected]在外部服務器上,它說:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
這個用戶名,雖然沒有部署,我認爲GitHub的帳戶的用戶名。
任何想法我需要做什麼?我是否也需要在本地機器上創建部署者用戶?
這裏是我的deploy.rb文件:
set :stage_dir, 'app/config/deploy' # needed for Symfony2 only
set :stages, %w(production staging development)
require 'capistrano/ext/multistage'
set :application, "xyz.co.uk"
set :user, "deployer" # The server's user for deploys
set :normalize_asset_timestamps, false
set :repository, "[email protected]/xyz.co.uk.git"
set :scm, :git
set :keep_releases, 3
after "deploy:update", "deploy:cleanup"
set :use_sudo, false
set :web_path, "web"
set :shared_files, ["app/config/parameters.yml"]
set :shared_children, [app_path + "/logs", web_path + "/uploads"]
set :use_composer, true
set :update_vendors, true
set :dump_assetic_assets, true
set :deploy_via, :remote_cache
#logger.level = Logger::MAX_LEVEL
after "deploy:update_code" do
capifony_pretty_print "--> Ensuring cache directory permissions"
run "setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX #{latest_release}/#{cache_path}"
run "setfacl -dR -m u:www-data:rwX -m u:`whoami`:rwX #{latest_release}/#{cache_path}"
capifony_puts_ok
end
deveopment.rb文件:
server 'x.xx.xx.xxx', :app, :web, :db, :primary => true
ssh_options[:port] = 1234
ssh_options[:forward_agent] = true
default_run_options[:pty] = true
set :deploy_to, "/var/www/vhosts/xyz.co.uk"
set :symfony_env_prod, "dev"
set :branch, "develop"
# Need to clear *_dev controllers
set :clear_controllers, false
感謝
我已經在我的我的原始問題中添加了我的development.rb文件,但它仍然無效。我很疑惑用戶指的是什麼。這是本地用戶,服務器用戶還是github用戶? – user1961082 2013-04-09 09:37:46
沒關係,我現在修好了。 「部署者」用戶在服務器上沒有寫權限。 – user1961082 2013-04-09 10:34:46