gemstash 1.0.0.pre.1-java → 2.6.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.
Files changed (99) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +303 -0
  3. data/exe/gemstash +3 -0
  4. data/lib/gemstash/api_key_authorization.rb +32 -0
  5. data/lib/gemstash/authorization.rb +15 -8
  6. data/lib/gemstash/cache.rb +42 -2
  7. data/lib/gemstash/cli/authorize.rb +52 -9
  8. data/lib/gemstash/cli/base.rb +14 -6
  9. data/lib/gemstash/cli/setup.rb +67 -39
  10. data/lib/gemstash/cli/start.rb +6 -2
  11. data/lib/gemstash/cli/status.rb +3 -1
  12. data/lib/gemstash/cli/stop.rb +4 -1
  13. data/lib/gemstash/cli.rb +59 -1
  14. data/lib/gemstash/config.ru +4 -3
  15. data/lib/gemstash/configuration.rb +61 -8
  16. data/lib/gemstash/db/authorization.rb +5 -3
  17. data/lib/gemstash/db/cached_rubygem.rb +20 -0
  18. data/lib/gemstash/db/dependency.rb +2 -0
  19. data/lib/gemstash/db/rubygem.rb +3 -0
  20. data/lib/gemstash/db/upstream.rb +15 -0
  21. data/lib/gemstash/db/version.rb +25 -2
  22. data/lib/gemstash/db.rb +5 -0
  23. data/lib/gemstash/dependencies.rb +6 -2
  24. data/lib/gemstash/env.rb +44 -13
  25. data/lib/gemstash/gem_fetcher.rb +5 -3
  26. data/lib/gemstash/gem_pusher.rb +25 -18
  27. data/lib/gemstash/gem_source/dependency_caching.rb +4 -4
  28. data/lib/gemstash/gem_source/private_source.rb +34 -50
  29. data/lib/gemstash/gem_source/rack_middleware.rb +3 -0
  30. data/lib/gemstash/gem_source/upstream_source.rb +71 -27
  31. data/lib/gemstash/gem_source.rb +4 -2
  32. data/lib/gemstash/gem_yanker.rb +14 -4
  33. data/lib/gemstash/health.rb +55 -0
  34. data/lib/gemstash/http_client.rb +15 -5
  35. data/lib/gemstash/logging.rb +19 -7
  36. data/lib/gemstash/man/gemstash-authorize.1 +54 -0
  37. data/lib/gemstash/man/gemstash-authorize.1.txt +52 -0
  38. data/lib/gemstash/man/gemstash-configuration.5 +186 -0
  39. data/lib/gemstash/man/gemstash-configuration.5.txt +208 -0
  40. data/lib/gemstash/man/gemstash-customize.7 +273 -0
  41. data/lib/gemstash/man/gemstash-customize.7.txt +184 -0
  42. data/lib/gemstash/man/gemstash-debugging.7 +30 -0
  43. data/lib/gemstash/man/gemstash-debugging.7.txt +27 -0
  44. data/lib/gemstash/man/gemstash-deploy.7 +63 -0
  45. data/lib/gemstash/man/gemstash-deploy.7.txt +57 -0
  46. data/lib/gemstash/man/gemstash-mirror.7 +34 -0
  47. data/lib/gemstash/man/gemstash-mirror.7.txt +31 -0
  48. data/lib/gemstash/man/gemstash-multiple-sources.7 +131 -0
  49. data/lib/gemstash/man/gemstash-multiple-sources.7.txt +116 -0
  50. data/lib/gemstash/man/gemstash-private-gems.7 +191 -0
  51. data/lib/gemstash/man/gemstash-private-gems.7.txt +154 -0
  52. data/lib/gemstash/man/gemstash-readme.7 +199 -0
  53. data/lib/gemstash/man/gemstash-readme.7.txt +177 -0
  54. data/lib/gemstash/man/gemstash-setup.1 +38 -0
  55. data/lib/gemstash/man/gemstash-setup.1.txt +38 -0
  56. data/lib/gemstash/man/gemstash-start.1 +23 -0
  57. data/lib/gemstash/man/gemstash-start.1.txt +24 -0
  58. data/lib/gemstash/man/gemstash-status.1 +17 -0
  59. data/lib/gemstash/man/gemstash-status.1.txt +20 -0
  60. data/lib/gemstash/man/gemstash-stop.1 +17 -0
  61. data/lib/gemstash/man/gemstash-stop.1.txt +20 -0
  62. data/lib/gemstash/man/gemstash-version.1 +17 -0
  63. data/lib/gemstash/man/gemstash-version.1.txt +19 -0
  64. data/lib/gemstash/migrations/01_gem_dependencies.rb +11 -9
  65. data/lib/gemstash/migrations/02_authorizations.rb +4 -2
  66. data/lib/gemstash/migrations/03_cached_gems.rb +26 -0
  67. data/lib/gemstash/migrations/04_health_tests.rb +10 -0
  68. data/lib/gemstash/migrations/05_authorization_names.rb +10 -0
  69. data/lib/gemstash/puma.rb +5 -3
  70. data/lib/gemstash/rack_env_rewriter.rb +11 -2
  71. data/lib/gemstash/specs_builder.rb +25 -15
  72. data/lib/gemstash/storage.rb +175 -32
  73. data/lib/gemstash/upstream.rb +43 -8
  74. data/lib/gemstash/version.rb +4 -2
  75. data/lib/gemstash/web.rb +13 -8
  76. data/lib/gemstash.rb +6 -2
  77. metadata +135 -110
  78. data/.gitignore +0 -10
  79. data/.rspec +0 -2
  80. data/.rubocop-bundler.yml +0 -92
  81. data/.rubocop-relax.yml +0 -11
  82. data/.rubocop.yml +0 -8
  83. data/.travis.yml +0 -20
  84. data/Gemfile +0 -4
  85. data/README.md +0 -139
  86. data/Rakefile +0 -35
  87. data/bin/console +0 -14
  88. data/bin/gemstash +0 -3
  89. data/bin/setup +0 -5
  90. data/docs/config.md +0 -136
  91. data/docs/debug.md +0 -24
  92. data/docs/deploy.md +0 -30
  93. data/docs/mirror.md +0 -30
  94. data/docs/multiple_sources.md +0 -68
  95. data/docs/private_gems.md +0 -140
  96. data/docs/reference.md +0 -308
  97. data/gemstash.gemspec +0 -47
  98. data/gemstash.png +0 -0
  99. data/lib/gemstash/gem_unyanker.rb +0 -61
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "gemstash"
4
+ require "date"
5
+ require "server_health_check_rack"
6
+ require "sequel"
7
+
8
+ module Gemstash
9
+ # This module contains the logic used to supply a health monitor for
10
+ # Gemstash. You can access the health monitor at the /health endpoint.
11
+ module Health
12
+ # This check can be used if you don't want to read or write content during a
13
+ # health check.
14
+ def self.heartbeat
15
+ true
16
+ end
17
+
18
+ def self.check_storage_read
19
+ if check_storage_write
20
+ content = Gemstash::Storage.for("health").resource("test").content(:example)
21
+ content =~ /\Acontent-\d+\z/
22
+ end
23
+ end
24
+
25
+ def self.check_storage_write
26
+ resource = Gemstash::Storage.for("health").resource("test")
27
+ resource.save(example: "content-#{Time.now.to_i}")
28
+ true
29
+ end
30
+
31
+ def self.check_db_read
32
+ result = Gemstash::Env.current.db[:rubygems].where(name: "testing_db_read").count
33
+ result.is_a?(Numeric)
34
+ end
35
+
36
+ def self.check_db_write
37
+ Gemstash::Env.current.db.transaction do
38
+ health_tests = Gemstash::Env.current.db[:health_tests]
39
+ health_tests.truncate
40
+ health_tests.insert(string: "test_string")
41
+ # We don't want to actually write to the database
42
+ raise Sequel::Rollback
43
+ end
44
+
45
+ true
46
+ end
47
+
48
+ ServerHealthCheckRack::Checks.check("heartbeat") { Gemstash::Health.heartbeat }
49
+ ServerHealthCheckRack::Checks.check("storage_read") { Gemstash::Health.check_storage_read }
50
+ ServerHealthCheckRack::Checks.check("storage_write") { Gemstash::Health.check_storage_write }
51
+ ServerHealthCheckRack::Checks.check("db_read") { Gemstash::Health.check_db_read }
52
+ ServerHealthCheckRack::Checks.check("db_write") { Gemstash::Health.check_db_write }
53
+ RackMiddleware = ServerHealthCheckRack::Middleware
54
+ end
55
+ end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "gemstash"
2
4
  require "faraday"
