2017-11-21 2 views
2

mina 배포 후 "/ home/x/app/current symlink 업데이트 중"에 매달려 있습니다. 오류 없음. 그것은 단지 거기에 앉아있다.Mina를 사용하여 Rails5 앱을 배포하는 데 배포 문제가 발생했습니다. 업데이트시 멈춤 Symlink

나는 서버와 "mina setup"에서 app 디렉토리를 제거하려고 시도했지만 여전히 같은 문제가 발생합니다. 처음에 배포하는 데 아무런 문제가 없었지만 후속 릴리스를 배포하려는 시도로 인해이 문제가 발생합니다.

나는 처음에 배포하는이 가이드를 따라 :

require 'mina/rails' 
require 'mina/git' 
require 'mina/rvm' 

# Basic settings: 
# domain  - The hostname to SSH to. 
# deploy_to - Path to deploy into. 
# repository - Git repo to clone from. (needed by mina/git) 
# branch  - Branch name to deploy. (needed by mina/git) 

set :application_name, 'x' 
set :domain, 'x' 
set :user, fetch(:application_name) 
set :deploy_to, "/home/#{fetch(:user)}/app" 
set :repository, 'x' 
set :branch, 'x' 
set :rvm_use_path, '/etc/profile.d/rvm.sh' 

# Optional settings: 
# set :user, 'foobar'   # Username in the server to SSH to. 
# set :port, '30000'   # SSH port number. 
# set :forward_agent, true  # SSH forward_agent. 

# shared dirs and files will be symlinked into the app-folder by the 'deploy:link_shared_paths' step. 
# set :shared_dirs, fetch(:shared_dirs, []).push('somedir') 
set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml') 

# This task is the environment that is loaded for all remote run commands, such as 
# `mina deploy` or `mina rake`. 
task :environment do 
    ruby_version = File.read('.ruby-version').strip 
    raise "Couldn't determine Ruby version: Do you have a file .ruby-version in your project root?" if ruby_version.empty? 

    invoke :'rvm:use', ruby_version 
end 

task :setup do 

    in_path(fetch(:shared_path)) do 

    command %[mkdir -p config] 

    # Create database.yml for Postgres if it doesn't exist 
    path_database_yml = "config/database.yml" 
    database_yml = %[production: 
    database: #{fetch(:user)} 
    adapter: postgresql 
    pool: 5 
    timeout: 5000] 
    command %[test -e #{path_database_yml} || echo "#{database_yml}" > #{path_database_yml}] 

    # Create secrets.yml if it doesn't exist 
    path_secrets_yml = "config/secrets.yml" 
    secrets_yml = %[production:\n secret_key_base:\n #{`rake secret`.strip}] 
    command %[test -e #{path_secrets_yml} || echo "#{secrets_yml}" > #{path_secrets_yml}] 

    # Remove others-permission for config directory 
    command %[chmod -R o-rwx config] 
    end 

end 

desc "Deploys the current version to the server." 
task :deploy do 
    # uncomment this line to make sure you pushed your local branch to the remote origin 
    # invoke :'git:ensure_pushed' 
    deploy do 
    # Put things that will set up an empty directory into a fully set-up 
    # instance of your project. 
    invoke :'git:clone' 
    invoke :'deploy:link_shared_paths' 
    invoke :'bundle:install' 
    # invoke :'rails:db_migrate' 
    invoke :'rails:assets_precompile' 
    invoke :'deploy:cleanup' 

    on :launch do 
     command "sudo service #{fetch(:user)} restart" 
    end 
    end 

    # you can use `run :local` to run tasks on local machine before of after the deploy scripts 
    # run(:local){ say 'done' } 
end 

# For help in making your deploy script, see the Mina documentation: 
# 
# - https://github.com/mina-deploy/mina/tree/master/docs 

답변

1

https://www.ralfebert.de/tutorials/rails-deployment/ 나는 같은 좋은 자습서를 사용하는 것과 동일한 문제가있어.

mina deploy --verbose을 실행하면 걸리는 부분을 볼 수 있습니다. 제게 그것은 심볼릭 링크 업데이트가 아니지만, sudo service rails-demo restart 명령입니다.

나는 서버에 sudo visudo를 사용하고 거기에 다음 줄을 넣어 :

rails-demo ALL=(ALL) NOPASSWD: /usr/sbin/service rails-demo restart 

이 지금은 매력처럼 작동합니다.

행운을 빈다.

관련 문제