teuton-server 0.0.3 → 0.0.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.
- checksums.yaml +4 -4
- data/README.md +3 -5
- data/docs/configfile.md +13 -15
- data/docs/installation.md +2 -1
- data/lib/teuton-server.rb +15 -5
- data/lib/teuton-server/application.rb +2 -1
- data/lib/teuton-server/input_loader.rb +7 -0
- data/lib/teuton-server/service_manager.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11b1f8760a26600d169a256acc7cd0be638f09f8245487b09ee13526980ec123
|
4
|
+
data.tar.gz: 65128e28e1bb9aa035bcabd18a69c6388cfe3dec673f06a032bfdaac607e2442
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 890590971c887ad2a4b6d664cb63b5bd510d8e51eb2cf8743ec9b6d3348c7b94fb3eea9127a38de23caa861e153945c6fabe8488f7a3d62dce4a1d4638fe8da4
|
7
|
+
data.tar.gz: 2d66c0aac7b55f47ffd1d446f89d00e79edb6c67e33fb09e5f2263723f174fae41c39af87a914fa4b2046f0de4dab74036b60b125966a9854ca6c9373137185a
|
data/README.md
CHANGED
@@ -9,16 +9,14 @@ But with TeutonServer, T-NODE host listen to evaluation requests from S-NODE hos
|
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
12
|
-
*
|
12
|
+
* `gem install teuton-server`, to install TeutonServer.
|
13
13
|
|
14
14
|
> Ensure [Teuton Software](https://github.com/teuton-software/teuton) is installed too.
|
15
15
|
|
16
16
|
## Running
|
17
17
|
|
18
|
-
1. `teuton-server init`, create
|
19
|
-
1. `teuton-server
|
20
|
-
|
21
|
-
> Now we can send requests to TeutonServer from S-NODE hosts, using [Teuton Client](https://github.com/dvarrui/teuton-client).
|
18
|
+
1. `teuton-server init`, create default configuration server file.
|
19
|
+
1. `teuton-server`, runs Teuton Server.
|
22
20
|
|
23
21
|
## Documentation
|
24
22
|
|
data/docs/configfile.md
CHANGED
@@ -25,22 +25,20 @@ Let's see its content:
|
|
25
25
|
|
26
26
|
## Config file params
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
| | members | Client name |
|
35
|
-
| | ip | CLient IP |
|
36
|
-
|
37
|
-
## Param description
|
38
|
-
|
39
|
-
* **server/port**: Base port for services.
|
28
|
+
### server section
|
29
|
+
|
30
|
+
Configuration param for Teuton Server.
|
31
|
+
|
32
|
+
* **ip**: Server listening IP
|
33
|
+
* **port**: Base port for services.
|
40
34
|
* `:port: 16000`, client 1 is asigned port 16001, client 2 is assigned 16002 port, and so on.
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
|
36
|
+
### client section
|
37
|
+
|
38
|
+
Configuration param for every TeutonClient. TeutonServer will attend only the specified clients.
|
39
|
+
|
40
|
+
* **members**: Client name or names
|
41
|
+
* **ip**: Server only accepts client request from this IP.
|
44
42
|
* `:ip: :allow`, client request are allowed always.
|
45
43
|
* `:ip: :deny`, client request are denied always.
|
46
44
|
* `:ip: 192.168.1.200`, client request are only accepted from 192.168.1.200 IP.
|
data/docs/installation.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
## Installation
|
3
3
|
|
4
|
-
|
4
|
+
> **WARNING**: First, ensure [Teuton Software](https://github.com/teuton-software/teuton) is installed.
|
5
|
+
|
5
6
|
* `gem install teuton-server`, to install TeutonServer.
|
6
7
|
* `teuton-server version`, wil display TeutonServer version.
|
data/lib/teuton-server.rb
CHANGED
@@ -5,11 +5,14 @@ require_relative 'teuton-server/input_loader'
|
|
5
5
|
require_relative 'teuton-server/service_manager'
|
6
6
|
|
7
7
|
module TeutonServer
|
8
|
+
# Start TeutonServer
|
9
|
+
# @param args [Array] List of arguments
|
8
10
|
def self.start(args)
|
9
11
|
param = InputLoader.read_input_args(args)
|
10
12
|
ServiceManager.start_services(param)
|
11
13
|
end
|
12
14
|
|
15
|
+
# Show TeutonServer help
|
13
16
|
def self.show_help
|
14
17
|
puts "Usage:"
|
15
18
|
puts " teuton-server [help|version] [PATH/TO/server.yaml [IP]]"
|
@@ -24,15 +27,20 @@ module TeutonServer
|
|
24
27
|
exit 0
|
25
28
|
end
|
26
29
|
|
30
|
+
# Show TeutonServer version
|
27
31
|
def self.show_version
|
28
32
|
puts "teuton-server => " + Rainbow("version #{Application::VERSION}").cyan
|
29
33
|
exit 0
|
30
34
|
end
|
31
35
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
+
# Create default configuration file
|
37
|
+
# @param args [Array] List of arguments, where args.first = 'init'
|
38
|
+
def self.init(args)
|
39
|
+
folder = '.'
|
40
|
+
folder = args[1] if args.size > 1
|
41
|
+
src = File.join(File.dirname(__FILE__),
|
42
|
+
'teuton-server', 'files', Application::CONFIGFILE)
|
43
|
+
dest = File.join(folder, Application::CONFIGFILE)
|
36
44
|
if File.exists? dest
|
37
45
|
puts "teuton-server => " + Rainbow("File \'#{dest}\' exists!").red
|
38
46
|
exit 1
|
@@ -40,6 +48,8 @@ module TeutonServer
|
|
40
48
|
FileUtils.cp(src, dest)
|
41
49
|
puts "teuton-server => " + Rainbow("Init \'#{dest}\' done!").yellow
|
42
50
|
exit 0
|
43
|
-
# TODO:
|
51
|
+
# TODO:
|
52
|
+
# Add testunits list by default
|
53
|
+
# a = Dir.glob(File.join('projects/gnulinux-basic/**','start.rb'))
|
44
54
|
end
|
45
55
|
end
|
@@ -1,7 +1,11 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require_relative 'application'
|
3
3
|
|
4
|
+
# This module reads input configuration
|
4
5
|
module InputLoader
|
6
|
+
# Read input configuration
|
7
|
+
# @param args [Array] List of arguments
|
8
|
+
# @return [Hash]
|
5
9
|
def self.read_input_args(args)
|
6
10
|
input = (args.size.zero? ? [Application::CONFIGFILE] : args)
|
7
11
|
param = {}
|
@@ -13,6 +17,9 @@ module InputLoader
|
|
13
17
|
param
|
14
18
|
end
|
15
19
|
|
20
|
+
# Read configuration from YAML file
|
21
|
+
# @param filepath [String] Path to YAML file.
|
22
|
+
# @return [Hash]
|
16
23
|
def self.read_yaml(filepath)
|
17
24
|
filepath = File.join(filepath,
|
18
25
|
Application::CONFIGFILE) if File.directory? filepath
|
@@ -1,7 +1,15 @@
|
|
1
1
|
|
2
2
|
require_relative 'service'
|
3
3
|
|
4
|
+
# This module start a group of services. One for every client.
|
5
|
+
# Every service listen on diferent ports. For example:
|
6
|
+
# * service 1 listen on port PORT+1, client 1 requests.
|
7
|
+
# * service 2 listen on port PORT+2, client 2 requests.
|
8
|
+
# * etc.
|
4
9
|
module ServiceManager
|
10
|
+
# Start one service for every client.
|
11
|
+
# @param app_param [Hash] Application configuration params
|
12
|
+
# @return [Exit status] Exit 0 = OK. Exit 1 = ERROR
|
5
13
|
def self.start_services(app_param)
|
6
14
|
show_starting(app_param)
|
7
15
|
services_param = split_app_param_into_services_param(app_param)
|