gemstash 1.0.0.pre.1-java → 2.6.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +303 -0
- data/exe/gemstash +3 -0
- data/lib/gemstash/api_key_authorization.rb +32 -0
- data/lib/gemstash/authorization.rb +15 -8
- data/lib/gemstash/cache.rb +42 -2
- data/lib/gemstash/cli/authorize.rb +52 -9
- data/lib/gemstash/cli/base.rb +14 -6
- data/lib/gemstash/cli/setup.rb +67 -39
- data/lib/gemstash/cli/start.rb +6 -2
- data/lib/gemstash/cli/status.rb +3 -1
- data/lib/gemstash/cli/stop.rb +4 -1
- data/lib/gemstash/cli.rb +59 -1
- data/lib/gemstash/config.ru +4 -3
- data/lib/gemstash/configuration.rb +61 -8
- data/lib/gemstash/db/authorization.rb +5 -3
- data/lib/gemstash/db/cached_rubygem.rb +20 -0
- data/lib/gemstash/db/dependency.rb +2 -0
- data/lib/gemstash/db/rubygem.rb +3 -0
- data/lib/gemstash/db/upstream.rb +15 -0
- data/lib/gemstash/db/version.rb +25 -2
- data/lib/gemstash/db.rb +5 -0
- data/lib/gemstash/dependencies.rb +6 -2
- data/lib/gemstash/env.rb +44 -13
- data/lib/gemstash/gem_fetcher.rb +5 -3
- data/lib/gemstash/gem_pusher.rb +25 -18
- data/lib/gemstash/gem_source/dependency_caching.rb +4 -4
- data/lib/gemstash/gem_source/private_source.rb +34 -50
- data/lib/gemstash/gem_source/rack_middleware.rb +3 -0
- data/lib/gemstash/gem_source/upstream_source.rb +71 -27
- data/lib/gemstash/gem_source.rb +4 -2
- data/lib/gemstash/gem_yanker.rb +14 -4
- data/lib/gemstash/health.rb +55 -0
- data/lib/gemstash/http_client.rb +15 -5
- data/lib/gemstash/logging.rb +19 -7
- data/lib/gemstash/man/gemstash-authorize.1 +54 -0
- data/lib/gemstash/man/gemstash-authorize.1.txt +52 -0
- data/lib/gemstash/man/gemstash-configuration.5 +186 -0
- data/lib/gemstash/man/gemstash-configuration.5.txt +208 -0
- data/lib/gemstash/man/gemstash-customize.7 +273 -0
- data/lib/gemstash/man/gemstash-customize.7.txt +184 -0
- data/lib/gemstash/man/gemstash-debugging.7 +30 -0
- data/lib/gemstash/man/gemstash-debugging.7.txt +27 -0
- data/lib/gemstash/man/gemstash-deploy.7 +63 -0
- data/lib/gemstash/man/gemstash-deploy.7.txt +57 -0
- data/lib/gemstash/man/gemstash-mirror.7 +34 -0
- data/lib/gemstash/man/gemstash-mirror.7.txt +31 -0
- data/lib/gemstash/man/gemstash-multiple-sources.7 +131 -0
- data/lib/gemstash/man/gemstash-multiple-sources.7.txt +116 -0
- data/lib/gemstash/man/gemstash-private-gems.7 +191 -0
- data/lib/gemstash/man/gemstash-private-gems.7.txt +154 -0
- data/lib/gemstash/man/gemstash-readme.7 +199 -0
- data/lib/gemstash/man/gemstash-readme.7.txt +177 -0
- data/lib/gemstash/man/gemstash-setup.1 +38 -0
- data/lib/gemstash/man/gemstash-setup.1.txt +38 -0
- data/lib/gemstash/man/gemstash-start.1 +23 -0
- data/lib/gemstash/man/gemstash-start.1.txt +24 -0
- data/lib/gemstash/man/gemstash-status.1 +17 -0
- data/lib/gemstash/man/gemstash-status.1.txt +20 -0
- data/lib/gemstash/man/gemstash-stop.1 +17 -0
- data/lib/gemstash/man/gemstash-stop.1.txt +20 -0
- data/lib/gemstash/man/gemstash-version.1 +17 -0
- data/lib/gemstash/man/gemstash-version.1.txt +19 -0
- data/lib/gemstash/migrations/01_gem_dependencies.rb +11 -9
- data/lib/gemstash/migrations/02_authorizations.rb +4 -2
- data/lib/gemstash/migrations/03_cached_gems.rb +26 -0
- data/lib/gemstash/migrations/04_health_tests.rb +10 -0
- data/lib/gemstash/migrations/05_authorization_names.rb +10 -0
- data/lib/gemstash/puma.rb +5 -3
- data/lib/gemstash/rack_env_rewriter.rb +11 -2
- data/lib/gemstash/specs_builder.rb +25 -15
- data/lib/gemstash/storage.rb +175 -32
- data/lib/gemstash/upstream.rb +43 -8
- data/lib/gemstash/version.rb +4 -2
- data/lib/gemstash/web.rb +13 -8
- data/lib/gemstash.rb +6 -2
- metadata +135 -110
- data/.gitignore +0 -10
- data/.rspec +0 -2
- data/.rubocop-bundler.yml +0 -92
- data/.rubocop-relax.yml +0 -11
- data/.rubocop.yml +0 -8
- data/.travis.yml +0 -20
- data/Gemfile +0 -4
- data/README.md +0 -139
- data/Rakefile +0 -35
- data/bin/console +0 -14
- data/bin/gemstash +0 -3
- data/bin/setup +0 -5
- data/docs/config.md +0 -136
- data/docs/debug.md +0 -24
- data/docs/deploy.md +0 -30
- data/docs/mirror.md +0 -30
- data/docs/multiple_sources.md +0 -68
- data/docs/private_gems.md +0 -140
- data/docs/reference.md +0 -308
- data/gemstash.gemspec +0 -47
- data/gemstash.png +0 -0
- data/lib/gemstash/gem_unyanker.rb +0 -61
@@ -0,0 +1,273 @@
|
|
1
|
+
<!-- Automatically generated by Pandoc -->
|
2
|
+
.\" Automatically generated by Pandoc 3.1.8
|
3
|
+
.\"
|
4
|
+
.TH "gemstash-customize" "7" "October 28, 2015" "" ""
|
5
|
+
.SH Customizing the Server
|
6
|
+
Although Gemstash is designed for as minimal setup as possible, there
|
7
|
+
may be times you will want to change some of the default configuration.
|
8
|
+
By the end of this guide, you will be able to customize some of the
|
9
|
+
Gemstash behavior, including where files are stored, what database
|
10
|
+
Gemstash uses, and how Gemstash caches certain requests.
|
11
|
+
.SS Setup
|
12
|
+
Several customizable options are available via an interactive Gemstash
|
13
|
+
command.
|
14
|
+
Run \f[CR]gemstash setup\f[R] and answer the questions it provides (a
|
15
|
+
blank answer will use the default value):
|
16
|
+
.RS
|
17
|
+
.PP
|
18
|
+
$ gemstash setup
|
19
|
+
.PD 0
|
20
|
+
.P
|
21
|
+
.PD
|
22
|
+
Where should files go?
|
23
|
+
[\[ti]/.gemstash]
|
24
|
+
.PD 0
|
25
|
+
.P
|
26
|
+
.PD
|
27
|
+
Cache with what?
|
28
|
+
[MEMORY, memcached] \f[B]memcached\f[R]
|
29
|
+
.PD 0
|
30
|
+
.P
|
31
|
+
.PD
|
32
|
+
What is the comma separated Memcached servers?
|
33
|
+
[localhost:11211]
|
34
|
+
.PD 0
|
35
|
+
.P
|
36
|
+
.PD
|
37
|
+
What database adapter?
|
38
|
+
[SQLITE3, postgres, mysql, mysql2] \f[B]postgres\f[R]
|
39
|
+
.PD 0
|
40
|
+
.P
|
41
|
+
.PD
|
42
|
+
Where is the database?
|
43
|
+
[postgres:///gemstash]
|
44
|
+
.PD 0
|
45
|
+
.P
|
46
|
+
.PD
|
47
|
+
Checking that the cache is available
|
48
|
+
.PD 0
|
49
|
+
.P
|
50
|
+
.PD
|
51
|
+
Checking that the database is available
|
52
|
+
.PD 0
|
53
|
+
.P
|
54
|
+
.PD
|
55
|
+
The database is not available
|
56
|
+
.PD 0
|
57
|
+
.P
|
58
|
+
.PD
|
59
|
+
.RE
|
60
|
+
.PP
|
61
|
+
Once you\[cq]ve answered the questions, some checks will be made to
|
62
|
+
ensure the configuration will work.
|
63
|
+
For example, the database didn\[cq]t exist in the previous example, so
|
64
|
+
the command failed and the configuration wasn\[cq]t saved.
|
65
|
+
If the command passes, you may provide the \f[CR]--redo\f[R] option to
|
66
|
+
force configuration to be redone:
|
67
|
+
.RS
|
68
|
+
.PP
|
69
|
+
\f[CR]$ gemstash setup --redo\f[R]
|
70
|
+
.PD 0
|
71
|
+
.P
|
72
|
+
.PD
|
73
|
+
Where should files go?
|
74
|
+
[\[ti]/.gemstash]
|
75
|
+
.PD 0
|
76
|
+
.P
|
77
|
+
.PD
|
78
|
+
Cache with what?
|
79
|
+
[MEMORY, memcached] \f[B]memcached\f[R]
|
80
|
+
.PD 0
|
81
|
+
.P
|
82
|
+
.PD
|
83
|
+
What is the comma separated Memcached servers?
|
84
|
+
[localhost:11211]
|
85
|
+
.PD 0
|
86
|
+
.P
|
87
|
+
.PD
|
88
|
+
What database adapter?
|
89
|
+
[SQLITE3, postgres, mysql, mysql2]
|
90
|
+
.PD 0
|
91
|
+
.P
|
92
|
+
.PD
|
93
|
+
Checking that the cache is available
|
94
|
+
.PD 0
|
95
|
+
.P
|
96
|
+
.PD
|
97
|
+
Checking that the database is available
|
98
|
+
.PD 0
|
99
|
+
.P
|
100
|
+
.PD
|
101
|
+
You are all setup!
|
102
|
+
.PD 0
|
103
|
+
.P
|
104
|
+
.PD
|
105
|
+
.RE
|
106
|
+
.PP
|
107
|
+
Once all checks have passed, Gemstash will store your answers in the
|
108
|
+
configuration file located at \f[CR]\[ti]/.gemstash/config.yml\f[R].
|
109
|
+
.SS Files
|
110
|
+
Storage in Gemstash defaults to \f[CR]\[ti]/.gemstash\f[R] unless
|
111
|
+
otherwise specified.
|
112
|
+
You can change this in your config file via the \f[CR]:base_path\f[R]
|
113
|
+
key:
|
114
|
+
.IP
|
115
|
+
.EX
|
116
|
+
# \[ti]/.gemstash/config.yml
|
117
|
+
---
|
118
|
+
:base_path: \[dq]/var/gemstash\[dq]
|
119
|
+
.EE
|
120
|
+
.PP
|
121
|
+
When customizing the \f[CR]base_path\f[R], the directory must exist,
|
122
|
+
otherwise Gemstash will fail to run.
|
123
|
+
Thus, if you want to use \f[CR]/var/gemstash\f[R] like in the previous
|
124
|
+
example, make sure to \f[CR]mkdir /var/gemstash\f[R] and grant access to
|
125
|
+
the directory for the user you run Gemstash with.
|
126
|
+
.SS Database
|
127
|
+
The \f[CR]:db_adapter\f[R] configuration key specifies what database you
|
128
|
+
will be using.
|
129
|
+
The default \f[CR]:db_adapter\f[R] is
|
130
|
+
\f[CR]sqlite3\f[R] (https://www.sqlite.org/), which will use a database
|
131
|
+
file located within your \f[CR]:base_path\f[R].
|
132
|
+
The database file will always be named \f[CR]gemstash.db\f[R].
|
133
|
+
.PP
|
134
|
+
You may also use \f[CR]postgres\f[R] (http://www.postgresql.org/),
|
135
|
+
\f[CR]mysql\f[R] (http://www.mysql.com/), or
|
136
|
+
\f[CR]mysql2\f[R] (http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-mysql2)
|
137
|
+
for your \f[CR]:db_adapter\f[R].
|
138
|
+
When using any of these options, you need to specify the
|
139
|
+
\f[CR]:db_url\f[R] to point to an existing database.
|
140
|
+
Here is an example configuration to use the \f[CR]postgres\f[R] adapter:
|
141
|
+
.IP
|
142
|
+
.EX
|
143
|
+
# \[ti]/.gemstash/config.yml
|
144
|
+
---
|
145
|
+
:db_adapter: postgres
|
146
|
+
:db_url: postgres:///gemstash
|
147
|
+
:db_connection_options: # Sequel.connect options
|
148
|
+
:connect_timeout: 10
|
149
|
+
:read_timeout: 5
|
150
|
+
:timeout: 30
|
151
|
+
.EE
|
152
|
+
.PP
|
153
|
+
Regardless of the adapter you choose, the database will automatically
|
154
|
+
migrate to your version of Gemstash whenever the database is needed.
|
155
|
+
You only need to ensure the database exists and Gemstash will do the
|
156
|
+
rest, except for \f[CR]sqlite3\f[R] (for which Gemstash will also create
|
157
|
+
the database for you).
|
158
|
+
.SS Cache
|
159
|
+
Certain things (like dependencies) are cached in memory.
|
160
|
+
This avoids web calls to the gem source, and database calls for private
|
161
|
+
gems.
|
162
|
+
.IP
|
163
|
+
.EX
|
164
|
+
# \[ti]/.gemstash/config.yml
|
165
|
+
---
|
166
|
+
:cache_type: memory
|
167
|
+
:cache_max_size: 2000
|
168
|
+
.EE
|
169
|
+
.PP
|
170
|
+
This configuration uses the default \f[CR]memory\f[R] cache, and has
|
171
|
+
increased the \f[CR]cache_max_size\f[R] setting from its default of 500
|
172
|
+
items.
|
173
|
+
.PP
|
174
|
+
The memory cache can optionally be swapped out with a
|
175
|
+
Memcached (http://memcached.org/) server (or cluster of servers).
|
176
|
+
.PP
|
177
|
+
To use Memcached, use the \f[CR]memcached\f[R] \f[CR]:cache_type\f[R]
|
178
|
+
configuration.
|
179
|
+
.PP
|
180
|
+
Provide the servers as a comma-separated list to the
|
181
|
+
\f[CR]:memcached_servers\f[R] configuration key:
|
182
|
+
.IP
|
183
|
+
.EX
|
184
|
+
# \[ti]/.gemstash/config.yml
|
185
|
+
---
|
186
|
+
:cache_type: memcached
|
187
|
+
:memcached_servers: memcached1.local:11211,memcached2.local:11211
|
188
|
+
:cache_expiration: 1800
|
189
|
+
.EE
|
190
|
+
.PP
|
191
|
+
All caching expires in \f[CR]cache_expiration\f[R] number of seconds.
|
192
|
+
Default is 1800 seconds (30 minutes).
|
193
|
+
This option applies to all caching.
|
194
|
+
.SS Server
|
195
|
+
Gemstash uses Puma (http://puma.io/) and Rack (http://rack.github.io/)
|
196
|
+
as the server.
|
197
|
+
Alternate server configurations are not currently supported, but you can
|
198
|
+
take a look at the Puma
|
199
|
+
configuration (https://github.com/rubygems/gemstash/blob/master/lib/gemstash/puma.rb)
|
200
|
+
and the rackup
|
201
|
+
file (https://github.com/rubygems/gemstash/blob/master/lib/gemstash/config.ru)
|
202
|
+
for inspiration.
|
203
|
+
.PP
|
204
|
+
While the server is not customizable, the way Gemstash binds the port
|
205
|
+
can be changed.
|
206
|
+
To change the binding, update the \f[CR]:bind\f[R] configuration key:
|
207
|
+
.IP
|
208
|
+
.EX
|
209
|
+
# \[ti]/.gemstash/config.yml
|
210
|
+
---
|
211
|
+
:bind: tcp://0.0.0.0:4242
|
212
|
+
.EE
|
213
|
+
.PP
|
214
|
+
This maps directly to the Puma bind
|
215
|
+
flag (https://github.com/puma/puma#binding-tcp--sockets), and will
|
216
|
+
support anything valid for that flag.
|
217
|
+
.PP
|
218
|
+
The number of threads Puma uses is also customizable via the
|
219
|
+
\f[CR]:puma_threads\f[R] configuration key.
|
220
|
+
The default is \f[CR]16\f[R].
|
221
|
+
.SS Protected Fetch
|
222
|
+
Gemstash by default allows unauthenticated access for private gems.
|
223
|
+
Authenticated access is available via the \f[CR]:protected_fetch\f[R]
|
224
|
+
configuration key.
|
225
|
+
.IP
|
226
|
+
.EX
|
227
|
+
# \[ti]/.gemstash/config.yml
|
228
|
+
---
|
229
|
+
:protected_fetch: true
|
230
|
+
.EE
|
231
|
+
.PP
|
232
|
+
More details on protected_fetch are here.
|
233
|
+
.SS Fetch Timeout
|
234
|
+
The default fetch timeout is 20 seconds.
|
235
|
+
Use the \f[CR]:fetch_timeout\f[R] configuration key to change it.
|
236
|
+
.IP
|
237
|
+
.EX
|
238
|
+
---
|
239
|
+
:fetch_timeout: 20
|
240
|
+
.EE
|
241
|
+
.SS Config File Location
|
242
|
+
By default, configuration for Gemstash will be at
|
243
|
+
\f[CR]\[ti]/.gemstash/config.yml\f[R].
|
244
|
+
This can be changed by providing the \f[CR]--config-file\f[R] option to
|
245
|
+
the various Gemstash commands:
|
246
|
+
.IP
|
247
|
+
.EX
|
248
|
+
$ gemstash setup --config-file ./gemstash-config.yml
|
249
|
+
$ gemstash authorize --config-file ./gemstash-config.yml
|
250
|
+
$ gemstash start --config-file ./gemstash-config.yml
|
251
|
+
$ gemstash stop --config-file ./gemstash-config.yml
|
252
|
+
$ gemstash status --config-file ./gemstash-config.yml
|
253
|
+
.EE
|
254
|
+
.PP
|
255
|
+
When providing \f[CR]--config-file\f[R] to \f[CR]gemstash setup\f[R],
|
256
|
+
the provided file will be output to with the provided configuration.
|
257
|
+
\f[B]This will overwrite\f[R] any existing configuration.
|
258
|
+
If the file doesn\[cq]t exist when providing \f[CR]--config-file\f[R] to
|
259
|
+
\f[CR]gemstash start\f[R], \f[CR]gemstash stop\f[R],
|
260
|
+
\f[CR]gemstash status\f[R], and \f[CR]gemstash authorize\f[R], the
|
261
|
+
default configuration will be used.
|
262
|
+
.SS ERB parsed config
|
263
|
+
You may also create a \f[CR]\[ti]/.gemstash/config.yml.erb\f[R] file.
|
264
|
+
If present, this will be used instead of
|
265
|
+
\f[CR]\[ti]/.gemstash/config.yml\f[R].
|
266
|
+
For example, with this you can use environment variables in the config:
|
267
|
+
.IP
|
268
|
+
.EX
|
269
|
+
# \[ti]/.gemstash/config.yml.erb
|
270
|
+
---
|
271
|
+
:db_adapter: postgres
|
272
|
+
:db_url: <%= ENV[\[dq]DATABASE_URL\[dq]] %>
|
273
|
+
.EE
|
@@ -0,0 +1,184 @@
|
|
1
|
+
4mgemstash-customize24m(7) 4mgemstash-customize24m(7)
|
2
|
+
|
3
|
+
<!-- Automatically generated by Pandoc -->
|
4
|
+
|
5
|
+
1mCustomizing the Server0m
|
6
|
+
Although Gemstash is designed for as minimal setup as possible, there
|
7
|
+
may be times you will want to change some of the default configuration.
|
8
|
+
By the end of this guide, you will be able to customize some of the
|
9
|
+
Gemstash behavior, including where files are stored, what database Gem-
|
10
|
+
stash uses, and how Gemstash caches certain requests.
|
11
|
+
|
12
|
+
1mSetup0m
|
13
|
+
Several customizable options are available via an interactive Gemstash
|
14
|
+
command. Run gemstash setup and answer the questions it provides (a
|
15
|
+
blank answer will use the default value):
|
16
|
+
|
17
|
+
$ gemstash setup
|
18
|
+
Where should files go? [~/.gemstash]
|
19
|
+
Cache with what? [MEMORY, memcached] 1mmemcached0m
|
20
|
+
What is the comma separated Memcached servers? [local-
|
21
|
+
host:11211]
|
22
|
+
What database adapter? [SQLITE3, postgres, mysql, mysql2] 1mpost-0m
|
23
|
+
1mgres0m
|
24
|
+
Where is the database? [postgres:///gemstash]
|
25
|
+
Checking that the cache is available
|
26
|
+
Checking that the database is available
|
27
|
+
The database is not available
|
28
|
+
Once you've answered the questions, some checks will be made to ensure
|
29
|
+
the configuration will work. For example, the database didn't exist in
|
30
|
+
the previous example, so the command failed and the configuration
|
31
|
+
wasn't saved. If the command passes, you may provide the --redo option
|
32
|
+
to force configuration to be redone:
|
33
|
+
|
34
|
+
$ gemstash setup --redo
|
35
|
+
Where should files go? [~/.gemstash]
|
36
|
+
Cache with what? [MEMORY, memcached] 1mmemcached0m
|
37
|
+
What is the comma separated Memcached servers? [local-
|
38
|
+
host:11211]
|
39
|
+
What database adapter? [SQLITE3, postgres, mysql, mysql2]
|
40
|
+
Checking that the cache is available
|
41
|
+
Checking that the database is available
|
42
|
+
You are all setup!
|
43
|
+
Once all checks have passed, Gemstash will store your answers in the
|
44
|
+
configuration file located at ~/.gemstash/config.yml.
|
45
|
+
|
46
|
+
1mFiles0m
|
47
|
+
Storage in Gemstash defaults to ~/.gemstash unless otherwise specified.
|
48
|
+
You can change this in your config file via the :base_path key:
|
49
|
+
|
50
|
+
# ~/.gemstash/config.yml
|
51
|
+
---
|
52
|
+
:base_path: "/var/gemstash"
|
53
|
+
|
54
|
+
When customizing the base_path, the directory must exist, otherwise
|
55
|
+
Gemstash will fail to run. Thus, if you want to use /var/gemstash like
|
56
|
+
in the previous example, make sure to mkdir /var/gemstash and grant ac-
|
57
|
+
cess to the directory for the user you run Gemstash with.
|
58
|
+
|
59
|
+
1mDatabase0m
|
60
|
+
The :db_adapter configuration key specifies what database you will be
|
61
|
+
using. The default :db_adapter is sqlite3 (https://www.sqlite.org/),
|
62
|
+
which will use a database file located within your :base_path. The
|
63
|
+
database file will always be named gemstash.db.
|
64
|
+
|
65
|
+
You may also use postgres (http://www.postgresql.org/), mysql
|
66
|
+
(http://www.mysql.com/), or mysql2 (http://sequel.jeremye-
|
67
|
+
vans.net/rdoc/files/doc/opening_databases_rdoc.html#label-mysql2) for
|
68
|
+
your :db_adapter. When using any of these options, you need to specify
|
69
|
+
the :db_url to point to an existing database. Here is an example con-
|
70
|
+
figuration to use the postgres adapter:
|
71
|
+
|
72
|
+
# ~/.gemstash/config.yml
|
73
|
+
---
|
74
|
+
:db_adapter: postgres
|
75
|
+
:db_url: postgres:///gemstash
|
76
|
+
:db_connection_options: # Sequel.connect options
|
77
|
+
:connect_timeout: 10
|
78
|
+
:read_timeout: 5
|
79
|
+
:timeout: 30
|
80
|
+
|
81
|
+
Regardless of the adapter you choose, the database will automatically
|
82
|
+
migrate to your version of Gemstash whenever the database is needed.
|
83
|
+
You only need to ensure the database exists and Gemstash will do the
|
84
|
+
rest, except for sqlite3 (for which Gemstash will also create the data-
|
85
|
+
base for you).
|
86
|
+
|
87
|
+
1mCache0m
|
88
|
+
Certain things (like dependencies) are cached in memory. This avoids
|
89
|
+
web calls to the gem source, and database calls for private gems.
|
90
|
+
|
91
|
+
# ~/.gemstash/config.yml
|
92
|
+
---
|
93
|
+
:cache_type: memory
|
94
|
+
:cache_max_size: 2000
|
95
|
+
|
96
|
+
This configuration uses the default memory cache, and has increased the
|
97
|
+
cache_max_size setting from its default of 500 items.
|
98
|
+
|
99
|
+
The memory cache can optionally be swapped out with a Memcached
|
100
|
+
(http://memcached.org/) server (or cluster of servers).
|
101
|
+
|
102
|
+
To use Memcached, use the memcached :cache_type configuration.
|
103
|
+
|
104
|
+
Provide the servers as a comma-separated list to the :memcached_servers
|
105
|
+
configuration key:
|
106
|
+
|
107
|
+
# ~/.gemstash/config.yml
|
108
|
+
---
|
109
|
+
:cache_type: memcached
|
110
|
+
:memcached_servers: memcached1.local:11211,memcached2.local:11211
|
111
|
+
:cache_expiration: 1800
|
112
|
+
|
113
|
+
All caching expires in cache_expiration number of seconds. Default is
|
114
|
+
1800 seconds (30 minutes). This option applies to all caching.
|
115
|
+
|
116
|
+
1mServer0m
|
117
|
+
Gemstash uses Puma (http://puma.io/) and Rack (http://rack.github.io/)
|
118
|
+
as the server. Alternate server configurations are not currently sup-
|
119
|
+
ported, but you can take a look at the Puma configuration
|
120
|
+
(https://github.com/rubygems/gemstash/blob/master/lib/gemstash/puma.rb)
|
121
|
+
and the rackup file (https://github.com/rubygems/gemstash/blob/mas-
|
122
|
+
ter/lib/gemstash/config.ru) for inspiration.
|
123
|
+
|
124
|
+
While the server is not customizable, the way Gemstash binds the port
|
125
|
+
can be changed. To change the binding, update the :bind configuration
|
126
|
+
key:
|
127
|
+
|
128
|
+
# ~/.gemstash/config.yml
|
129
|
+
---
|
130
|
+
:bind: tcp://0.0.0.0:4242
|
131
|
+
|
132
|
+
This maps directly to the Puma bind flag
|
133
|
+
(https://github.com/puma/puma#binding-tcp--sockets), and will support
|
134
|
+
anything valid for that flag.
|
135
|
+
|
136
|
+
The number of threads Puma uses is also customizable via the
|
137
|
+
:puma_threads configuration key. The default is 16.
|
138
|
+
|
139
|
+
1mProtected Fetch0m
|
140
|
+
Gemstash by default allows unauthenticated access for private gems.
|
141
|
+
Authenticated access is available via the :protected_fetch configura-
|
142
|
+
tion key.
|
143
|
+
|
144
|
+
# ~/.gemstash/config.yml
|
145
|
+
---
|
146
|
+
:protected_fetch: true
|
147
|
+
|
148
|
+
More details on protected_fetch are here.
|
149
|
+
|
150
|
+
1mFetch Timeout0m
|
151
|
+
The default fetch timeout is 20 seconds. Use the :fetch_timeout con-
|
152
|
+
figuration key to change it.
|
153
|
+
|
154
|
+
---
|
155
|
+
:fetch_timeout: 20
|
156
|
+
|
157
|
+
1mConfig File Location0m
|
158
|
+
By default, configuration for Gemstash will be at ~/.gemstash/con-
|
159
|
+
fig.yml. This can be changed by providing the --config-file option to
|
160
|
+
the various Gemstash commands:
|
161
|
+
|
162
|
+
$ gemstash setup --config-file ./gemstash-config.yml
|
163
|
+
$ gemstash authorize --config-file ./gemstash-config.yml
|
164
|
+
$ gemstash start --config-file ./gemstash-config.yml
|
165
|
+
$ gemstash stop --config-file ./gemstash-config.yml
|
166
|
+
$ gemstash status --config-file ./gemstash-config.yml
|
167
|
+
|
168
|
+
When providing --config-file to gemstash setup, the provided file will
|
169
|
+
be output to with the provided configuration. 1mThis will overwrite 22many
|
170
|
+
existing configuration. If the file doesn't exist when providing
|
171
|
+
--config-file to gemstash start, gemstash stop, gemstash status, and
|
172
|
+
gemstash authorize, the default configuration will be used.
|
173
|
+
|
174
|
+
1mERB parsed config0m
|
175
|
+
You may also create a ~/.gemstash/config.yml.erb file. If present,
|
176
|
+
this will be used instead of ~/.gemstash/config.yml. For example, with
|
177
|
+
this you can use environment variables in the config:
|
178
|
+
|
179
|
+
# ~/.gemstash/config.yml.erb
|
180
|
+
---
|
181
|
+
:db_adapter: postgres
|
182
|
+
:db_url: <%= ENV["DATABASE_URL"] %>
|
183
|
+
|
184
|
+
October 28, 2015 4mgemstash-customize24m(7)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<!-- Automatically generated by Pandoc -->
|
2
|
+
.\" Automatically generated by Pandoc 3.1.8
|
3
|
+
.\"
|
4
|
+
.TH "gemstash-debugging" "7" "October 28, 2015" "" ""
|
5
|
+
.SH Debugging Gemstash
|
6
|
+
If you are finding Gemstash isn\[cq]t behaving as you would expect, you
|
7
|
+
might want to start by looking at the server log.
|
8
|
+
You can find the log at \f[CR]server.log\f[R] within your base
|
9
|
+
directory.
|
10
|
+
By default, this will be at \f[CR]\[ti]/.gemstash/server.log\f[R].
|
11
|
+
.PP
|
12
|
+
You might find it easier to view the log directly in your terminal.
|
13
|
+
If you run Gemstash in non-daemonized form, the log will be output
|
14
|
+
directly to standard out:
|
15
|
+
.IP
|
16
|
+
.EX
|
17
|
+
$ gemstash start --no-daemonize
|
18
|
+
.EE
|
19
|
+
.PP
|
20
|
+
You can also check the status of the server:
|
21
|
+
.IP
|
22
|
+
.EX
|
23
|
+
$ gemstash status
|
24
|
+
.EE
|
25
|
+
.PP
|
26
|
+
The server status is checked by passing through to
|
27
|
+
pumactl (https://github.com/puma/puma#pumactl).
|
28
|
+
.PP
|
29
|
+
If you find a bug, please don\[cq]t hesitate to open a bug
|
30
|
+
report (https://github.com/rubygems/gemstash#contributing)!
|
@@ -0,0 +1,27 @@
|
|
1
|
+
4mgemstash-debugging24m(7) 4mgemstash-debugging24m(7)
|
2
|
+
|
3
|
+
<!-- Automatically generated by Pandoc -->
|
4
|
+
|
5
|
+
1mDebugging Gemstash0m
|
6
|
+
If you are finding Gemstash isn't behaving as you would expect, you
|
7
|
+
might want to start by looking at the server log. You can find the log
|
8
|
+
at server.log within your base directory. By default, this will be at
|
9
|
+
~/.gemstash/server.log.
|
10
|
+
|
11
|
+
You might find it easier to view the log directly in your terminal. If
|
12
|
+
you run Gemstash in non-daemonized form, the log will be output di-
|
13
|
+
rectly to standard out:
|
14
|
+
|
15
|
+
$ gemstash start --no-daemonize
|
16
|
+
|
17
|
+
You can also check the status of the server:
|
18
|
+
|
19
|
+
$ gemstash status
|
20
|
+
|
21
|
+
The server status is checked by passing through to pumactl
|
22
|
+
(https://github.com/puma/puma#pumactl).
|
23
|
+
|
24
|
+
If you find a bug, please don't hesitate to open a bug report
|
25
|
+
(https://github.com/rubygems/gemstash#contributing)!
|
26
|
+
|
27
|
+
October 28, 2015 4mgemstash-debugging24m(7)
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<!-- Automatically generated by Pandoc -->
|
2
|
+
.\" Automatically generated by Pandoc 3.1.8
|
3
|
+
.\"
|
4
|
+
.TH "gemstash-deploy" "7" "October 25, 2015" "" ""
|
5
|
+
.SH Deploying Gemstash
|
6
|
+
Bundler is here for the rescue to keep Gemstash up to date!
|
7
|
+
Create a \f[CR]Gemfile\f[R] pointing to Gemstash:
|
8
|
+
.IP
|
9
|
+
.EX
|
10
|
+
# ./Gemfile
|
11
|
+
source \[dq]https://rubygems.org\[dq]
|
12
|
+
gem \[dq]gemstash\[dq]
|
13
|
+
.EE
|
14
|
+
.PP
|
15
|
+
Then \f[CR]bundle\f[R] to create your \f[CR]Gemfile.lock\f[R].
|
16
|
+
When you are ready to upgrade, simply \f[CR]bundle update\f[R].
|
17
|
+
You may need to run \f[CR]gemstash\f[R] via \f[CR]bundle exec\f[R].
|
18
|
+
Alternatively, you can \f[CR]gem uninstall gemstash\f[R] and
|
19
|
+
\f[CR]gem install gemstash\f[R] when you want to upgrade.
|
20
|
+
.PP
|
21
|
+
Gemstash will automatically run any necessary migrations, so updating
|
22
|
+
the gem is all that needs to be done.
|
23
|
+
.PP
|
24
|
+
It is probably wise to stop Gemstash before upgrading, then starting
|
25
|
+
again once you are done:
|
26
|
+
.IP
|
27
|
+
.EX
|
28
|
+
$ bundle exec gemstash stop
|
29
|
+
$ bundle update
|
30
|
+
$ bundle exec gemstash start
|
31
|
+
.EE
|
32
|
+
.SS Monitoring
|
33
|
+
Health monitoring is built in to Gemstash using the
|
34
|
+
server_health_check-rack (https://github.com/on-site/server_health_check-rack)
|
35
|
+
gem.
|
36
|
+
If you request \f[CR]/health\f[R] from your Gemstash instance, you will
|
37
|
+
get a JSON response along with an HTTP status code indicating success or
|
38
|
+
failure.
|
39
|
+
The JSON response will look something like this for a success case:
|
40
|
+
.IP
|
41
|
+
.EX
|
42
|
+
{
|
43
|
+
\[dq]status\[dq]: {
|
44
|
+
\[dq]heartbeat\[dq]: \[dq]OK\[dq],
|
45
|
+
\[dq]storage_read\[dq]: \[dq]OK\[dq],
|
46
|
+
\[dq]storage_write\[dq]: \[dq]OK\[dq],
|
47
|
+
\[dq]db_read\[dq]: \[dq]OK\[dq],
|
48
|
+
\[dq]db_write\[dq]: \[dq]OK\[dq]
|
49
|
+
}
|
50
|
+
}
|
51
|
+
.EE
|
52
|
+
.PP
|
53
|
+
This request will test storage and database access and report on the
|
54
|
+
result.
|
55
|
+
Each key in the status can be requested alone to just report on that
|
56
|
+
status.
|
57
|
+
For example, if you would like a health check that doesn\[cq]t interact
|
58
|
+
with storage or the database, you can use \f[CR]/health/heartbeat\f[R]
|
59
|
+
which will always respond with a success while your Gemstash server is
|
60
|
+
running.
|
61
|
+
.SS Downgrading
|
62
|
+
It is not recommended to go backwards in Gemstash versions.
|
63
|
+
Migrations may have run that could leave the database in a bad state.
|
@@ -0,0 +1,57 @@
|
|
1
|
+
4mgemstash-deploy24m(7) 4mgemstash-deploy24m(7)
|
2
|
+
|
3
|
+
<!-- Automatically generated by Pandoc -->
|
4
|
+
|
5
|
+
1mDeploying Gemstash0m
|
6
|
+
Bundler is here for the rescue to keep Gemstash up to date! Create a
|
7
|
+
Gemfile pointing to Gemstash:
|
8
|
+
|
9
|
+
# ./Gemfile
|
10
|
+
source "https://rubygems.org"
|
11
|
+
gem "gemstash"
|
12
|
+
|
13
|
+
Then bundle to create your Gemfile.lock. When you are ready to up-
|
14
|
+
grade, simply bundle update. You may need to run gemstash via bundle
|
15
|
+
exec. Alternatively, you can gem uninstall gemstash and gem install
|
16
|
+
gemstash when you want to upgrade.
|
17
|
+
|
18
|
+
Gemstash will automatically run any necessary migrations, so updating
|
19
|
+
the gem is all that needs to be done.
|
20
|
+
|
21
|
+
It is probably wise to stop Gemstash before upgrading, then starting
|
22
|
+
again once you are done:
|
23
|
+
|
24
|
+
$ bundle exec gemstash stop
|
25
|
+
$ bundle update
|
26
|
+
$ bundle exec gemstash start
|
27
|
+
|
28
|
+
1mMonitoring0m
|
29
|
+
Health monitoring is built in to Gemstash using the
|
30
|
+
server_health_check-rack (https://github.com/on-
|
31
|
+
site/server_health_check-rack) gem. If you request /health from your
|
32
|
+
Gemstash instance, you will get a JSON response along with an HTTP sta-
|
33
|
+
tus code indicating success or failure. The JSON response will look
|
34
|
+
something like this for a success case:
|
35
|
+
|
36
|
+
{
|
37
|
+
"status": {
|
38
|
+
"heartbeat": "OK",
|
39
|
+
"storage_read": "OK",
|
40
|
+
"storage_write": "OK",
|
41
|
+
"db_read": "OK",
|
42
|
+
"db_write": "OK"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
This request will test storage and database access and report on the
|
47
|
+
result. Each key in the status can be requested alone to just report
|
48
|
+
on that status. For example, if you would like a health check that
|
49
|
+
doesn't interact with storage or the database, you can use
|
50
|
+
/health/heartbeat which will always respond with a success while your
|
51
|
+
Gemstash server is running.
|
52
|
+
|
53
|
+
1mDowngrading0m
|
54
|
+
It is not recommended to go backwards in Gemstash versions. Migrations
|
55
|
+
may have run that could leave the database in a bad state.
|
56
|
+
|
57
|
+
October 25, 2015 4mgemstash-deploy24m(7)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<!-- Automatically generated by Pandoc -->
|
2
|
+
.\" Automatically generated by Pandoc 3.1.8
|
3
|
+
.\"
|
4
|
+
.TH "gemstash-mirror" "7" "October 25, 2015" "" ""
|
5
|
+
.SH Using Gemstash as a Mirror
|
6
|
+
If you don\[cq]t have control over your \f[CR]Gemfile\f[R], or you
|
7
|
+
don\[cq]t want to force everyone on your team to go through the Gemstash
|
8
|
+
server, you can use Bundler mirroring to bundle against your Gemstash
|
9
|
+
server.
|
10
|
+
.PP
|
11
|
+
For each source in your \f[CR]Gemfile\f[R], add a mirror pointing to
|
12
|
+
your Gemstash server:
|
13
|
+
.IP
|
14
|
+
.EX
|
15
|
+
$ bundle config mirror.http://rubygems.org http://localhost:9292
|
16
|
+
$ bundle config mirror.https://my.gem-source.local http://localhost:9292/upstream/$(ruby -rcgi -e \[aq]puts CGI.escape(\[dq]https://my.gem-source.local\[dq])\[aq])
|
17
|
+
.EE
|
18
|
+
.PP
|
19
|
+
From now on, bundler will fetch gems from those sources via your
|
20
|
+
Gemstash server.
|
21
|
+
.SH Simpler Gemstash Mirrors
|
22
|
+
\f[B]This feature requires Bundler to be at least version
|
23
|
+
\f[CB]1.11.0\f[B].\f[R]
|
24
|
+
.PP
|
25
|
+
If you are using Bundler version \f[CR]1.11.0\f[R] or greater, the
|
26
|
+
mirroring becomes a bit easier:
|
27
|
+
.IP
|
28
|
+
.EX
|
29
|
+
$ bundle config mirror.http://rubygems.org http://localhost:9292
|
30
|
+
$ bundle config mirror.https://my.gem-source.local http://localhost:9292
|
31
|
+
.EE
|
32
|
+
.PP
|
33
|
+
Bundler will then send headers to Gemstash to indicate the correct
|
34
|
+
upstream.
|