3
5
  require "faraday_middleware"
4
6
 
5
7
  module Gemstash
6
- #:nodoc:
8
+ # :nodoc:
7
9
  class WebError < StandardError
8
10
  attr_reader :code
9
11
 
@@ -13,15 +15,16 @@ module Gemstash
13
15
  end
14
16
  end
15
17
 
16
- #:nodoc:
18
+ # :nodoc:
17
19
  class ConnectionError < WebError
18
20
  def initialize(message)
19
21
  super(message, 502) # Bad Gateway
20
22
  end
21
23
  end
22
24
 
23
- #:nodoc:
25
+ # :nodoc:
24
26
  class HTTPClient
27
+ extend Gemstash::Env::Helper
25
28
  include Gemstash::Logging
26
29
 
27
30
  DEFAULT_USER_AGENT = "Gemstash/#{Gemstash::VERSION}"
@@ -30,13 +33,19 @@ module Gemstash
30
33
  client = Faraday.new(upstream.to_s) do |config|
31
34
  config.use FaradayMiddleware::FollowRedirects
32
35
  config.adapter :net_http
36
+ config.options.timeout = gemstash_env.config[:fetch_timeout]
33
37
  end
38
+
39
+ client.basic_auth(upstream.user, upstream.password) if upstream.auth?
40
+
34
41
  user_agent = "#{upstream.user_agent} " unless upstream.user_agent.to_s.empty?
