openbel-api 0.4.0-java
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 +7 -0
- data/.gemspec +65 -0
- data/CHANGELOG.md +22 -0
- data/INSTALL.md +19 -0
- data/INSTALL_RUBY.md +107 -0
- data/LICENSE +191 -0
- data/README.md +208 -0
- data/app/openbel/api/app.rb +83 -0
- data/app/openbel/api/config.rb +45 -0
- data/app/openbel/api/config.ru +3 -0
- data/app/openbel/api/helpers/pager.rb +109 -0
- data/app/openbel/api/middleware/auth.rb +112 -0
- data/app/openbel/api/resources/adapters/basic_json.rb +52 -0
- data/app/openbel/api/resources/annotation.rb +141 -0
- data/app/openbel/api/resources/base.rb +16 -0
- data/app/openbel/api/resources/completion.rb +89 -0
- data/app/openbel/api/resources/evidence.rb +115 -0
- data/app/openbel/api/resources/evidence_transform.rb +143 -0
- data/app/openbel/api/resources/function.rb +98 -0
- data/app/openbel/api/resources/match_result.rb +79 -0
- data/app/openbel/api/resources/namespace.rb +174 -0
- data/app/openbel/api/routes/annotations.rb +168 -0
- data/app/openbel/api/routes/authenticate.rb +108 -0
- data/app/openbel/api/routes/base.rb +326 -0
- data/app/openbel/api/routes/datasets.rb +519 -0
- data/app/openbel/api/routes/evidence.rb +330 -0
- data/app/openbel/api/routes/expressions.rb +560 -0
- data/app/openbel/api/routes/functions.rb +41 -0
- data/app/openbel/api/routes/namespaces.rb +382 -0
- data/app/openbel/api/routes/root.rb +39 -0
- data/app/openbel/api/schemas.rb +34 -0
- data/app/openbel/api/schemas/annotation_collection.schema.json +20 -0
- data/app/openbel/api/schemas/annotation_resource.schema.json +36 -0
- data/app/openbel/api/schemas/annotation_value_collection.schema.json +21 -0
- data/app/openbel/api/schemas/annotation_value_resource.schema.json +35 -0
- data/app/openbel/api/schemas/completion_collection.schema.json +21 -0
- data/app/openbel/api/schemas/completion_resource.schema.json +146 -0
- data/app/openbel/api/schemas/evidence.schema.json +198 -0
- data/app/openbel/api/schemas/evidence_collection.schema.json +98 -0
- data/app/openbel/api/schemas/evidence_resource.schema.json +29 -0
- data/app/openbel/api/schemas/namespace_value_collection.schema.json +21 -0
- data/app/openbel/api/schemas/namespace_value_resource.schema.json +43 -0
- data/app/openbel/api/util.rb +11 -0
- data/bin/openbel-api +78 -0
- data/bin/openbel-config +46 -0
- data/config/async_evidence.rb +12 -0
- data/config/async_jena.rb +14 -0
- data/config/config.yml +31 -0
- data/config/server_config.rb +184 -0
- data/lib/openbel/api/cache/cache.rb +30 -0
- data/lib/openbel/api/config/config.rb +33 -0
- data/lib/openbel/api/evidence/api.rb +39 -0
- data/lib/openbel/api/evidence/facet_api.rb +18 -0
- data/lib/openbel/api/evidence/facet_filter.rb +83 -0
- data/lib/openbel/api/evidence/mongo.rb +247 -0
- data/lib/openbel/api/evidence/mongo_facet.rb +105 -0
- data/lib/openbel/api/helpers/dependency_graph.rb +52 -0
- data/lib/openbel/api/model/rdf_resource.rb +74 -0
- data/lib/openbel/api/plugin/cache/kyotocabinet.rb +85 -0
- data/lib/openbel/api/plugin/configure_plugins.rb +97 -0
- data/lib/openbel/api/plugin/evidence/evidence.rb +58 -0
- data/lib/openbel/api/plugin/plugin.rb +99 -0
- data/lib/openbel/api/plugin/plugin_manager.rb +20 -0
- data/lib/openbel/api/plugin/plugin_repository.rb +60 -0
- data/lib/openbel/api/storage/cache_proxy.rb +74 -0
- data/lib/openbel/api/storage/triple_storage.rb +43 -0
- metadata +379 -0
@@ -0,0 +1,98 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema",
|
3
|
+
"description": "DESCRIBE EVIDENCE COLLECTION",
|
4
|
+
"type": "object",
|
5
|
+
"additionalProperties": false,
|
6
|
+
"required": [
|
7
|
+
"evidence_collection",
|
8
|
+
"facets"
|
9
|
+
],
|
10
|
+
"properties": {
|
11
|
+
"evidence_collection": {
|
12
|
+
"type": "array",
|
13
|
+
"minItems": 0,
|
14
|
+
"title": "",
|
15
|
+
"description": "",
|
16
|
+
"items": {
|
17
|
+
"$ref":"evidence_resource.schema.json"
|
18
|
+
}
|
19
|
+
},
|
20
|
+
"facets": {
|
21
|
+
"type": "array",
|
22
|
+
"minItems": 0,
|
23
|
+
"title": "",
|
24
|
+
"description": "",
|
25
|
+
"items": {
|
26
|
+
"type": "object",
|
27
|
+
"additionalProperties": false,
|
28
|
+
"required": [
|
29
|
+
"category",
|
30
|
+
"name",
|
31
|
+
"value",
|
32
|
+
"filter",
|
33
|
+
"count"
|
34
|
+
],
|
35
|
+
"properties": {
|
36
|
+
"category": {
|
37
|
+
"type": "string"
|
38
|
+
},
|
39
|
+
"name": {
|
40
|
+
"type": "string"
|
41
|
+
},
|
42
|
+
"value": {
|
43
|
+
"type": "string"
|
44
|
+
},
|
45
|
+
"filter": {
|
46
|
+
"type": "string"
|
47
|
+
},
|
48
|
+
"count": {
|
49
|
+
"type": "integer"
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"metadata": {
|
55
|
+
"title": "Metadata",
|
56
|
+
"description": "Data about the evidence collection",
|
57
|
+
"type": "object",
|
58
|
+
"additionalProperties": true,
|
59
|
+
"properties": {
|
60
|
+
"collection_paging": {
|
61
|
+
"type": "object",
|
62
|
+
"properties": {
|
63
|
+
"total": {
|
64
|
+
"title": "Total",
|
65
|
+
"description": "The total number of resources in this collection.",
|
66
|
+
"type": "number",
|
67
|
+
"minimum": 0
|
68
|
+
},
|
69
|
+
"total_filtered": {
|
70
|
+
"title": "Total Filtered",
|
71
|
+
"description": "The total number of resources in the filtered collection.",
|
72
|
+
"type": "number",
|
73
|
+
"minimum": 0
|
74
|
+
},
|
75
|
+
"total_pages": {
|
76
|
+
"title": "Total Pages",
|
77
|
+
"description": "The total number of pages (i.e. sized partitions) in the filtered collection.",
|
78
|
+
"type": "number",
|
79
|
+
"minimum": 0
|
80
|
+
},
|
81
|
+
"current_page": {
|
82
|
+
"title": "Current Page",
|
83
|
+
"description": "The current page of the filtered collection that this resource represents.",
|
84
|
+
"type": "number",
|
85
|
+
"minimum": 0
|
86
|
+
},
|
87
|
+
"current_page_size": {
|
88
|
+
"title": "Current Page Size",
|
89
|
+
"description": "The number of resources in the current page of the filtered collection.",
|
90
|
+
"type": "number",
|
91
|
+
"minimum": 0
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema",
|
3
|
+
"title": "Evidence Resource",
|
4
|
+
"description": "A single evidence resource.",
|
5
|
+
"type": "object",
|
6
|
+
"additionalProperties": false,
|
7
|
+
"required": [
|
8
|
+
"evidence"
|
9
|
+
],
|
10
|
+
"properties": {
|
11
|
+
"allOf": [
|
12
|
+
{
|
13
|
+
"$ref":"evidence.schema.json"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"type": "object",
|
17
|
+
"additionalProperties": false,
|
18
|
+
"required": [
|
19
|
+
"links"
|
20
|
+
],
|
21
|
+
"properties": {
|
22
|
+
"links": {
|
23
|
+
"type": "object"
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
]
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema",
|
3
|
+
"title": "Namespace Value Collection",
|
4
|
+
"description": "A collection of namespace value resources.",
|
5
|
+
"type": "object",
|
6
|
+
"additionalProperties": false,
|
7
|
+
"required": [
|
8
|
+
"namespace_value_collection"
|
9
|
+
],
|
10
|
+
"properties": {
|
11
|
+
"namespace_value_collection": {
|
12
|
+
"type": "array",
|
13
|
+
"minItems": 0,
|
14
|
+
"title": "",
|
15
|
+
"description": "",
|
16
|
+
"items": {
|
17
|
+
"$ref":"http://next.belframework.org/schemas/namespace_value_resource.schema.json"
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema",
|
3
|
+
"title": "Namespace Value Resource",
|
4
|
+
"description": "A single namespace value within a BEL Namespace.",
|
5
|
+
"type": "object",
|
6
|
+
"additionalProperties": false,
|
7
|
+
"required": [
|
8
|
+
"namespace_value"
|
9
|
+
],
|
10
|
+
"properties": {
|
11
|
+
"namespace_value": {
|
12
|
+
"type": "object",
|
13
|
+
"additionalProperties": false,
|
14
|
+
"required": [
|
15
|
+
"type",
|
16
|
+
"identifier",
|
17
|
+
"name",
|
18
|
+
"title",
|
19
|
+
"species"
|
20
|
+
],
|
21
|
+
"properties": {
|
22
|
+
"type": {
|
23
|
+
"type": "string"
|
24
|
+
},
|
25
|
+
"identifier": {
|
26
|
+
"type": "string"
|
27
|
+
},
|
28
|
+
"name": {
|
29
|
+
"type": "string"
|
30
|
+
},
|
31
|
+
"title": {
|
32
|
+
"type": ["null", "string"]
|
33
|
+
},
|
34
|
+
"species": {
|
35
|
+
"type": ["null", "string"]
|
36
|
+
},
|
37
|
+
"match_text": {
|
38
|
+
"type": "string"
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
data/bin/openbel-api
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'puma/cli'
|
5
|
+
|
6
|
+
ORIGINAL_ARGV = ARGV.dup
|
7
|
+
OPENBEL_ARGV = ARGV.slice_before('--').to_a[0]
|
8
|
+
PUMA_ARGV = ARGV.slice_after('--').to_a[1] || []
|
9
|
+
|
10
|
+
ROOT = File.expand_path('..', File.dirname(__FILE__))
|
11
|
+
config_file = ENV['OPENBEL_API_CONFIG_FILE']
|
12
|
+
|
13
|
+
exec('puma', '--help') if ['-h', '--help'].any? {|opt| PUMA_ARGV.include?(opt) }
|
14
|
+
|
15
|
+
# Parse OpenBEL API arguments.
|
16
|
+
options = {}
|
17
|
+
parser = OptionParser.new do |opts|
|
18
|
+
opts.banner = %Q{
|
19
|
+
Runs the OpenBEL API application using the Puma HTTP server (Ruby).
|
20
|
+
|
21
|
+
Usage:
|
22
|
+
|
23
|
+
openbel-api -f [FILE] -- [Puma options]
|
24
|
+
|
25
|
+
Detail:
|
26
|
+
|
27
|
+
The command-line is divided into OpenBEL API and Puma options. These options
|
28
|
+
are divided using the "--" delimiter.
|
29
|
+
|
30
|
+
OpenBEL API
|
31
|
+
===========
|
32
|
+
|
33
|
+
The first set of options pertain to the OpenBEL API.
|
34
|
+
|
35
|
+
A configuration file must be provided for the OpenBEL API application.
|
36
|
+
This can be provided by setting the OPENBEL_API_CONFIG_FILE environment
|
37
|
+
variable or by passing the "-f" option.
|
38
|
+
|
39
|
+
Puma HTTP Server
|
40
|
+
================
|
41
|
+
|
42
|
+
The second set of options pertain to the Puma HTTP server. This includes
|
43
|
+
settings like bind interface, port, PID file, etc. To see all options for
|
44
|
+
Puma run:
|
45
|
+
|
46
|
+
openbel-api -- --help
|
47
|
+
|
48
|
+
OpenBEL API Options
|
49
|
+
===================
|
50
|
+
}
|
51
|
+
|
52
|
+
opts.on('-f', '--file FILE', 'The file where the configuration will be written.') do |file|
|
53
|
+
options[:file] = file
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
parser.default_argv = OPENBEL_ARGV
|
58
|
+
parser.parse!
|
59
|
+
|
60
|
+
if options[:file]
|
61
|
+
config_file = options[:file]
|
62
|
+
end
|
63
|
+
|
64
|
+
begin
|
65
|
+
File.open(config_file, 'r')
|
66
|
+
rescue SystemCallError => err
|
67
|
+
if err.class.name.start_with?('Errno::')
|
68
|
+
$stderr.puts %Q{The configuration file "#{File.expand_path(config_file)}" cannot be read.\nError: #{err.message}}
|
69
|
+
exit 1
|
70
|
+
else
|
71
|
+
raise err
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
ENV['OPENBEL_API_CONFIG_FILE'] = config_file
|
76
|
+
|
77
|
+
# Run Puma.
|
78
|
+
exec('puma', *PUMA_ARGV, "#{File.join(ROOT, 'app', 'openbel', 'api', 'config.ru')}")
|
data/bin/openbel-config
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
require 'optparse'
|
3
|
+
|
4
|
+
# options; any default go here
|
5
|
+
options = {}
|
6
|
+
|
7
|
+
# parse options from cli
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = %Q{
|
10
|
+
Writes an OpenBEL configuration file (YAML format).
|
11
|
+
|
12
|
+
Usage: openbel-config -f [FILE]
|
13
|
+
}.gsub(/^ +/, '')
|
14
|
+
|
15
|
+
opts.on('-f', '--file FILE', 'The file where the configuration will be written.') do |file|
|
16
|
+
options[:file] = file
|
17
|
+
end
|
18
|
+
end.parse!
|
19
|
+
|
20
|
+
# resolve path for config.yml template
|
21
|
+
CONFIG = File.join(File.expand_path('..', File.dirname(__FILE__)), 'config', 'config.yml')
|
22
|
+
|
23
|
+
# sanity check
|
24
|
+
unless File.readable?(CONFIG)
|
25
|
+
$stderr.puts %Q{The configuration template cannot be read. Path was "#{CONFIG}".}
|
26
|
+
exit 1
|
27
|
+
end
|
28
|
+
|
29
|
+
# write out the config
|
30
|
+
if options[:file]
|
31
|
+
begin
|
32
|
+
File.open(options[:file], 'w') do |f|
|
33
|
+
f.write(File.read(CONFIG))
|
34
|
+
end
|
35
|
+
rescue SystemCallError => err
|
36
|
+
if err.class.name.start_with?('Errno::')
|
37
|
+
$stderr.puts %Q{The file option "#{options[:file]}" cannot be written.\nError: #{err.message}}
|
38
|
+
exit 1
|
39
|
+
else
|
40
|
+
raise err
|
41
|
+
end
|
42
|
+
end
|
43
|
+
$stdout.puts "Wrote configuration template to path #{options[:file]}."
|
44
|
+
else
|
45
|
+
$stdout.puts(File.read(CONFIG))
|
46
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
2
|
+
# require 'evidence/mongo'
|
3
|
+
# config['evidence'] = OpenBEL::Evidence::Evidence.new(mongo)
|
4
|
+
|
5
|
+
# mongo = {
|
6
|
+
# :host => 'localhost',
|
7
|
+
# :port => 27017,
|
8
|
+
# :database => 'openbel'
|
9
|
+
# }
|
10
|
+
|
11
|
+
require 'em-mongo'
|
12
|
+
config['evidence_collection'] = EM::Mongo::Connection.new('localhost', 27017).db('openbel').collection('evidence')
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bel'
|
2
|
+
|
3
|
+
# Use Jena RdfRepository plugin from bel.rb.
|
4
|
+
config['rdf_repository'] = BEL::RdfRepository.plugins[:jena].create_repository(:tdb_directory => 'data2')
|
5
|
+
$stdout.puts "Initialized rdf/jena."
|
6
|
+
|
7
|
+
# Include RDF monkeypatch of BEL::Model classes.
|
8
|
+
BEL::Translator.plugins[:rdf].create_translator
|
9
|
+
$stdout.puts "Loaded monkey patch for BEL RDF methods."
|
10
|
+
|
11
|
+
# Bootstrap
|
12
|
+
require 'rdf'
|
13
|
+
UUID.generate
|
14
|
+
$stdout.puts "Bootstrapped RDF (uuid)."
|
data/config/config.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Configuration template for OpenBEL API
|
2
|
+
|
3
|
+
# Storage of evidence through the Mongo database.
|
4
|
+
evidence_store:
|
5
|
+
mongo:
|
6
|
+
host: 'localhost'
|
7
|
+
port: 27017
|
8
|
+
database: 'openbel'
|
9
|
+
|
10
|
+
# RDF dataset for BEL datasets, annotations, and namespaces using Apache Jena.
|
11
|
+
resource_rdf:
|
12
|
+
jena:
|
13
|
+
tdb_directory: 'biological-concepts-rdf'
|
14
|
+
|
15
|
+
# Full-text search over annotation and namespace values using SQLite.
|
16
|
+
resource_search:
|
17
|
+
sqlite:
|
18
|
+
database_file: 'biological-concepts-rdf.db'
|
19
|
+
|
20
|
+
# Set a secret used during session creation....
|
21
|
+
session_secret: 'changeme'
|
22
|
+
|
23
|
+
# User authentication using Auth0.
|
24
|
+
auth:
|
25
|
+
enabled: false
|
26
|
+
redirect: 'https://openbel.auth0.com/authorize?response_type=code&scope=openid%20profile&client_id=K4oAPUaROjbWWTCoAhf0nKYfTGsZWbHE'
|
27
|
+
default_connection: 'linkedin'
|
28
|
+
domain: 'openbel.auth0.com'
|
29
|
+
id: 'K4oAPUaROjbWWTCoAhf0nKYfTGsZWbHE'
|
30
|
+
# secret: 'auth0 client secret here'
|
31
|
+
|
@@ -0,0 +1,184 @@
|
|
1
|
+
#!/usr/bin/env puma
|
2
|
+
|
3
|
+
tag 'OBP - API'
|
4
|
+
|
5
|
+
pidfile 'openbel-api.pid'
|
6
|
+
|
7
|
+
# if ENV['SERVER_AS_DAEMON'].to_i == 1
|
8
|
+
# daemonize true
|
9
|
+
#
|
10
|
+
# require 'fileutils'
|
11
|
+
# stdout_file = ENV['OUT_SERVER_STDOUT']
|
12
|
+
# FileUtils.mkdir_p File.dirname(stdout_file)
|
13
|
+
# stderr_file = ENV['OUT_SERVER_STDERR']
|
14
|
+
# FileUtils.mkdir_p File.dirname(stderr_file)
|
15
|
+
# stdout_redirect stdout_file, stderr_file
|
16
|
+
# end
|
17
|
+
|
18
|
+
bind 'tcp://0.0.0.0:9000'
|
19
|
+
|
20
|
+
threads 1, 8
|
21
|
+
|
22
|
+
# The directory to operate out of.
|
23
|
+
#
|
24
|
+
# The default is the current directory.
|
25
|
+
#
|
26
|
+
# directory '/u/apps/lolcat'
|
27
|
+
|
28
|
+
# Use an object or block as the rack application. This allows the
|
29
|
+
# config file to be the application itself.
|
30
|
+
#
|
31
|
+
# app do |env|
|
32
|
+
# puts env
|
33
|
+
#
|
34
|
+
# body = 'Hello, World!'
|
35
|
+
#
|
36
|
+
# [200, { 'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }, [body]]
|
37
|
+
# end
|
38
|
+
|
39
|
+
# Load “path” as a rackup file.
|
40
|
+
#
|
41
|
+
# The default is “config.ru”.
|
42
|
+
#
|
43
|
+
# rackup '/u/apps/lolcat/config.ru'
|
44
|
+
|
45
|
+
# Set the environment in which the rack's app will run. The value must be a string.
|
46
|
+
#
|
47
|
+
# The default is “development”.
|
48
|
+
#
|
49
|
+
# environment 'production'
|
50
|
+
|
51
|
+
# Daemonize the server into the background. Highly suggest that
|
52
|
+
# this be combined with “pidfile” and “stdout_redirect”.
|
53
|
+
#
|
54
|
+
# The default is “false”.
|
55
|
+
#
|
56
|
+
# daemonize
|
57
|
+
# daemonize false
|
58
|
+
|
59
|
+
# Store the pid of the server in the file at “path”.
|
60
|
+
#
|
61
|
+
# pidfile '/u/apps/lolcat/tmp/pids/puma.pid'
|
62
|
+
|
63
|
+
# Use “path” as the file to store the server info state. This is
|
64
|
+
# used by “pumactl” to query and control the server.
|
65
|
+
#
|
66
|
+
# state_path '/u/apps/lolcat/tmp/pids/puma.state'
|
67
|
+
|
68
|
+
# Redirect STDOUT and STDERR to files specified. The 3rd parameter
|
69
|
+
# (“append”) specifies whether the output is appended, the default is
|
70
|
+
# “false”.
|
71
|
+
#
|
72
|
+
# stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr'
|
73
|
+
# stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr', true
|
74
|
+
|
75
|
+
# Disable request logging.
|
76
|
+
#
|
77
|
+
# The default is “false”.
|
78
|
+
#
|
79
|
+
# quiet
|
80
|
+
|
81
|
+
# Configure “min” to be the minimum number of threads to use to answer
|
82
|
+
# requests and “max” the maximum.
|
83
|
+
#
|
84
|
+
# The default is “0, 16”.
|
85
|
+
#
|
86
|
+
# threads 0, 16
|
87
|
+
|
88
|
+
# Bind the server to “url”. “tcp://”, “unix://” and “ssl://” are the only
|
89
|
+
# accepted protocols.
|
90
|
+
#
|
91
|
+
# The default is “tcp://0.0.0.0:9292”.
|
92
|
+
#
|
93
|
+
# bind 'tcp://0.0.0.0:9292'
|
94
|
+
# bind 'unix:///var/run/puma.sock'
|
95
|
+
# bind 'unix:///var/run/puma.sock?umask=0111'
|
96
|
+
# bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
|
97
|
+
|
98
|
+
# Instead of “bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'” you
|
99
|
+
# can also use the “ssl_bind” option.
|
100
|
+
#
|
101
|
+
# ssl_bind '127.0.0.1', '9292', { key: path_to_key, cert: path_to_cert }
|
102
|
+
|
103
|
+
# Code to run before doing a restart. This code should
|
104
|
+
# close log files, database connections, etc.
|
105
|
+
#
|
106
|
+
# This can be called multiple times to add code each time.
|
107
|
+
#
|
108
|
+
# on_restart do
|
109
|
+
# puts 'On restart...'
|
110
|
+
# end
|
111
|
+
|
112
|
+
# Command to use to restart puma. This should be just how to
|
113
|
+
# load puma itself (ie. 'ruby -Ilib bin/puma'), not the arguments
|
114
|
+
# to puma, as those are the same as the original process.
|
115
|
+
#
|
116
|
+
# restart_command '/u/app/lolcat/bin/restart_puma'
|
117
|
+
|
118
|
+
# === Cluster mode ===
|
119
|
+
|
120
|
+
# How many worker processes to run.
|
121
|
+
#
|
122
|
+
# The default is “0”.
|
123
|
+
#
|
124
|
+
# workers 2
|
125
|
+
|
126
|
+
# Code to run when a worker boots to setup the process before booting
|
127
|
+
# the app.
|
128
|
+
#
|
129
|
+
# This can be called multiple times to add hooks.
|
130
|
+
#
|
131
|
+
# on_worker_boot do
|
132
|
+
# puts 'On worker boot...'
|
133
|
+
# end
|
134
|
+
|
135
|
+
# Code to run when a worker boots to setup the process after booting
|
136
|
+
# the app.
|
137
|
+
#
|
138
|
+
# This can be called multiple times to add hooks.
|
139
|
+
#
|
140
|
+
# after_worker_boot do
|
141
|
+
# puts 'On worker boot...'
|
142
|
+
# end
|
143
|
+
|
144
|
+
# Code to run when a worker shutdown.
|
145
|
+
#
|
146
|
+
#
|
147
|
+
# on_worker_shutdown do
|
148
|
+
# puts 'On worker boot...'
|
149
|
+
# end
|
150
|
+
|
151
|
+
# Allow workers to reload bundler context when master process is issued
|
152
|
+
# a USR1 signal. This allows proper reloading of gems while the master
|
153
|
+
# is preserved across a phased-restart. (incompatible with preload_app)
|
154
|
+
# (off by default)
|
155
|
+
|
156
|
+
# prune_bundler
|
157
|
+
|
158
|
+
# Preload the application before starting the workers; this conflicts with
|
159
|
+
# phased restart feature. (off by default)
|
160
|
+
|
161
|
+
# preload_app!
|
162
|
+
|
163
|
+
# Additional text to display in process listing
|
164
|
+
#
|
165
|
+
# tag 'app name'
|
166
|
+
|
167
|
+
# Change the default timeout of workers
|
168
|
+
#
|
169
|
+
# worker_timeout 60
|
170
|
+
|
171
|
+
# === Puma control rack application ===
|
172
|
+
|
173
|
+
# Start the puma control rack application on “url”. This application can
|
174
|
+
# be communicated with to control the main server. Additionally, you can
|
175
|
+
# provide an authentication token, so all requests to the control server
|
176
|
+
# will need to include that token as a query parameter. This allows for
|
177
|
+
# simple authentication.
|
178
|
+
#
|
179
|
+
# Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb
|
180
|
+
# to see what the app has available.
|
181
|
+
#
|
182
|
+
# activate_control_app 'unix:///var/run/pumactl.sock'
|
183
|
+
# activate_control_app 'unix:///var/run/pumactl.sock', { auth_token: '12345' }
|
184
|
+
# activate_control_app 'unix:///var/run/pumactl.sock', { no_token: true }
|