capistrano-mono-deploy 0.1.3 → 0.1.4
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.
- metadata +4 -16
- data/.gitignore +0 -17
- data/Gemfile +0 -2
- data/LICENSE.txt +0 -22
- data/README.md +0 -75
- data/Rakefile +0 -1
- data/capistrano-mono-deploy.gemspec +0 -18
- data/lib/capistrano-mono-deploy.rb +0 -1
- data/lib/capistrano/mono-deploy.rb +0 -32
- data/lib/capistrano/mono/custom.rb +0 -38
- data/lib/capistrano/mono/fastcgi.rb +0 -60
- data/lib/capistrano/mono/server.rb +0 -19
- data/lib/capistrano/mono/xsp.rb +0 -50
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-mono-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,28 +9,16 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-21 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: some capistrano recipes for deploying mono apps on to linux servers,
|
15
|
-
|
15
|
+
using railsless-deploy
|
16
16
|
email:
|
17
17
|
- antonydenyer@gmail.com
|
18
18
|
executables: []
|
19
19
|
extensions: []
|
20
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/fastcgi.rb
|
32
|
-
- lib/capistrano/mono/server.rb
|
33
|
-
- lib/capistrano/mono/xsp.rb
|
21
|
+
files: []
|
34
22
|
homepage: https://github.com/antonydenyer/capistrano-mono-deploy
|
35
23
|
licenses: []
|
36
24
|
post_install_message:
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
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
DELETED
@@ -1,75 +0,0 @@
|
|
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
|
-
role :app, "your.server.fqdn"
|
36
|
-
set :user, "deploy"
|
37
|
-
set :deploy_to, "/var/apps/my-app-folder"
|
38
|
-
|
39
|
-
```
|
40
|
-
|
41
|
-
fastcgi capfile example
|
42
|
-
-----------------------
|
43
|
-
This will run fastcgi-mono-server4.exe in the background, if the process dies it will not bring it back up again
|
44
|
-
|
45
|
-
```ruby
|
46
|
-
require "capistrano/mono-deploy"
|
47
|
-
|
48
|
-
role :app, "your.server.fqdn"
|
49
|
-
set :user, "deploy"
|
50
|
-
set :deploy_to, "/var/apps/my-app-folder"
|
51
|
-
set :mono_app, :fastcgi
|
52
|
-
|
53
|
-
```
|
54
|
-
|
55
|
-
Custom command capfile example
|
56
|
-
------------------------------
|
57
|
-
```ruby
|
58
|
-
require "capistrano/mono-deploy"
|
59
|
-
|
60
|
-
role :app, "your.server.fqdn"
|
61
|
-
set :user, "deploy"
|
62
|
-
set :deploy_to, "/var/apps/my-app-folder"
|
63
|
-
|
64
|
-
set :mono_app, :custom
|
65
|
-
set :custom_stop, "service myMonoApplicaton stop"
|
66
|
-
set :custom_start, "service myMonoApplicaton start"
|
67
|
-
|
68
|
-
```
|
69
|
-
## Contributing
|
70
|
-
|
71
|
-
1. Fork it
|
72
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
73
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
74
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
75
|
-
5. Create new Pull Request
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
@@ -1,18 +0,0 @@
|
|
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.1.3"
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
# nothing here, see lib/capistrano/mono-deploy.rb
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require "railsless-deploy"
|
2
|
-
require "capistrano/mono/server"
|
3
|
-
|
4
|
-
Capistrano::Configuration.instance(:must_exist).load do |configuration|
|
5
|
-
|
6
|
-
after "deploy:update", "deploy:restart"
|
7
|
-
after "deploy:rollback", "deploy: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 :deploy 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
|
-
|
@@ -1,38 +0,0 @@
|
|
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("#{start_command}")
|
29
|
-
end
|
30
|
-
|
31
|
-
def stop()
|
32
|
-
puts "> stopping application using custom command"
|
33
|
-
@configuration.run("#{stop_command}")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'capistrano/configuration/actions/invocation'
|
2
|
-
require 'capistrano/configuration/variables'
|
3
|
-
|
4
|
-
module Capistrano
|
5
|
-
module Deploy
|
6
|
-
module MONO
|
7
|
-
class Fastcgi
|
8
|
-
|
9
|
-
def socket
|
10
|
-
socketName = @configuration.variables[:application] || "fastcgi-mono-server4"
|
11
|
-
socketName = socketName.gsub(/\s+/, "")
|
12
|
-
"/tmp/SOCK-#{socketName}"
|
13
|
-
end
|
14
|
-
|
15
|
-
def latest_release
|
16
|
-
@configuration.variables[:latest_release]
|
17
|
-
end
|
18
|
-
|
19
|
-
def initialize(configuration={})
|
20
|
-
@configuration = configuration
|
21
|
-
end
|
22
|
-
def start()
|
23
|
-
puts "starting application using fastcgi on socket #{socket}"
|
24
|
-
|
25
|
-
appDir = @configuration.capture("readlink -f #{latest_release}").strip
|
26
|
-
|
27
|
-
@configuration.run("fastcgi-mono-server4 /applications=/:#{appDir} /filename=#{socket} /socket=unix > /dev/null 2>&1 &")
|
28
|
-
|
29
|
-
|
30
|
-
attempt_number = 0
|
31
|
-
begin
|
32
|
-
attempt_number = attempt_number + 1
|
33
|
-
status = @configuration.capture("curl --write-out %{http_code} localhost --silent --location --output /dev/null ").strip.to_i
|
34
|
-
if(status >= 400)
|
35
|
-
puts "localhost responded with #{status}"
|
36
|
-
raise
|
37
|
-
end
|
38
|
-
rescue
|
39
|
-
#HACK: you should just add www-data to the user
|
40
|
-
@configuration.run("chmod 777 #{socket}")
|
41
|
-
sleep 1
|
42
|
-
retry if attempt_number < 5
|
43
|
-
puts 'You need to configure your web server for fastcgi'
|
44
|
-
puts 'For example in nginx it you need to add the following params:'
|
45
|
-
puts ''
|
46
|
-
puts 'fastcgi_pass unix:/tmp/SOCK-$http_host;'
|
47
|
-
puts ''
|
48
|
-
puts 'check out http://www.mono-project.com/FastCGI_Nginx for more details'
|
49
|
-
raise CommandError.new("Failed to bring up the site")
|
50
|
-
end
|
51
|
-
puts "The site is up"
|
52
|
-
end
|
53
|
-
|
54
|
-
def stop()
|
55
|
-
@configuration.run("pkill mono || true")
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,19 +0,0 @@
|
|
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}' looking for file #{mono_file}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/lib/capistrano/mono/xsp.rb
DELETED
@@ -1,50 +0,0 @@
|
|
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
|
-
status = @configuration.capture("curl --write-out %{http_code} localhost:#{port} --silent --location --output /dev/null ").strip.to_i
|
31
|
-
if(status >= 400)
|
32
|
-
puts "localhost responded with #{status}"
|
33
|
-
raise
|
34
|
-
end
|
35
|
-
rescue
|
36
|
-
sleep 1
|
37
|
-
retry if attempt_number < 10
|
38
|
-
raise CommandError.new("Failed to bring up the site")
|
39
|
-
end
|
40
|
-
puts "The site is up"
|
41
|
-
end
|
42
|
-
|
43
|
-
def stop()
|
44
|
-
puts "killing mono process >>> NOT FOR PRODUCTION USE <<< "
|
45
|
-
@configuration.run("pkill mono > /dev/null 2>&1 &")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|