[] Redmine Capistrano |
, Redmine . Redmine Git ( ).
Redmine, ...
. , .
, , (, ) Redmine. . , , .
, ( , , Rails-, . , Python, Redmine . , Rails- . , . , , Redmine.
Capistrano , . Ruby, Ruby- Rails-. Capistrano , SSH. . Chef , Capistrano , .
Redmine, capistranorb.com. Readme .
Redmine local/x.y-stable
Gemfile.local
. gems Redmine.
Gemfile.local
group :development do
# uncomment if you're using modern (and secure!) ed25519 ssh keys
# gem 'net-ssh', '4.0.0.alpha2'
gem 'capistrano', '~> 3.4.0'
gem 'capistrano-rails', require: false
end
bundle install
/ Gemfile.local
, Gemfile.lock
.
bundle exec cap install
Capistrano. : config/deploy.rb
config/deploy/
, ( "stages" "") . Redmine , , , "staging target", () stage . , deploy.rb
, stage config/deploy
. , , git .
Capistrano:
config/deploy.rb
# config valid only for current version of Capistrano
lock '3.4.0'
set :application, 'redmine'
set :scm, :git
set :repo_url, 'git@code.yourcompany.com:redmine.git'
# Target directory in the server.
# Should exist and the user account you're using for deployment should
# have write access.
set :deploy_to, '/srv/webapps/redmine'
set :pty, true
set :log_level, :info
# Linked files are expected to exist below /srv/webapps/redmine/shared and will be
# symlinked into the deployed # code. Create them either manually or through an
# automation tool like chef. The reason for doing so is to not keep database
# credentials and server secrets in your git repository.
set :linked_files, fetch(:linked_files, []).push('config/database.yml',
'config/secrets.yml')
# Directories with contents you want to keep across deployments are declared here.
# Most important is files where Redmine stores any uploaded files.
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp',
'vendor/bundle', 'files')
# keep the last 5 deployed versions on the server.
# Useful in case you have to revert to an older version.
set :keep_releases, 5
namespace :deploy do
# Declares a task to be executed once the new code is on the server.
after :updated, :plugin_assets do
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
# Copy over plugin assets
execute :rake, 'redmine:plugins:assets'
# Run plugin migrations
execute :rake, 'redmine:plugins:migrate'
end
end
end
end
# This will run after the deployment finished and is used to reload
# the application. You most probably have to change that depending on
# your server setup.
after :published, :restart do
on roles(:app) do
sudo "/etc/init.d/unicorn reload redmine"
end
end
# cleans up old versions on the server (keeping the number of releases
# configured above)
after :finished, 'deploy:cleanup'
end
, , Capistrano :
config/deploy/production.rb
set :branch, 'local/3.2-stable'
server 'redmine.yourcompany.com', user: 'deploy', roles: %w{web app db}
, deploy_to
stage, stage. Gemfile.local, Gemfile.lock Capistrano, . Redmine .
Git Redmine, Git Capistrano, .
Capistrano SSH . - SSH git .
, , :
$ bundle exec cap production deploy
, Redmine . - , .