server 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5ed2fa8117e796e3be6f47eca1f88f775c8fbe6e
4
+ data.tar.gz: 460760e5d05572c82cd3d42153ec3575c48c3c9b
5
+ SHA512:
6
+ metadata.gz: e69ea915cf0250d49d11f8357fdf3d3b7638c9def9f0f7721964b7a4e0bcb788be8271207a4aaa3b8bad7bfd2c851f4f1f3ccb2a9f7aa7864455d7ca663ae671
7
+ data.tar.gz: 238d5b43606683fa6db11b99981c98c7c407e2fa79620afd225ac3991ad7ee7a56e5a1289f0b1787c43ebf0a5fbd38c8f9d9c496f7a772b4e7a46b6b06137136
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Pierce Moore
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ server-gem
2
+ ==========
3
+
4
+ Manage servers in a really awesome way. Like a boss.
data/bin/server ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ Signal.trap("INT") { exit 1 }
4
+
5
+ require 'server'
6
+
7
+ # Server.start(ARGV)
@@ -0,0 +1,15 @@
1
+ class Conf
2
+
3
+ def self.nginx_path
4
+ `which nginx`
5
+ end
6
+
7
+ def self.phpfpm_path
8
+ `which php-fpm`
9
+ end
10
+
11
+ def self.explain
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,19 @@
1
+ class Installed
2
+
3
+ def self.yum?
4
+ `which yum` != ""
5
+ end
6
+
7
+ def self.brew?
8
+ `which brew` != ""
9
+ end
10
+
11
+ def self.nginx?
12
+ `which nginx` != ""
13
+ end
14
+
15
+ def self.phpfpm?
16
+ `which php-fpm` != ""
17
+ end
18
+
19
+ end
@@ -0,0 +1,11 @@
1
+ class Sys
2
+
3
+ def self.yum_available?
4
+ `which yum` != ""
5
+ end
6
+
7
+ def self.brew_available?
8
+ `which brew` != ""
9
+ end
10
+
11
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'highline/import'
4
+
5
+ module Packages
6
+
7
+ class Nginx
8
+
9
+ def self.install!
10
+ puts "Installing Nginx"
11
+ end
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'highline/import'
4
+
5
+ module Packages
6
+
7
+ class PHPFPM
8
+
9
+ def self.install!
10
+ puts "Installing PHP-FPM"
11
+ end
12
+
13
+ end
14
+
15
+ end
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,227 @@
1
+ ; Start a new pool named 'www'.
2
+ [www]
3
+
4
+ ; The address on which to accept FastCGI requests.
5
+ ; Valid syntaxes are:
6
+ ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
7
+ ; a specific port;
8
+ ; 'port' - to listen on a TCP socket to all addresses on a
9
+ ; specific port;
10
+ ; '/path/to/unix/socket' - to listen on a unix socket.
11
+ ; Note: This value is mandatory.
12
+ listen = 127.0.0.1:9000
13
+
14
+ ; Set listen(2) backlog. A value of '-1' means unlimited.
15
+ ; Default Value: -1
16
+ ;listen.backlog = -1
17
+
18
+ ; List of ipv4 addresses of FastCGI clients which are allowed to connect.
19
+ ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
20
+ ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
21
+ ; must be separated by a comma. If this value is left blank, connections will be
22
+ ; accepted from any ip address.
23
+ ; Default Value: any
24
+ listen.allowed_clients = 127.0.0.1
25
+
26
+ ; Set permissions for unix socket, if one is used. In Linux, read/write
27
+ ; permissions must be set in order to allow connections from a web server. Many
28
+ ; BSD-derived systems allow connections regardless of permissions.
29
+ ; Default Values: user and group are set as the running user
30
+ ; mode is set to 0666
31
+ ;listen.owner = nobody
32
+ ;listen.group = nobody
33
+ ;listen.mode = 0666
34
+
35
+ ; Unix user/group of processes
36
+ ; Note: The user is mandatory. If the group is not set, the default user's group
37
+ ; will be used.
38
+ ; RPM: apache Choosed to be able to access some dir as httpd
39
+ user = apache
40
+ ; RPM: Keep a group allowed to write in log dir.
41
+ group = apache
42
+
43
+ ; Choose how the process manager will control the number of child processes.
44
+ ; Possible Values:
45
+ ; static - a fixed number (pm.max_children) of child processes;
46
+ ; dynamic - the number of child processes are set dynamically based on the
47
+ ; following directives:
48
+ ; pm.max_children - the maximum number of children that can
49
+ ; be alive at the same time.
50
+ ; pm.start_servers - the number of children created on startup.
51
+ ; pm.min_spare_servers - the minimum number of children in 'idle'
52
+ ; state (waiting to process). If the number
53
+ ; of 'idle' processes is less than this
54
+ ; number then some children will be created.
55
+ ; pm.max_spare_servers - the maximum number of children in 'idle'
56
+ ; state (waiting to process). If the number
57
+ ; of 'idle' processes is greater than this
58
+ ; number then some children will be killed.
59
+ ; Note: This value is mandatory.
60
+ pm = dynamic
61
+
62
+ ; The number of child processes to be created when pm is set to 'static' and the
63
+ ; maximum number of child processes to be created when pm is set to 'dynamic'.
64
+ ; This value sets the limit on the number of simultaneous requests that will be
65
+ ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
66
+ ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
67
+ ; CGI.
68
+ ; Note: Used when pm is set to either 'static' or 'dynamic'
69
+ ; Note: This value is mandatory.
70
+ pm.max_children = 50
71
+
72
+ ; The number of child processes created on startup.
73
+ ; Note: Used only when pm is set to 'dynamic'
74
+ ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
75
+ pm.start_servers = 5
76
+
77
+ ; The desired minimum number of idle server processes.
78
+ ; Note: Used only when pm is set to 'dynamic'
79
+ ; Note: Mandatory when pm is set to 'dynamic'
80
+ pm.min_spare_servers = 5
81
+
82
+ ; The desired maximum number of idle server processes.
83
+ ; Note: Used only when pm is set to 'dynamic'
84
+ ; Note: Mandatory when pm is set to 'dynamic'
85
+ pm.max_spare_servers = 35
86
+
87
+ ; The number of requests each child process should execute before respawning.
88
+ ; This can be useful to work around memory leaks in 3rd party libraries. For
89
+ ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
90
+ ; Default Value: 0
91
+ ;pm.max_requests = 500
92
+
93
+ ; The URI to view the FPM status page. If this value is not set, no URI will be
94
+ ; recognized as a status page. By default, the status page shows the following
95
+ ; information:
96
+ ; accepted conn - the number of request accepted by the pool;
97
+ ; pool - the name of the pool;
98
+ ; process manager - static or dynamic;
99
+ ; idle processes - the number of idle processes;
100
+ ; active processes - the number of active processes;
101
+ ; total processes - the number of idle + active processes.
102
+ ; The values of 'idle processes', 'active processes' and 'total processes' are
103
+ ; updated each second. The value of 'accepted conn' is updated in real time.
104
+ ; Example output:
105
+ ; accepted conn: 12073
106
+ ; pool: www
107
+ ; process manager: static
108
+ ; idle processes: 35
109
+ ; active processes: 65
110
+ ; total processes: 100
111
+ ; By default the status page output is formatted as text/plain. Passing either
112
+ ; 'html' or 'json' as a query string will return the corresponding output
113
+ ; syntax. Example:
114
+ ; http://www.foo.bar/status
115
+ ; http://www.foo.bar/status?json
116
+ ; http://www.foo.bar/status?html
117
+ ; Note: The value must start with a leading slash (/). The value can be
118
+ ; anything, but it may not be a good idea to use the .php extension or it
119
+ ; may conflict with a real PHP file.
120
+ ; Default Value: not set
121
+ pm.status_path = /fpm-status
122
+
123
+ ; The ping URI to call the monitoring page of FPM. If this value is not set, no
124
+ ; URI will be recognized as a ping page. This could be used to test from outside
125
+ ; that FPM is alive and responding, or to
126
+ ; - create a graph of FPM availability (rrd or such);
127
+ ; - remove a server from a group if it is not responding (load balancing);
128
+ ; - trigger alerts for the operating team (24/7).
129
+ ; Note: The value must start with a leading slash (/). The value can be
130
+ ; anything, but it may not be a good idea to use the .php extension or it
131
+ ; may conflict with a real PHP file.
132
+ ; Default Value: not set
133
+ ping.path = /fpm-ping
134
+
135
+ ; This directive may be used to customize the response of a ping request. The
136
+ ; response is formatted as text/plain with a 200 response code.
137
+ ; Default Value: pong
138
+ ;ping.response = pong
139
+
140
+ ; The timeout for serving a single request after which the worker process will
141
+ ; be killed. This option should be used when the 'max_execution_time' ini option
142
+ ; does not stop script execution for some reason. A value of '0' means 'off'.
143
+ ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
144
+ ; Default Value: 0
145
+ ;request_terminate_timeout = 0
146
+
147
+ ; The timeout for serving a single request after which a PHP backtrace will be
148
+ ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
149
+ ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
150
+ ; Default Value: 0
151
+ ;request_slowlog_timeout = 0
152
+
153
+ ; The log file for slow requests
154
+ ; Default Value: not set
155
+ ; Note: slowlog is mandatory if request_slowlog_timeout is set
156
+ slowlog = /var/log/php-fpm/www-slow.log
157
+
158
+ ; Set open file descriptor rlimit.
159
+ ; Default Value: system defined value
160
+ ;rlimit_files = 1024
161
+
162
+ ; Set max core size rlimit.
163
+ ; Possible Values: 'unlimited' or an integer greater or equal to 0
164
+ ; Default Value: system defined value
165
+ ;rlimit_core = 0
166
+
167
+ ; Chroot to this directory at the start. This value must be defined as an
168
+ ; absolute path. When this value is not set, chroot is not used.
169
+ ; Note: chrooting is a great security feature and should be used whenever
170
+ ; possible. However, all PHP paths will be relative to the chroot
171
+ ; (error_log, sessions.save_path, ...).
172
+ ; Default Value: not set
173
+ ;chroot =
174
+
175
+ ; Chdir to this directory at the start. This value must be an absolute path.
176
+ ; Default Value: current directory or / when chroot
177
+ ;chdir = /var/www
178
+
179
+ ; Redirect worker stdout and stderr into main error log. If not set, stdout and
180
+ ; stderr will be redirected to /dev/null according to FastCGI specs.
181
+ ; Default Value: no
182
+ ;catch_workers_output = yes
183
+
184
+ ; Limits the extensions of the main script FPM will allow to parse. This can
185
+ ; prevent configuration mistakes on the web server side. You should only limit
186
+ ; FPM to .php extensions to prevent malicious users to use other extensions to
187
+ ; exectute php code.
188
+ ; Note: set an empty value to allow all extensions.
189
+ ; Default Value: .php
190
+ ; security.limit_extensions = .php .php3 .php4 .php5
191
+
192
+ ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
193
+ ; the current environment.
194
+ ; Default Value: clean env
195
+ env[HOSTNAME] = $HOSTNAME
196
+ env[PATH] = /usr/local/bin:/usr/bin:/bin
197
+ env[TMP] = /tmp
198
+ env[TMPDIR] = /tmp
199
+ env[TEMP] = /tmp
200
+ env[SERVER_ENVIRONMENT] = {{SERVER_ENVIRONMENT}}
201
+ env[SERVER_NICKNAME] = {{SERVER_NICKNAME}}
202
+
203
+ ; Additional php.ini defines, specific to this pool of workers. These settings
204
+ ; overwrite the values previously defined in the php.ini. The directives are the
205
+ ; same as the PHP SAPI:
206
+ ; php_value/php_flag - you can set classic ini defines which can
207
+ ; be overwritten from PHP call 'ini_set'.
208
+ ; php_admin_value/php_admin_flag - these directives won't be overwritten by
209
+ ; PHP call 'ini_set'
210
+ ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
211
+
212
+ ; Defining 'extension' will load the corresponding shared extension from
213
+ ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
214
+ ; overwrite previously defined php.ini values, but will append the new value
215
+ ; instead.
216
+
217
+ ; Default Value: nothing is defined by default except the values in php.ini and
218
+ ; specified at startup with the -d argument
219
+ ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
220
+ ;php_flag[display_errors] = off
221
+ php_admin_value[error_log] = /var/log/php-fpm/5.5/www-error.log
222
+ php_admin_flag[log_errors] = on
223
+ php_admin_value[memory_limit] = 256M
224
+
225
+ ; Set session path to a directory owned by process user
226
+ php_value[session.save_handler] = files
227
+ php_value[session.save_path] = /var/lib/php/5.5/session
File without changes
data/lib/server.rb ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'thor'
4
+ require 'highline/import'
5
+ require_relative 'classes/installed'
6
+ require_relative 'classes/conf'
7
+ require_relative 'classes/sys'
8
+ require_relative 'workflows/web'
9
+ require_relative 'workflows/db'
10
+
11
+ class Server < Thor
12
+ include Workflows
13
+
14
+ desc "build", "Build a general server type"
15
+ def build
16
+ choose do |menu|
17
+
18
+ menu.prompt = "What type of server is this going to be?"
19
+
20
+ menu.choice(:web) { Workflows::Web.start! }
21
+ menu.choice(:db) { Workflows::Db.start! }
22
+
23
+ end
24
+ end
25
+
26
+ desc "install", "Installs and configures packages"
27
+ def install
28
+ puts "Installing"
29
+ end
30
+
31
+ desc "configure", "Change the configuration of an existing package"
32
+ def configure
33
+ puts "Configuring"
34
+ end
35
+
36
+ desc "server", "Change general server/machine settings"
37
+ def server
38
+ puts "Server settings"
39
+ end
40
+
41
+ desc "ssh", "Manage authorized SSH keys"
42
+ def ssh
43
+ puts "SSH keys"
44
+ end
45
+
46
+ desc "stats", "View statistics for this machine"
47
+ def stats
48
+ puts "Machine stats"
49
+ end
50
+
51
+ desc "info", "Displays information about this machine"
52
+ def info
53
+ puts "Nginx path: #{Conf::nginx_path}"
54
+ puts "PHP-FPM path: #{Conf::phpfpm_path}"
55
+ puts "Yum package manager available" if Installed::yum?
56
+ puts "Brew package manager available" if Installed::brew?
57
+ puts "PHP-FPM installed" if Installed::phpfpm?
58
+ puts "Nginx installed" if Installed::nginx?
59
+ end
60
+
61
+ end
62
+
63
+ Server.start(ARGV)
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'highline/import'
4
+
5
+ module Workflows
6
+
7
+ class Db
8
+
9
+ def self.start!
10
+ puts "Starting DB workflow"
11
+
12
+ end
13
+
14
+ end
15
+
16
+ end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'highline/import'
4
+
5
+ module Workflows
6
+
7
+ class Web
8
+
9
+ def self.start!
10
+ puts "Starting web workflow"
11
+
12
+ server_nickname = ask("What is the name of this server? ")
13
+ puts "Server nickname: #{server_nickname}"
14
+ end
15
+
16
+ end
17
+
18
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: server
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Pierce Moore
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-22 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: me@prex.io
15
+ executables:
16
+ - server
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - LICENSE
21
+ - README.md
22
+ - bin/server
23
+ - lib/classes/conf.rb
24
+ - lib/classes/installed.rb
25
+ - lib/classes/sys.rb
26
+ - lib/packages/nginx.rb
27
+ - lib/packages/phpfpm.rb
28
+ - lib/packages/templates/haproxy.cfg.template
29
+ - lib/packages/templates/memcached.conf.template
30
+ - lib/packages/templates/nginx.conf.template
31
+ - lib/packages/templates/php.ini.template
32
+ - lib/packages/templates/phpfpm.conf.template
33
+ - lib/packages/templates/redis.conf.template
34
+ - lib/server.rb
35
+ - lib/workflows/db.rb
36
+ - lib/workflows/web.rb
37
+ homepage: http://rubygems.org/gems/server
38
+ licenses:
39
+ - MIT
40
+ metadata: {}
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubyforge_project:
57
+ rubygems_version: 2.2.2
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: Manage servers in a really awesome way. Like a boss.
61
+ test_files: []