개인 프로젝트의 경우 rails 4
과 nginx
및 passenger
을 사용하고 있습니다. 오늘은 배포를 위해 capistrano
을 사용하기로 결정했습니다. 내 capsitrano 구성 잘 작동하고 프로덕션 환경에 내 응용 프로그램을 배포 할 수 있어요. 배포 후 current
폴더와 최신 release
폴더에서 변경 사항을 볼 수 있습니다. 하지만 브라우저에서 변경 사항을 볼 수 없습니다.Capistrano/Rails가 최신 변경 사항을 표시하지 않습니다.
카피 스트라 노를 설치 한 후 내 서버에 폴더 구조가 다음과 같다고 가정 해 보겠습니다.
[1]app_name/app/views/finance/index.html
[2]app_name/releases/<latest_release>app/views/finance/index.html
[3]app_name/current/app/views/finance/index.html
그때 서버에 ssh를하는 경우 I can see my code changes are applied to folder structure [2] and [3]
하지만 내 코드 폴더 구조에서 업데이트되지에서 [1].
다음은 내 캡 파일의 미리보기입니다 :
production.rb
set :port, 22
set :user, 'deploy'
set :deploy_via, :remote_cache
set :use_sudo, false
server 'xx.xxx.x.xxx',
roles: [:web, :app, :db],
port: fetch(:port),
user: fetch(:user),
primary: true
set :deploy_to, "/var/www/app_name"
set :ssh_options, {
forward_agent: true,
auth_methods: %w(publickey),
user: 'deploy',
}
set :rails_env, :production
set :conditionally_migrate, true
deploy.rb
lock '3.4.0'
set :application, 'app_name'
set :repo_url, '[email protected]:user_name/app_name.git'
# Default branch is :master
set :branch, 'master'
set :use_sudo, false
set :bundle_binstubs, nil
# 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', 'config/secrets.yml')
# 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 keep_releases is 5
set :keep_releases, 5
set :keep_assets, 3
namespace :deploy do
task :restart do
on roles(:app) do
within release_path do
execute :touch, 'tmp/restart.txt'
end
end
end
end
내가 current
디렉토리 내 응용 프로그램 서버를 가리 키도록해야합니까?
app_name/app는 카피 스트라 노가 저장소를 배치하는 위치가 아닙니다. 아마도 코드를 수동으로 입력했을 것입니다. 아마 app_name/app/current를 사용해야합니다. – ollpu
@ollpu 예 app_name/app 위치에 코드를 넣습니다. 카피스트로나가 세워지기 전에 거기에있었습니다. 이제 나는 현재 디렉토리에 코드를 푸쉬하는 설정을했다. app_name/app/current를 어떻게 사용할 수 있습니까? 현재 디렉토리로가는 방법을 승객에게 알려줄 수 있습니까? – Reboot