2015-11-11 3 views
0

Я пытаюсь развернуть приложение rails на сервере aws. Я получаю сообщение об ошибке ниже. Я попытался запустить' brew install bash 'за предложение на сайте, но не работаетОшибка синтаксиса Capistrano около неожиданного токена `('

DEBUG [125bed1f] Баш:. -c: строка 0: ошибка синтаксиса около неожиданной лексемы (' DEBUG [125bed1f] bash: -c: line 0: кд/вар/WWW/MyApp/репо & & (GIT_ASKPASS =/бен/эхо GIT_SSH =/TMP/MyApp /git-ssh.sh/usr/bin/env git archive (отсоединенный tar -x -f -C/var/www/myapp/релизы/20151111001549) ' cap aborted! SSHKit :: Runner :: ExecuteError: Исключение при выполнении как [email protected]: git статус выхода: 1 git stdout: bash: -c: line 0: синтаксическая ошибка около неожиданного токена (' bash: -c: line 0: cd/var/www/myapp/repo & & (GIT_ASKPASS =/bin/echo GIT_SSH =/tmp/myapp/git-ssh.sh/usr/bin/env git архив (снят | деготь -x -f - -C/вар/WWW/MYAPP/выпуски/20151111001549)» мерзавец STDERR: Ничего не написано

Вот файл deploy.rb

# config valid only for current version of Capistrano 
lock '3.4.0' 

set :application, 'myapp' 
set :repo_url, '[email protected]:myaccount/myapp' 

# Default branch is :master 
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call 
# parses out the current branch you're on. See: http://www.harukizaemon.com/2008/05/deploying-branches-with-capistrano.html 
current_branch = `git branch`.match(/\* (\S+)\s/m)[1] 

# use the branch specified as a param, then use the current branch. If all fails use master branch 
set :branch, ENV['BRANCH'] || current_branch || 'develop' # you can use the 'branch' parameter on deployment to specify the branch you wish to deploy 

# issue of capistrano https://github.com/capistrano/bundler/issues/45#issuecomment-47428203 
set :bundle_binstubs, nil 

# Default deploy_to directory is /var/www/my_app_name 
# set :deploy_to, '/var/www/my_app_name' 

# Default value for :scm is :git 
# set :scm, :git 

# Default value for :format is :pretty 
# set :format, :pretty 

# Default value for :log_level is :debug 
# set :log_level, :debug 

# Default value for :pty is false 
set :pty, true 

# Default value for :linked_files is [] 
set :linked_files, fetch(:linked_files, []).push('config/database.yml', '.env') 

# Default value for linked_dirs is [] 
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system') 

# Default value for default_env is {} 
# set :default_env, { path: "/opt/ruby/bin:$PATH" } 

# Default value for keep_releases is 5 
# set :keep_releases, 5 

set :puma_rackup, -> { File.join(current_path, 'config.ru') } 
set :puma_state, "#{shared_path}/tmp/pids/puma.state" 
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid" 
# set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock" #accept array for multi-bind 
set :puma_conf, "#{shared_path}/puma.rb" 
set :puma_access_log, "#{shared_path}/log/puma_access.log" 
set :puma_error_log, "#{shared_path}/log/puma_error.log" 
set :puma_role, :app 
set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production')) 
set :puma_threads, [0, 16] 
set :puma_workers, 0 
set :puma_worker_timeout, nil 
set :puma_init_active_record, false 
set :puma_preload_app, true 
set :puma_prune_bundler, false 
set :puma_bind, 'tcp://0.0.0.0:9292' 

# whenever command 
set :whenever_command, -> { [:bundle, :exec, :whenever] } 

# update the Gemfile path 
# set :bundle_gemfile, -> { current_path.join('Gemfile') } 

namespace :puma do 
    desc 'Create Directories for Puma Pids and Socket' 
    task :make_dirs do 
    on roles(:app) do 
     execute "mkdir #{shared_path}/tmp/sockets -p" 
     execute "mkdir #{shared_path}/tmp/pids -p" 
    end 
    end 

    before :start, :make_dirs 
end 


namespace :deploy do 
    # https://coderwall.com/p/ttrhow/deploying-rails-app-using-nginx-puma-and-capistrano-3 
    desc 'Make sure local git is in sync with remote.' 
    task :check_revision do 
    on roles(:app) do 
     unless `git rev-parse #{current_branch}` == `git rev-parse origin/#{current_branch}` 
     puts 'WARNING: HEAD is not the same as origin/master' 
     puts 'Run `git push` to sync changes.' 
     exit 
     end 
    end 
    end 

    desc 'Initial Deploy' 
    task :initial do 
    on roles(:app) do 
     before 'deploy:restart', 'puma:start' 
     invoke 'deploy' 
    end 
    end 

    desc 'Restart application' 
    task :restart do 
    on roles(:app), in: :sequence, wait: 5 do 
     invoke 'puma:restart' 
    end 
    end 

    # ps aux | grep puma # Get puma pid 
    # kill -s SIGUSR2 pid # Restart puma 
    # kill -s SIGTERM pid # Stop puma 
    before :starting, :check_revision 
    after :finishing, :compile_assets 
    after :finishing, :cleanup 
    after :finishing, :restart 

    after :restart, :clear_cache do 
    on roles(:web), in: :groups, limit: 3, wait: 10 do 
     # Here we can do anything such as: 
     # within release_path do 
     # execute :rake, 'cache:clear' 
     # end 
    end 
    end 

end 

ответ

0

Похоже ветви I был на происхождении/испытании - оторванная головка. Я выполнил инструкции на этой странице переполнения стека для ответа.

git: switch branch without detaching head