Capistrano deploy
Created by: mikew
Capfile.example and config/deploy.rb.example for a capistrano deployment with support for sub-uri, as discussed in #2546 (closed)
Merge request reports
Activity
Created by: zzet
@mikew may be better use deploy by env? production / staging / development ? with symlinks and others :)
By Administrator on 2013-01-25T18:53:01 (imported from GitLab project)
By Administrator on 2013-01-25T18:53:01 (imported from GitLab)
- config/deploy.rb.example 0 → 100644
2 set :db_adapter, 'mysql' # or postgres 3 set :mount_point, '/' 4 set :application, 'gitlabhq' 5 set :user, 'gitlab' 6 set :rails_env, 'production' 7 set :deploy_to, "/home/#{user}/apps/#{application}" 8 set :bundle_without, %w[development test] + (%w[mysql postgres] - [db_adapter]) 9 set :asset_env, "RAILS_GROUPS=assets RAILS_RELATIVE_URL_ROOT=#{mount_point.sub /\/+\Z/, ''}" 10 11 set :use_sudo, false 12 default_run_options[:pty] = true 13 14 # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` 15 set :scm, :git 16 set :repository, "git@#{domain}:#{application}.git" 17 set :deploy_via, :remote_cache - config/deploy.rb.example 0 → 100644
2 set :db_adapter, 'mysql' # or postgres 3 set :mount_point, '/' 4 set :application, 'gitlabhq' 5 set :user, 'gitlab' 6 set :rails_env, 'production' 7 set :deploy_to, "/home/#{user}/apps/#{application}" 8 set :bundle_without, %w[development test] + (%w[mysql postgres] - [db_adapter]) 9 set :asset_env, "RAILS_GROUPS=assets RAILS_RELATIVE_URL_ROOT=#{mount_point.sub /\/+\Z/, ''}" 10 11 set :use_sudo, false 12 default_run_options[:pty] = true 13 14 # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` 15 set :scm, :git 16 set :repository, "git@#{domain}:#{application}.git" 17 set :deploy_via, :remote_cache - config/deploy.rb.example 0 → 100644
1 set :domain, 'set application domain here' 2 set :db_adapter, 'mysql' # or postgres 3 set :mount_point, '/' 4 set :application, 'gitlabhq' 5 set :user, 'gitlab' 6 set :rails_env, 'production' 7 set :deploy_to, "/home/#{user}/apps/#{application}" 8 set :bundle_without, %w[development test] + (%w[mysql postgres] - [db_adapter]) Created by: zzet
mb
stages
withdefault_stage
vsenv
only? see our deploy.rb with production and staging stages. For example ;)By Administrator on 2013-01-31T22:08:46 (imported from GitLab project)
By Administrator on 2013-01-31T22:08:46 (imported from GitLab)
- config/deploy.rb.example 0 → 100644
17 set :deploy_via, :remote_cache 18 19 # Alternatively, you can deploy via copy, if you don't have gitlab in git 20 #set :scm, :none 21 #set :repository, '.' 22 #set :deploy_via, :copy 23 24 server domain, :app, :web, :db, primary: true 25 26 namespace :foreman do 27 desc 'Export the Procfile to Ubuntu upstart scripts' 28 task :export, roles: :app do 29 foreman_export = "foreman export upstart /etc/init -f Procfile -a #{application} -u #{user} -l #{shared_path}/log/foreman" 30 run "cd #{release_path} && #{sudo} #{fetch :bundle_cmd, 'bundle'} exec #{foreman_export}" 31 end 32 - config/deploy.rb.example 0 → 100644
35 run "#{sudo} service #{application} start" 36 end 37 38 desc 'Stop the application services' 39 task :stop, roles: :app do 40 run "#{sudo} service #{application} stop" 41 end 42 43 desc 'Restart the application services' 44 task :restart, roles: :app do 45 run "#{sudo} service #{application} restart" 46 end 47 end 48 49 namespace :deploy do 50 desc 'Start the application services' Created by: zzet
try to add some as
namespace :deploy do desc "Symlinks the database.yml" task :symlink_db, :roles => :app do run "ln -nfs #{release_path}/config/database.yml.{db_adapter} #{release_path}/config/database.yml" end desc "Seed database data" task :seed_data do run "cd #{current_path} && RAILS_ENV=#{rails_env} #{rake} db:seed" end desc "Symlinks the gitlab.yml" task :symlink_gitlab, :roles => :app do run "ln -nfs #{release_path}/config/gitlab.yml.{example} #{release_path}/config/gitlab.yml" end desc "Symlinks the resque.yml" task :symlink_resque, :roles => :app do run "ln -nfs #{release_path}/config/resque.yml.{example} #{release_path}/config/resque.yml" end desc "Symlinks the unicorn.rb" task :symlink_unicorn, :roles => :app do run "ln -nfs #{release_path}/config/unicorn.rb.{example} #{release_path}/config/unicorn.rb" end end before 'deploy:finalize_update', 'deploy:symlink_db', 'deploy:symlink_gitlab', 'deploy:symlink_resque', 'deploy:symlink_unicorn'
By Administrator on 2013-01-31T22:08:46 (imported from GitLab project)
By Administrator on 2013-01-31T22:08:46 (imported from GitLab)
- config/deploy.rb.example 0 → 100644
17 set :deploy_via, :remote_cache 18 19 # Alternatively, you can deploy via copy, if you don't have gitlab in git 20 #set :scm, :none 21 #set :repository, '.' 22 #set :deploy_via, :copy 23 24 server domain, :app, :web, :db, primary: true 25 26 namespace :foreman do 27 desc 'Export the Procfile to Ubuntu upstart scripts' 28 task :export, roles: :app do 29 foreman_export = "foreman export upstart /etc/init -f Procfile -a #{application} -u #{user} -l #{shared_path}/log/foreman" 30 run "cd #{release_path} && #{sudo} #{fetch :bundle_cmd, 'bundle'} exec #{foreman_export}" 31 end 32 - config/deploy.rb.example 0 → 100644
35 run "#{sudo} service #{application} start" 36 end 37 38 desc 'Stop the application services' 39 task :stop, roles: :app do 40 run "#{sudo} service #{application} stop" 41 end 42 43 desc 'Restart the application services' 44 task :restart, roles: :app do 45 run "#{sudo} service #{application} restart" 46 end 47 end 48 49 namespace :deploy do 50 desc 'Start the application services' Created by: mikew
- I thought gitlab used seed_fu?
- they dropped resque, so deploy:symlink_resque isn't needed
- aren't these files usually edited by hand before deployment anyways?
By Administrator on 2013-01-31T22:08:46 (imported from GitLab project)
By Administrator on 2013-01-31T22:08:46 (imported from GitLab)
- config/deploy.rb.example 0 → 100644
1 set :domain, 'set application domain here' 2 set :db_adapter, 'mysql' # or postgres 3 set :mount_point, '/' 4 set :application, 'gitlabhq' 5 set :user, 'gitlab' 6 set :rails_env, 'production' 7 set :deploy_to, "/home/#{user}/apps/#{application}" 8 set :bundle_without, %w[development test] + (%w[mysql postgres] - [db_adapter]) Created by: mikew
people are free to integrate capistrano-multistage, this is an example after all. I could at least wrap domain in a block on lines 25:27 to save users from having to do it.
By Administrator on 2013-01-31T22:08:46 (imported from GitLab project)
By Administrator on 2013-01-31T22:08:46 (imported from GitLab)
- config/deploy.rb.example 0 → 100644
35 run "#{sudo} service #{application} start" 36 end 37 38 desc 'Stop the application services' 39 task :stop, roles: :app do 40 run "#{sudo} service #{application} stop" 41 end 42 43 desc 'Restart the application services' 44 task :restart, roles: :app do 45 run "#{sudo} service #{application} restart" 46 end 47 end 48 49 namespace :deploy do 50 desc 'Start the application services' - config/deploy.rb.example 0 → 100644
1 set :domain, 'set application domain here' 2 set :db_adapter, 'mysql' # or postgres 3 set :mount_point, '/' 4 set :application, 'gitlabhq' 5 set :user, 'gitlab' 6 set :rails_env, 'production' 7 set :deploy_to, "/home/#{user}/apps/#{application}" 8 set :bundle_without, %w[development test] + (%w[mysql postgres] - [db_adapter]) Created by: zzet
yes %) Yes, this is one great example of that in practice heavily rewritten. And that is why - it was easier to just mention readme file about capistrano ))) I think, that example must be easy integrated with minimal rewriting %) no more. I show your another examples. No more.
By Administrator on 2013-01-31T22:08:46 (imported from GitLab project)
By Administrator on 2013-01-31T22:08:46 (imported from GitLab)
- config/deploy.rb.example 0 → 100644
35 run "#{sudo} service #{application} start" 36 end 37 38 desc 'Stop the application services' 39 task :stop, roles: :app do 40 run "#{sudo} service #{application} stop" 41 end 42 43 desc 'Restart the application services' 44 task :restart, roles: :app do 45 run "#{sudo} service #{application} restart" 46 end 47 end 48 49 namespace :deploy do 50 desc 'Start the application services' Created by: mikew
WTF???? I sincerely sympathy.
pardon my ignorance, but that is how I've been deploying gitlab since the start:
- clone to development machine
- copy example files
- edit as needed
honestly I just deploy via copy. I don't keep gitlab in a git repository, just sync to upstream each major release.
By Administrator on 2013-01-31T22:08:46 (imported from GitLab project)
By Administrator on 2013-01-31T22:08:46 (imported from GitLab)
- config/deploy.rb.example 0 → 100644
35 run "#{sudo} service #{application} start" 36 end 37 38 desc 'Stop the application services' 39 task :stop, roles: :app do 40 run "#{sudo} service #{application} stop" 41 end 42 43 desc 'Restart the application services' 44 task :restart, roles: :app do 45 run "#{sudo} service #{application} restart" 46 end 47 end 48 49 namespace :deploy do 50 desc 'Start the application services' - config/deploy.rb.example 0 → 100644
35 run "#{sudo} service #{application} start" 36 end 37 38 desc 'Stop the application services' 39 task :stop, roles: :app do 40 run "#{sudo} service #{application} stop" 41 end 42 43 desc 'Restart the application services' 44 task :restart, roles: :app do 45 run "#{sudo} service #{application} restart" 46 end 47 end 48 49 namespace :deploy do 50 desc 'Start the application services' - config/deploy.rb.example 0 → 100644
35 run "#{sudo} service #{application} start" 36 end 37 38 desc 'Stop the application services' 39 task :stop, roles: :app do 40 run "#{sudo} service #{application} stop" 41 end 42 43 desc 'Restart the application services' 44 task :restart, roles: :app do 45 run "#{sudo} service #{application} restart" 46 end 47 end 48 49 namespace :deploy do 50 desc 'Start the application services' - config/deploy.rb.example 0 → 100644
35 run "#{sudo} service #{application} start" 36 end 37 38 desc 'Stop the application services' 39 task :stop, roles: :app do 40 run "#{sudo} service #{application} stop" 41 end 42 43 desc 'Restart the application services' 44 task :restart, roles: :app do 45 run "#{sudo} service #{application} restart" 46 end 47 end 48 49 namespace :deploy do 50 desc 'Start the application services' Created by: mikew
Why would you need to edit it every time? you set it once, and either store it in git on a private server or deploy via copy. I've only set it the one time, hardly a hassle
By Administrator on 2013-01-31T22:08:46 (imported from GitLab project)
By Administrator on 2013-01-31T22:08:46 (imported from GitLab)
- config/deploy.rb.example 0 → 100644
35 run "#{sudo} service #{application} start" 36 end 37 38 desc 'Stop the application services' 39 task :stop, roles: :app do 40 run "#{sudo} service #{application} stop" 41 end 42 43 desc 'Restart the application services' 44 task :restart, roles: :app do 45 run "#{sudo} service #{application} restart" 46 end 47 end 48 49 namespace :deploy do 50 desc 'Start the application services' Created by: zzet
I do not want to discuss it) You already confused in his words and contradict what was said earlier. In fact, this configuration looks like rsync or scp. I use
chef
for sever configuration,runit
as supervisor for example, but I do not mean that all use it )))had a task before me to show you that the suggested configuration is not universal and it has a few drawbacks. look at the config files that are in the network. You see there are many examples of use. Restrict the user, and not the more experienced guide in a bad way - does not paint you.
By Administrator on 2013-01-31T22:08:46 (imported from GitLab project)
By Administrator on 2013-01-31T22:08:46 (imported from GitLab)
- config/deploy.rb.example 0 → 100644
35 run "#{sudo} service #{application} start" 36 end 37 38 desc 'Stop the application services' 39 task :stop, roles: :app do 40 run "#{sudo} service #{application} stop" 41 end 42 43 desc 'Restart the application services' 44 task :restart, roles: :app do 45 run "#{sudo} service #{application} restart" 46 end 47 end 48 49 namespace :deploy do 50 desc 'Start the application services' Created by: mikew
it's capistrano, choose to deploy via git/scp/whatever. getting the code to the server is akin to an implementation detail (for lack of a better term). I too use chef, but that has nothing to do with this.
earlier when I said I don't keep gitlab in a repository I meant I don't keep it in a centralized repository. apologies for that.
I really fail to see how this is any more "restrictive" (or restrictive at all) than yours. should this pull request get merged there would be nothing stopping you from doing your team's regular changes. just like any project that comes with an example deploy script.
By Administrator on 2013-01-31T22:08:46 (imported from GitLab project)
By Administrator on 2013-01-31T22:08:46 (imported from GitLab)
- config/deploy.rb.example 0 → 100644
35 run "#{sudo} service #{application} start" 36 end 37 38 desc 'Stop the application services' 39 task :stop, roles: :app do 40 run "#{sudo} service #{application} stop" 41 end 42 43 desc 'Restart the application services' 44 task :restart, roles: :app do 45 run "#{sudo} service #{application} restart" 46 end 47 end 48 49 namespace :deploy do 50 desc 'Start the application services' Created by: zzet
ok
https://github.com/mikew/gitlabhq/blob/9852ce887df753f34b66814ab38aced9b511fcb4/config/deploy.rb.example#L3 https://github.com/mikew/gitlabhq/blob/9852ce887df753f34b66814ab38aced9b511fcb4/config/deploy.rb.example#L17
set :branch, 'master' # for git scm set :keep_releases, 5 # realy good %)
By Administrator on 2013-01-31T22:08:46 (imported from GitLab project)
By Administrator on 2013-01-31T22:08:46 (imported from GitLab)
Created by: dzaporozhets
@zzet can you please make a PR with your version of capistrano deploy? So we can choose a better one. I'd like to have one in core.
By Administrator on 2013-01-27T16:58:13 (imported from GitLab project)
By Administrator on 2013-01-27T16:58:13 (imported from GitLab)
- config/deploy.rb.example 0 → 100644
11 set :use_sudo, false 12 default_run_options[:pty] = true 13 14 # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` 15 set :scm, :git 16 set :repository, "git@#{domain}:#{application}.git" 17 set :deploy_via, :remote_cache 18 19 # Alternatively, you can deploy via copy, if you don't have gitlab in git 20 #set :scm, :none 21 #set :repository, '.' 22 #set :deploy_via, :copy 23 24 server domain, :app, :web, :db, primary: true 25 26 namespace :foreman do