35
42
  user_agent = user_agent.to_s + DEFAULT_USER_AGENT
36
43
 
37
44
  new(client, user_agent: user_agent)
38
45
  end
39
46
 
47
+ attr_reader :client
48
+
40
49
  def initialize(client = nil, user_agent: nil)
41
50
  @client = client
42
51
  @user_agent = user_agent || DEFAULT_USER_AGENT
@@ -61,14 +70,15 @@ module Gemstash
61
70
 
62
71
  private
63
72
 
64
- def with_retries(times: 3, &block)
73
+ def with_retries(times: 3)
65
74
  loop do
66
75
  times -= 1
67
76
  begin
68
- return block.call
77
+ return yield
69
78
  rescue Faraday::ConnectionFailed => e
70
79
  log_error("Connection failure", e)
71
80
  raise(ConnectionError, e.message) unless times > 0
81
+
72
82
  log.info "retrying... #{times} more times"
73
83
  end
74
84
  end
@@ -1,8 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "logger"
2
- require "puma/events"
4
+
5
+ begin
6
+ require "puma/detect"
7
+ require "puma/log_writer" # Puma 6
8
+ rescue LoadError
9
+ require "puma/events"
10
+ end
3
11
 
4
12
  module Gemstash
5
- #:nodoc:
13
+ # :nodoc:
6
14
  module Logging
7
15
  LEVELS = {
8
16
  debug: Logger::DEBUG,
@@ -10,7 +18,7 @@ module Gemstash
10
18
  warn: Logger::WARN,
11
19
  error: Logger::ERROR,
12
20
  fatal: Logger::FATAL
13
- }
21
+ }.freeze
14
22
 
15
23
  def log
16
24
  Gemstash::Logging.logger
@@ -60,7 +68,9 @@ module Gemstash
60
68
  # Logger that looks like a stream, for Puma and Rack to log to.
61
69
  class StreamLogger
62
70
  def self.puma_events
63
- Puma::Events.new(for_stdout, for_stderr)
71
+ # Puma 6 removed logging from Events and placed it in LogWriter
72
+ klass = Puma.const_defined?(:LogWriter) ? Puma::LogWriter : Puma::Events
73
+ klass.new(for_stdout, for_stderr)
64
74
  end
65
75
 
66
76
  def self.for_stdout
@@ -75,10 +85,12 @@ module Gemstash
75
85
  @level = level
76
86
  end
77
87
 
78
- def flush
79
- end
88
+ def flush; end
89
+
90
+ def sync=(_value); end
80
91
 
81
- def sync=(_value)
92
+ def sync
93
+ false
82
94
  end
83
95
 
84
96
  def write(message)
