pimon 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.
data/README.md CHANGED
@@ -20,11 +20,10 @@ Optionally you may install it as a gem and run it, please check "Installing as a
20
20
  ## Configuration
21
21
  Configuration is done through a YAML file, you may check some examples on the config directory.
22
22
 
23
- 1. basic_auth - enable or disable, configure username and password
24
- 2. redis - location of the redis socket
25
- 3. chart - colors for each chart
26
- 4. queues - redis list names for the series in the charts
27
- 5. stats_collector - configure number of stats and time period between them
23
+ 1. redis - location of the redis socket
24
+ 2. chart - colors for each chart
25
+ 3. queues - redis list names for the series in the charts
26
+ 4. stats_collector - configure number of stats and time period between them
28
27
 
29
28
  ## Installing as a gem
30
29
  ```
@@ -38,6 +37,7 @@ Options:
38
37
  -c, --config CONFIG YAML configuration file for pimon
39
38
  -d, --daemonize Run Pimon daemonized in the background
40
39
  -e, --environment ENVIRONMENT Application environment (default: "development", options: "development", "production")
40
+ -i, --interface INTERFACE Hostname or IP address of the interface to listen on (default: "localhost")
41
41
  -p, --port PORT Port to use (default: 3000)
42
42
  -P, --pid PIDFILE File to store PID (default: /tmp/pimon.pid)
43
43
  ```
@@ -83,9 +83,8 @@ this feature will probably be discontinued in the future.
83
83
 
84
84
  ## TODO
85
85
  1. Improve disk stats, have a way of having custom mount points
86
- 2. Capistrano task to reset production basic_auth username and password
87
- 3. Show uptime
88
- 4. Change configuration in realtime
86
+ 2. Show uptime
87
+ 3. Change configuration in realtime
89
88
 
90
89
  ## Copyright
