Im trying to create a new user to deploy my application from my local machine to my external server.
I've got it working using root but understand it's not secure to use root, therefore I want to create a user called 'deployer'. I've added this user to my external server and copied my local is_rsa.pub key to /.ssh/authorized_keys on the server, however when I run cap development deploy
I keep getting the following error:
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 git@github.com: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
If I run ssh -T git@github.com on the external server it says:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
This username is not deployer though, I assume its the username of the github account.
Any ideas what I need to do? Do I need to create the deployer user on my local machine too?
Here is my deploy.rb file:
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, "git@github.xyz/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 file:
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
Thanks