@@ -0,0 +1,54 @@
1
+ <!-- Automatically generated by Pandoc -->
2
+ .\" Automatically generated by Pandoc 3.1.8
3
+ .\"
4
+ .TH "gemstash-authorize" "1" "October 9, 2015" "" ""
5
+ .SH Name
6
+ gemstash-authorize - Adds or removes authorization to interact with
7
+ privately stored gems
8
+ .SH Synopsis
9
+ \f[CR]gemstash authorize [permissions] [--remove] [--list] [--key SECURE_KEY] [--name NAME] [--config-file FILE]\f[R]
10
+ .SH Description
11
+ Adds or removes authorization to interact with privately stored gems.
12
+ .PP
13
+ Any arguments will be used as specific permissions.
14
+ Valid permissions include \f[CR]push\f[R], \f[CR]yank\f[R], and
15
+ \f[CR]fetch\f[R].
16
+ If no permissions are provided, then all permissions will be granted
17
+ (including any that may be added in future versions of Gemstash).
18
+ .SS Usage
19
+ .IP
20
+ .EX
21
+ gemstash authorize
22
+ gemstash authorize push yank
23
+ gemstash authorize push --name my-auth
24
+ gemstash authorize yank --key <secure-key>
25
+ gemstash authorize --remove --key <secure-key>
26
+ gemstash authorize --list
27
+ .EE
28
+ .SH Options
29
+ .IP \[bu] 2
30
+ \f[CR]--config-file FILE\f[R]: Specify the config file to use.
31
+ If you aren\[cq]t using the default config file at
32
+ \f[CR]\[ti]/.gemstash/config.yml\f[R] or
33
+ \f[CR]\[ti]/.gemstash/config.yml.erb\f[R], then you must specify the
34
+ config file via this option.
35
+ .IP \[bu] 2
36
+ \f[CR]--key SECURE_KEY\f[R]: Specify the API key to affect.
37
+ This should be the actual key value, not a name.
38
+ This option is required when using \f[CR]--remove\f[R] but is optional
39
+ otherwise.
40
+ If adding an authorization, using this will either create or update the
41
+ permissions for the specified API key.
42
+ If missing, a new API key will always be generated.
43
+ Note that a key can only have a maximum length of 255 chars.
44
+ .IP \[bu] 2
45
+ \f[CR]--name\f[R]: Name of the authorization.
46
+ Purely for ease of identification, not required.
47
+ .IP \[bu] 2
48
+ \f[CR]--remove\f[R]: Remove an authorization rather than add or update
49
+ one.
50
+ When removing, permission values are not allowed.
51
+ The \f[CR]--key <secure-key>\f[R] option is required.
52
+ .IP \[bu] 2
53
+ \f[CR]--list\f[R]: List current authorizations.
54
+ Provide \f[CR]--name\f[R] or \f[CR]--key\f[R] to show only one result.
@@ -0,0 +1,52 @@
1
+ 4mgemstash-authorize24m(1) 4mgemstash-authorize24m(1)
2
+
3
+ <!-- Automatically generated by Pandoc -->
4
+
5
+ 1mName0m
6
+ gemstash-authorize - Adds or removes authorization to interact with
7
+ privately stored gems
8
+
9
+ 1mSynopsis0m
10
+ gemstash authorize [permissions] [--remove] [--list] [--key SECURE_KEY]
11
+ [--name NAME] [--config-file FILE]
12
+
13
+ 1mDescription0m
14
+ Adds or removes authorization to interact with privately stored gems.
15
+
16
+ Any arguments will be used as specific permissions. Valid permissions
17
+ include push, yank, and fetch. If no permissions are provided, then
18
+ all permissions will be granted (including any that may be added in fu-
19
+ ture versions of Gemstash).
20
+
21
+ 1mUsage0m
22
+ gemstash authorize
23
+ gemstash authorize push yank
24
+ gemstash authorize push --name my-auth
25
+ gemstash authorize yank --key <secure-key>
26
+ gemstash authorize --remove --key <secure-key>
27
+ gemstash authorize --list
28
+
29
+ 1mOptions0m
30
+ o --config-file FILE: Specify the config file to use. If you aren't
31
+ using the default config file at ~/.gemstash/config.yml or ~/.gem-
32
+ stash/config.yml.erb, then you must specify the config file via this
33
+ option.
34
+
35
+ o --key SECURE_KEY: Specify the API key to affect. This should be the
36
+ actual key value, not a name. This option is required when using
37
+ --remove but is optional otherwise. If adding an authorization, us-
38
+ ing this will either create or update the permissions for the speci-
39
+ fied API key. If missing, a new API key will always be generated.
40
+ Note that a key can only have a maximum length of 255 chars.
41
+
42
+ o --name: Name of the authorization. Purely for ease of identifica-
43
+ tion, not required.
44
+
45
+ o --remove: Remove an authorization rather than add or update one.
46
+ When removing, permission values are not allowed. The --key <secure-
47
+ key> option is required.
48
+
49
+ o --list: List current authorizations. Provide --name or --key to show
50
+ only one result.
51
+
52
+ October 9, 2015 4mgemstash-authorize24m(1)
@@ -0,0 +1,186 @@
1
+ <!-- Automatically generated by Pandoc -->
2
+ .\" Automatically generated by Pandoc 3.1.8
3
+ .\"
4
+ .TH "gemstash-configuration" "5" "October 13, 2015" "" ""
5
+ .SH Name
6
+ gemstash-configuration
7
+ .SH Synopsis
8
+ .IP
9
+ .EX
10
+ # \[ti]/.gemstash/config.yml
11
+ ---
12
+ :base_path: \[dq]/var/gemstash\[dq]
13
+ :cache_type: memcached
14
+ :memcached_servers: localhost:11211
15
+ :db_adapter: postgres
16
+ :db_url: postgres:///gemstash
17
+ :db_connection_options:
18
+ :test: true
19
+ :pool_timeout: 2
20
+ :rubygems_url: https://my.gem-source.local
21
+ :ignore_gemfile_source: false
22
+ :puma_threads: 32
23
+ :bind: tcp://0.0.0.0:4242
24
+ :protected_fetch: true
25
+ :fetch_timeout: 10
26
+ :log_file: gemstash.log
27
+ .EE
28
+ .SH Base Path
29
+ \f[CR]:base_path\f[R]
30
+ .PP
31
+ Specifies where to store local files like the server log, cached gem
32
+ files, and the database (when using SQLite).
33
+ If the default is being used, the directory will be created if it does
34
+ not exist.
35
+ Any other directory needs to be created ahead of time and be writable to
36
+ the Gemstash server process.
37
+ Specifying the \f[CR]:base_path\f[R] via \f[CR]gemstash setup\f[R] will
38
+ create the directory for you.
39
+ .SS Default value
40
+ \f[CR]\[ti]/.gemstash\f[R]
41
+ .SS Valid values
42
+ Any valid path
43
+ .SH Cache Type
44
+ \f[CR]:cache_type\f[R]
45
+ .PP
46
+ Specifies how to cache values other than gem files (such as gem
47
+ dependencies).
48
+ \f[CR]memory\f[R] will use an in memory cache while \f[CR]memcached\f[R]
49
+ will point to 1 or more Memcached servers.
50
+ Use the \f[CR]:memcached_servers\f[R] configuration key for specifying
51
+ where the Memcached server(s) are.
52
+ .SS Default value
53
+ \f[CR]memory\f[R]
54
+ .SS Valid values
55
+ \f[CR]memory\f[R], \f[CR]memcached\f[R]
56
+ .SH Memcached Servers
57
+ \f[CR]:memcached_servers\f[R]
58
+ .PP
59
+ Specifies the Memcached servers to connect to when using
60
+ \f[CR]memcached\f[R] for the \f[CR]:cache_type\f[R].
61
+ Only used when \f[CR]memcached\f[R] is used for \f[CR]:cache_type\f[R].
62
+ .SS Default value
63
+ \f[CR]localhost:11211\f[R]
64
+ .SS Valid values
65
+ A comma delimited list of Memcached servers
66
+ .SH DB Adapter
67
+ \f[CR]:db_adapter\f[R]
68
+ .PP
69
+ Specifies what database adapter to use.
70
+ When \f[CR]sqlite3\f[R] is used, the database will be located at
71
+ \f[CR]gemstash.db\f[R] within the directory specified by
72
+ \f[CR]:base_path\f[R].
73
+ The database will automatically be created when using
74
+ \f[CR]sqlite3\f[R].
75
+ When \f[CR]postgres\f[R], \f[CR]mysql\f[R], or \f[CR]mysql2\f[R] is
76
+ used, the database to connect to must be specified in the
77
+ \f[CR]:db_url\f[R] configuration key.
78
+ The database must already be created when using anything other than
79
+ \f[CR]sqlite3\f[R].
80
+ .SS Default value
81
+ \f[CR]sqlite3\f[R]
82
+ .SS Valid values
83
+ \f[CR]sqlite3\f[R], \f[CR]postgres\f[R], \f[CR]mysql\f[R],
84
+ \f[CR]mysql2\f[R]
85
+ .SH DB URL
86
+ \f[CR]:db_url\f[R]
87
+ .PP
88
+ Specifies the database to connect to when using \f[CR]postgres\f[R],
89
+ \f[CR]mysql\f[R], or \f[CR]mysql2\f[R] for the \f[CR]:db_adapter\f[R].
90
+ Only used when the \f[CR]:db_adapter\f[R] is not \f[CR]sqlite3\f[R].
91
+ .SS Default value
92
+ None
93
+ .SS Valid values
94
+ A valid database URL for the Sequel gem (http://sequel.jeremyevans.net/)
95
+ .SH DB Connection Options
96
+ \f[CR]:db_connection_options\f[R]
97
+ .PP
98
+ Specifies additional \f[CR]Sequel.connect\f[R] options to use.
99
+ Note that any options here are merged in with the default options, so
100
+ you need not specify the \f[CR]max_connections\f[R] if you customize
101
+ this option.
102
+ .SS Default value
103
+ \f[CR]{ max_connections: 1 }\f[R] for \f[CR]sqlite3\f[R] adapter,
104
+ \f[CR]{ max_connections: config[:puma_threads] + 1 }\f[R] for any other
105
+ adapter.
106
+ .SS Valid values
107
+ A valid connection options Hash for the
108
+ Sequel.connect (http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-General+connection+options)
109
+ method.
110
+ .SH Rubygems URL
111
+ \f[CR]:rubygems_url\f[R]
112
+ .PP
113
+ Specifies the default gem source URL.
114
+ When any API endpoint is called without a \f[CR]/private\f[R] or
115
+ \f[CR]/upstream/<url>\f[R] prefix, this URL will be used to fetch the
116
+ result.
117
+ This value can be safely changed even if there are already gems stashed
118
+ for the previous value.
119
+ .SS Default value
120
+ \f[CR]https://rubygems.org\f[R]
121
+ .SS Valid values
122
+ A valid gem source URL
123
+ .SH Ignore Gemfile source
124
+ \f[CR]:ignore_gemfile_source\f[R]
125
+ .PP
126
+ Ignore the source specified in Gemfile and always use
127
+ \f[CR]:rubygems_url\f[R] as gems upstream.
128
+ .SS Default value
129
+ \f[CR]false\f[R]
130
+ .SS Valid values
131
+ Boolean: \f[CR]true\f[R] or \f[CR]false\f[R]
132
+ .SH Puma Threads
133
+ \f[CR]:puma_threads\f[R]
134
+ .PP
135
+ Specifies the number of threads used for the Gemstash server.
136
+ .SS Default value
137
+ \f[CR]16\f[R]
138
+ .SS Valid values
139
+ Integer value with a minimum of \f[CR]1\f[R]
140
+ .SH Bind Address
141
+ \f[CR]:bind\f[R]
142
+ .PP
143
+ Specifies the binding used to start the Gemstash server.
144
+ Keep in mind the user starting Gemstash needs to have access to bind in
145
+ this manner.
146
+ For example, if you use a port below 1024, you will need to run Gemstash
147
+ as the root user.
148
+ .SS Default value
149
+ \f[CR]tcp://0.0.0.0:9292\f[R]
150
+ .SS Valid values
151
+ Any valid binding that is supported by
152
+ Puma (https://github.com/puma/puma#binding-tcp--sockets)
153
+ .SH Protected Fetch
154
+ \f[CR]:protected_fetch\f[R]
155
+ .PP
156
+ Tells Gemstash to authenticate via an API key before allowing the
157
+ fetching of private gems and specs.
158
+ The default behavior is to allow unauthenticated download of private
159
+ gems and specs.
160
+ .SS Default value
161
+ \f[CR]false\f[R]
162
+ .SS Valid values
163
+ Boolean values \f[CR]true\f[R] or \f[CR]false\f[R]
164
+ .SH Fetch Timeout
165
+ \f[CR]:fetch_timeout\f[R]
166
+ .PP
167
+ The timeout setting for fetching gems.
168
+ Fetching gems over a slow connection may cause timeout errors.
169
+ If you experience timeout errors, you may want to increase this value.
170
+ The default is \f[CR]20\f[R] seconds.
171
+ .SS Default value
172
+ \f[CR]20\f[R]
173
+ .SS Valid values
174
+ Integer value with a minimum of \f[CR]1\f[R]
175
+ .SH Log File
176
+ \f[CR]:log_file\f[R]
177
+ .PP
178
+ Indicates the name of the file to use for logging.
179
+ The file will be placed in the base path.
180
+ .SS Default value
181
+ \f[CR]server.log\f[R]
182
+ .SS Valid values
183
+ Any valid file name, or \f[CR]:stdout\f[R] to log to \f[CR]$stdout\f[R]
184
+ .PP
185
+ \f[I]Note: Using \f[CI]:stdout\f[I] for the \f[CI]:log_file\f[I]
186
+ requires running with \f[CI]--no-daemonize\f[I].\f[R]
@@ -0,0 +1,208 @@
1
+ 4mgemstash-configuration24m(5) 4mgemstash-configuration24m(5)
2
+
3
+ <!-- Automatically generated by Pandoc -->
4
+
5
+ 1mName0m
6
+ gemstash-configuration
7
+
8
+ 1mSynopsis0m
9
+ # ~/.gemstash/config.yml
10
+ ---
11
+ :base_path: "/var/gemstash"
12
+ :cache_type: memcached
13
+ :memcached_servers: localhost:11211
14
+ :db_adapter: postgres
15
+ :db_url: postgres:///gemstash
16
+ :db_connection_options:
17
+ :test: true
18
+ :pool_timeout: 2
19
+ :rubygems_url: https://my.gem-source.local
20
+ :ignore_gemfile_source: false
21
+ :puma_threads: 32
22
+ :bind: tcp://0.0.0.0:4242
23
+ :protected_fetch: true
24
+ :fetch_timeout: 10
25
+ :log_file: gemstash.log
26
+
27
+ 1mBase Path0m
28
+ :base_path
29
+
30
+ Specifies where to store local files like the server log, cached gem
31
+ files, and the database (when using SQLite). If the default is being
32
+ used, the directory will be created if it does not exist. Any other
33
+ directory needs to be created ahead of time and be writable to the Gem-
34
+ stash server process. Specifying the :base_path via gemstash setup
35
+ will create the directory for you.
36
+
37
+ 1mDefault value0m
38
+ ~/.gemstash
39
+
40
+ 1mValid values0m
41
+ Any valid path
42
+
43
+ 1mCache Type0m
44
+ :cache_type
45
+
46
+ Specifies how to cache values other than gem files (such as gem depen-
47
+ dencies). memory will use an in memory cache while memcached will
48
+ point to 1 or more Memcached servers. Use the :memcached_servers con-
49
+ figuration key for specifying where the Memcached server(s) are.
50
+
51
+ 1mDefault value0m
52
+ memory
53
+
54
+ 1mValid values0m
55
+ memory, memcached
56
+
57
+ 1mMemcached Servers0m
58
+ :memcached_servers
59
+
60
+ Specifies the Memcached servers to connect to when using memcached for
61
+ the :cache_type. Only used when memcached is used for :cache_type.
62
+
63
+ 1mDefault value0m
64
+ localhost:11211
65
+
66
+ 1mValid values0m
67
+ A comma delimited list of Memcached servers
68
+
69
+ 1mDB Adapter0m
70
+ :db_adapter
71
+
72
+ Specifies what database adapter to use. When sqlite3 is used, the
73
+ database will be located at gemstash.db within the directory specified
74
+ by :base_path. The database will automatically be created when using
75
+ sqlite3. When postgres, mysql, or mysql2 is used, the database to con-
76
+ nect to must be specified in the :db_url configuration key. The data-
77
+ base must already be created when using anything other than sqlite3.
78
+
79
+ 1mDefault value0m
80
+ sqlite3
81
+
82
+ 1mValid values0m
83
+ sqlite3, postgres, mysql, mysql2
84
+
85
+ 1mDB URL0m
86
+ :db_url
87
+
88
+ Specifies the database to connect to when using postgres, mysql, or
89
+ mysql2 for the :db_adapter. Only used when the :db_adapter is not
90
+ sqlite3.
91
+
92
+ 1mDefault value0m
93
+ None
94
+
95
+ 1mValid values0m
96
+ A valid database URL for the Sequel gem (http://sequel.jeremye-
97
+ vans.net/)
98
+
99
+ 1mDB Connection Options0m
100
+ :db_connection_options
101
+
102
+ Specifies additional Sequel.connect options to use. Note that any op-
103
+ tions here are merged in with the default options, so you need not
104
+ specify the max_connections if you customize this option.
105
+
106
+ 1mDefault value0m
107
+ { max_connections: 1 } for sqlite3 adapter, { max_connections: con-
108
+ fig[:puma_threads] + 1 } for any other adapter.
109
+
110
+ 1mValid values0m
111
+ A valid connection options Hash for the Sequel.connect (http://se-
112
+ quel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-
113
+ General+connection+options) method.
114
+
115
+ 1mRubygems URL0m
116
+ :rubygems_url
117
+
118
+ Specifies the default gem source URL. When any API endpoint is called
119
+ without a /private or /upstream/<url> prefix, this URL will be used to
120
+ fetch the result. This value can be safely changed even if there are
121
+ already gems stashed for the previous value.
122
+
123
+ 1mDefault value0m
124
+ https://rubygems.org
125
+
126
+ 1mValid values0m
127
+ A valid gem source URL
128
+
129
+ 1mIgnore Gemfile source0m
130
+ :ignore_gemfile_source
131
+
132
+ Ignore the source specified in Gemfile and always use :rubygems_url as
133
+ gems upstream.
134
+
135
+ 1mDefault value0m
136
+ false
137
+
138
+ 1mValid values0m
139
+ Boolean: true or false
140
+
141
+ 1mPuma Threads0m
142
+ :puma_threads
143
+
144
+ Specifies the number of threads used for the Gemstash server.
145
+
146
+ 1mDefault value0m
147
+ 16
148
+
149
+ 1mValid values0m
150
+ Integer value with a minimum of 1
151
+
152
+ 1mBind Address0m
153
+ :bind
154
+
155
+ Specifies the binding used to start the Gemstash server. Keep in mind
156
+ the user starting Gemstash needs to have access to bind in this manner.
157
+ For example, if you use a port below 1024, you will need to run Gem-
158
+ stash as the root user.
159
+
160
+ 1mDefault value0m
161
+ tcp://0.0.0.0:9292
162
+
163
+ 1mValid values0m
164
+ Any valid binding that is supported by Puma
165
+ (https://github.com/puma/puma#binding-tcp--sockets)
166
+
167
+ 1mProtected Fetch0m
168
+ :protected_fetch
169
+
170
+ Tells Gemstash to authenticate via an API key before allowing the
171
+ fetching of private gems and specs. The default behavior is to allow
172
+ unauthenticated download of private gems and specs.
173
+
174
+ 1mDefault value0m
175
+ false
176
+
177
+ 1mValid values0m
178
+ Boolean values true or false
179
+
180
+ 1mFetch Timeout0m
181
+ :fetch_timeout
182
+
183
+ The timeout setting for fetching gems. Fetching gems over a slow con-
184
+ nection may cause timeout errors. If you experience timeout errors,
185
+ you may want to increase this value. The default is 20 seconds.
186
+
187
+ 1mDefault value0m
188
+ 20
189
+
190
+ 1mValid values0m
191
+ Integer value with a minimum of 1
192
+
193
+ 1mLog File0m
194
+ :log_file
195
+
196
+ Indicates the name of the file to use for logging. The file will be
197
+ placed in the base path.
198
+
199
+ 1mDefault value0m
200
+ server.log
201
+
202
+ 1mValid values0m
203
+ Any valid file name, or :stdout to log to $stdout
204
+
205
+ 4mNote:24m 4mUsing24m 4m:stdout24m 4mfor24m 4mthe24m 4m:log_file24m 4mrequires24m 4mrunning24m 4mwith24m 4m--no-daemo-0m
206
+ 4mnize.0m
207
+
208
+ October 13, 2015 4mgemstash-configuration24m(5)