capistrano-mono-deploy 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gem "railsless-deploy" , "~> 1.0.2"
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Antony Denyer
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,61 @@
1
+ Capistrano::Mono::Deploy
2
+ ========================
3
+
4
+ Capistrano recipe for deploying mono apps.
5
+
6
+ Features
7
+ --------
8
+ - Provides `cap deploy` functionality for your mono app
9
+ - Automatically starts application using xsp4
10
+ - Provides tasks for starting (`cap mono:start`) and stopping (`cap mono:stop`) your mono app
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ gem 'capistrano-mono-deploy'
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install capistrano-mono-deploy
25
+
26
+ ## Usage
27
+
28
+ xsp4 Capfile Example
29
+ --------------------
30
+ You probably shouldn't use xsp as a production server, consider using nginx with fastcgi
31
+
32
+ ```ruby
33
+ require "capistrano/mono-deploy"
34
+
35
+ set :app, "your.server.fqdn"
36
+ set :user, "deploy"
37
+ set :deploy_to, "/var/apps/my-app-folder"
38
+
39
+ ```
40
+
41
+ Custom command Capfile Example
42
+ ------------------------------
43
+ ```ruby
44
+ require "capistrano/mono-deploy"
45
+
46
+ set :app, "your.server.fqdn"
47
+ set :user, "deploy"
48
+ set :deploy_to, "/var/apps/my-app-folder"
49
+
50
+ set :mono_app, :custom
51
+ set :custom_stop, "service myMonoApplicaton stop"
52
+ set :custom_start, "service myMonoApplicaton start"
53
+
54
+ ```
55
+ ## Contributing
56
+
57
+ 1. Fork it
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "capistrano-mono-deploy"
7
+ gem.version = "0.0.1"
8
+ gem.authors = ["Antony Denyer"]
9
+ gem.email = ["antonydenyer@gmail.com"]
10
+ gem.description = %q{some capistrano recipes for deploying mono apps on to linux servers, currently only supports xsp}
11
+ gem.summary = %q{Deploy mono applications with capistrano}
12
+ gem.homepage = "https://github.com/antonydenyer/capistrano-mono-deploy"
13
+
14
+ gem.files = `git ls-files`.split("\n")
15
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
+ gem.require_paths = ["lib"]
18
+ end
@@ -0,0 +1,38 @@
1
+ require 'capistrano/configuration/actions/invocation'
2
+ require 'capistrano/configuration/variables'
3
+
4
+ module Capistrano
5
+ module Deploy
6
+ module MONO
7
+ class Custom
8
+
9
+ def stop_command
10
+ if @configuration.variables.has_key?(:custom_stop)
11
+ return @configuration.variables[:custom_stop]
12
+ end
13
+ raise Capistrano::Error, "could not find variable custom_stop defined"
14
+ end
15
+
16
+ def start_command
17
+ if @configuration.variables.has_key?(:custom_start)
18
+ return @configuration.variables[:custom_start]
19
+ end
20
+ raise Capistrano::Error, "could not find variable custom_start defined"
21
+ end
22
+
23
+ def initialize(configuration={})
24
+ @configuration = configuration
25
+ end
26
+ def start()
27
+ puts "starting application using custom command"
28
+ @configuration.run("#{stop_command}")
29
+ end
30
+
31
+ def stop()
32
+ puts "stopping application using custom command"
33
+ @configuration.run("#{start_command}")
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,19 @@
1
+ module Capistrano
2
+ module Deploy
3
+ module MONO
4
+ def self.new(mono, config={})
5
+ mono_file = "capistrano/mono/#{mono}.rb"
6
+ require(mono_file)
7
+
8
+ mono_const = mono.to_s.capitalize.gsub(/_(.)/) { $1.upcase }
9
+ if const_defined?(mono_const)
10
+ const_get(mono_const).new(config)
11
+ else
12
+ raise Capistrano::Error, "could not find '#{name}::#{mono_const}' in '#{mono_file}'"
13
+ end
14
+ rescue LoadError
15
+ raise Capistrano::Error, "could not find any MONO deploy strategy named `#{mono}'"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,46 @@
1
+ require 'capistrano/configuration/actions/invocation'
2
+ require 'capistrano/configuration/variables'
3
+
4
+ module Capistrano
5
+ module Deploy
6
+ module MONO
7
+ class Xsp
8
+
9
+ def port
10
+ @configuration.variables[:xsp_port] || 8080
11
+ end
12
+
13
+ def command
14
+ @configuration.variables[:xsp_command] || "xsp4 --nonstop"
15
+ end
16
+
17
+ def initialize(configuration={})
18
+ @configuration = configuration
19
+ end
20
+ def start()
21
+ puts "starting application using xsp >>> NOT FOR PRODUCTION USE <<< "
22
+ # had a lot of problems getting this to work and returning back to capistrano,
23
+ # the only solution I found was to pipe everything to /dev/null
24
+ # the downside is that you don't get any errors back from xsp
25
+ @configuration.run("#{command} --port #{port} --root #{@configuration.latest_release} > /dev/null 2>&1 &")
26
+ # fails even with --retry ?!?
27
+ attempt_number = 0
28
+ begin
29
+ attempt_number = attempt_number + 1
30
+ @configuration.run("curl localhost:#{port} --silent --location --output /dev/null")
31
+ rescue
32
+ sleep 1
33
+ retry if attempt_number < 10
34
+ raise CommandError.new("Failed to bring up the site")
35
+ end
36
+ puts "The site is up"
37
+ end
38
+
39
+ def stop()
40
+ puts "killing mono process >>> NOT FOR PRODUCTION USE <<< "
41
+ @configuration.run("pkill mono > /dev/null 2>&1 &")
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,32 @@
1
+ require "railsless-deploy"
2
+ require "capistrano/mono/server"
3
+
4
+ Capistrano::Configuration.instance(:must_exist).load do |configuration|
5
+
6
+ after "deploy:update", "mono:restart"
7
+ after "deploy:rollback", "mono:restart"
8
+
9
+ set :application, 'Capistrano-Mono-Deploy' unless defined? application
10
+ set :repository, File.dirname(Dir.glob("**/Web.config").first) unless defined? repository
11
+ set :scm, :none
12
+ set :deploy_via, :copy
13
+ set :copy_exclude, [".git/*","**/*.cs", "**/_*", "**/*proj", "**/obj"] unless defined? copy_exclude
14
+
15
+ set :mono_app, :xsp unless defined? mono
16
+
17
+ namespace :mono do
18
+ task :restart, :roles => :app do
19
+ server = Capistrano::Deploy::MONO.new(mono_app, self)
20
+ server.stop()
21
+ server.start()
22
+ end
23
+ task :start, :roles => :app do
24
+ Capistrano::Deploy::MONO.new(mono_app, self).start();
25
+ end
26
+ task :stop, :roles => :app do
27
+ Capistrano::Deploy::MONO.new(mono_app, self).stop();
28
+ end
29
+ end
30
+
31
+ end
32
+
@@ -0,0 +1 @@
1
+ # nothing here, see lib/capistrano/mono-deploy.rb
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-mono-deploy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Antony Denyer
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-13 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: some capistrano recipes for deploying mono apps on to linux servers,
15
+ currently only supports xsp
16
+ email:
17
+ - antonydenyer@gmail.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - capistrano-mono-deploy.gemspec
28
+ - lib/capistrano-mono-deploy.rb
29
+ - lib/capistrano/mono-deploy.rb
30
+ - lib/capistrano/mono/custom.rb
31
+ - lib/capistrano/mono/server.rb
32
+ - lib/capistrano/mono/xsp.rb
33
+ homepage: https://github.com/antonydenyer/capistrano-mono-deploy
34
+ licenses: []
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 1.8.23
54
+ signing_key:
55
+ specification_version: 3
56
+ summary: Deploy mono applications with capistrano
57
+ test_files: []