91
90
  Licensed under the [WTFPL](http://en.wikipedia.org/wiki/WTFPL "Do What The Fuck You Want To Public License") license.
data/bin/pimon CHANGED
@@ -26,6 +26,12 @@ Options:
26
26
  options[:environment] = environment
27
27
  end
28
28
 
29
+ opts.on('-i INTERFACE',
30
+ '--interface INTERFACE',
31
+ 'Hostname or IP address of the interface to listen on (default: "localhost")') do |interface|
32
+ options[:interface] = interface
33
+ end
34
+
29
35
  opts.on('-p PORT',
30
36
  '--port PORT',
31
37
  'Port to use (default: 3000)') do |port|
@@ -53,10 +59,11 @@ begin
53
59
  when 'start'
54
60
  require 'thin'
55
61
  port = options[:port] || 3000
62
+ interface = options[:interface] || 'localhost'
56
63
  options[:environment] ? ENV['RACK_ENV'] = options[:environment] : ENV['RACK_ENV'] = 'development'
57
64
  config = "#{File.dirname(__FILE__)}/../config/config.ru"
58
65
  ENV['PIMON_CONFIG'] = options[:pimon_config] if options[:pimon_config]
59
- puts "Pimon is starting at http://localhost:#{port}"
66
+ puts "Pimon is starting at http://#{interface}:#{port}"
60
67
  puts "Running in #{ENV['RACK_ENV']} mode."
61
68
 
62
69
  if ENV['PIMON_CONFIG']
@@ -65,7 +72,7 @@ begin
65
72
  puts "Using default configuration"
66
73
  end
67
74
 
68
- server = Rack::Server.new(:config => config, :daemonize => options[:daemonize], :pid => pid_file, :Port => port, :server => 'thin')
75
+ server = Rack::Server.new(:config => config, :daemonize => options[:daemonize], :pid => pid_file, :Port => port, :server => 'thin', :Host => interface)
69
76
  server.start
70
77
  when 'stop'
71
78
  if File.file?(pid_file)
data/config/default.yml CHANGED
@@ -1,5 +1,3 @@
1
- basic_auth:
2
- enabled: false
3
1
  redis:
4
2
  socket: /tmp/redis.sock
5
3
  chart:
data/config/deploy.rb CHANGED
@@ -19,7 +19,7 @@ after 'deploy:update_code', 'deploy:bundle_install'
19
19
 
20
20
  namespace :deploy do
21
21
  task :start, :roles => [:web, :app] do
22
- run "cd #{deploy_to}/current && && PIMON_CONFIG=#{deploy_to}/current/config/production.yml nohup thin -C config/thin/config.yml -R config/config.ru start"
22
+ run "cd #{deploy_to}/current && PIMON_CONFIG=#{deploy_to}/shared/production.yml nohup thin -C config/thin/config.yml -R config/config.ru start"
23
23
  end
24
24
 
25
25
  task :stop, :roles => [:web, :app] do
@@ -28,36 +28,14 @@ namespace :deploy do
28
28
 
29
29
  task :restart, :roles => [:web, :app] do
30
30
  deploy.stop
31
- deploy.check_basic_auth
32
31
  deploy.start
33
32
  end
34
33
 
35
34
  task :cold do
36
35
  deploy.update
37
- deploy.check_basic_auth
38
36
  deploy.start
39
37
  end
40
38
 
41
- desc "After deploying check if there's need for a new username/password for the basic_auth"
42
- task :check_basic_auth, :roles => :app do
43
- require "yaml"
44
- set :username, proc { Capistrano::CLI.ui.ask("username : ") }
45
- set :password, proc { Capistrano::CLI.password_prompt("password : ") }
46
- set :shared_config, "#{deploy_to}/shared/production.yml"
47
-
48
- if 'true' == capture("if [ -e #{shared_config} ]; then echo 'true'; fi").strip
49
- run "cp #{shared_config} #{deploy_to}/current/config/production.yml"
50
- else
51
- production_config = YAML::load_file('config/production.yml')
52
- production_config['basic_auth']['username'] = username
53
- production_config['basic_auth']['password'] = password
54
-
55
- put YAML::dump(production_config), shared_config, :mode => 0664
56
- run "cp #{shared_config} #{deploy_to}/current/config/production.yml"
57
- puts "DONE"
58
- end
59
- end
60
-
61
39
  desc "run 'bundle install' to install Bundler's packaged gems for the current deploy"
62
40
  task :bundle_install, :roles => :app do
63
41
  run "cd #{deploy_to}/current && bundle install --without test development"
data/lib/pimon.rb CHANGED
@@ -16,15 +16,7 @@ class Pimon < Sinatra::Base
16
16
  set :public_folder, "#{File.dirname(__FILE__)}/pimon/public"
17
17
  set :views, "#{File.dirname(__FILE__)}/pimon/views"
18
18
  set :sockets, []
19
-
20
- def self.configure_basic_auth
21
- if settings.config.is_basic_auth_enabled?
22
- use Rack::Auth::Basic, "Restricted Area" do |username, password|
23
- [username, password] == config.basic_auth
24
- end
25
- end
26
- end
27
-
19
+
28
20
  configure :development, :production do
29
21
  require 'redis'
30
22
  filename = "#{File.dirname(__FILE__)}/../config/default.yml"
@@ -43,7 +35,6 @@ class Pimon < Sinatra::Base
43
35
  set :stats_checker, StatsCollector.new(config, Redis.new(:path => config.redis[:socket]))
44
36
  set :timer, nil
45
37
 
46
- self.configure_basic_auth
47
38
  end
48
39
 
49
40
  configure :test do
@@ -55,7 +46,6 @@ class Pimon < Sinatra::Base
55
46
  set :stats_checker, StatsCollector.new(config, MockRedis.new)
56
47
  set :timer, nil
57
48
 
58
- self.configure_basic_auth
59
49
  end
60
50
 
61
51
  get '/' do
data/lib/pimon/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pimon
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
data/spec/pimon_spec.rb CHANGED
@@ -15,21 +15,9 @@ RSpec.configure do |config|
15
15
  end
16
16
 
17
17
  describe "Pimon" do
18
- context "when not authenticated" do
18
+ it "should be success" do
19
19
 
20
- it "should be not authorized" do
21
- get '/'
22
- expect(last_response.status).to eq(401)
23
- end
24
- end
25
-
26
- context "when authenticated" do
27
- before { authorize 'pimon', 'pimon' }
28
-
29
- it "should be success" do
30
-
31
- get '/'
32
- expect(last_response).to be_ok
33
- end
20
+ get '/'
21
+ expect(last_response).to be_ok
34
22
  end
35
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pimon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-11 00:00:00.000000000 Z
12
+ date: 2012-10-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml
@@ -216,7 +216,6 @@ files:
216
216
  - config/config_dev.ru
217
217
  - config/default.yml
218
218
  - config/deploy.rb
219
- - config/production.yml
220
219
  - config/test.yml
221
220
  - config/test_broken.yml
222
221
  - config/thin/config.yml
@@ -1,27 +0,0 @@
1
- basic_auth:
2
- enabled: true
3
- username: changed_on_deploy
4
- password: changed_on_deploy
5
- redis:
6
- socket: /tmp/redis.sock
7
- chart:
8
- cpu:
9
- color: '#D2691E'
10
- disk:
11
- color: '#CDC673'
12
- mem:
13
- color: '#87CEFA'
14
- temp:
15
- color: '#FF9B04'
16
- swap:
17
- color: '#3CB371'
18
- queues:
19
- time: pimon_time
20
- cpu: pimon_cpu
21
- disk: pimon_disk
22
- mem: pimon_mem
23
- swap: pimon_swap
24
- temp: pimon_temp
25
- stats_collector:
26
- number_of_stats: 12
27
- time_period_in_min: 5