gemstash 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -0
  3. data/lib/gemstash.rb +0 -1
  4. data/lib/gemstash/authorization.rb +1 -5
  5. data/lib/gemstash/cli.rb +4 -4
  6. data/lib/gemstash/cli/authorize.rb +4 -2
  7. data/lib/gemstash/cli/base.rb +5 -4
  8. data/lib/gemstash/cli/setup.rb +2 -2
  9. data/lib/gemstash/cli/status.rb +1 -1
  10. data/lib/gemstash/cli/stop.rb +1 -1
  11. data/lib/gemstash/configuration.rb +3 -2
  12. data/lib/gemstash/gem_pusher.rb +7 -0
  13. data/lib/gemstash/gem_source/private_source.rb +0 -4
  14. data/lib/gemstash/gem_source/upstream_source.rb +0 -4
  15. data/lib/gemstash/health.rb +3 -3
  16. data/lib/gemstash/logging.rb +2 -4
  17. data/lib/gemstash/man/gemstash-authorize.1.txt +53 -33
  18. data/lib/gemstash/man/gemstash-configuration.5.txt +10 -141
  19. data/lib/gemstash/man/gemstash-customize.7.txt +66 -175
  20. data/lib/gemstash/man/gemstash-debugging.7.txt +54 -17
  21. data/lib/gemstash/man/gemstash-deploy.7.txt +51 -44
  22. data/lib/gemstash/man/gemstash-mirror.7.txt +53 -20
  23. data/lib/gemstash/man/gemstash-multiple-sources.7.txt +48 -53
  24. data/lib/gemstash/man/gemstash-private-gems.7.txt +15 -117
  25. data/lib/gemstash/man/gemstash-readme.7.txt +10 -126
  26. data/lib/gemstash/man/gemstash-setup.1.txt +54 -28
  27. data/lib/gemstash/man/gemstash-start.1.txt +56 -16
  28. data/lib/gemstash/man/gemstash-status.1.txt +57 -13
  29. data/lib/gemstash/man/gemstash-stop.1.txt +57 -13
  30. data/lib/gemstash/man/gemstash-version.1.txt +57 -12
  31. data/lib/gemstash/migrations/01_gem_dependencies.rb +2 -2
  32. data/lib/gemstash/migrations/03_cached_gems.rb +1 -1
  33. data/lib/gemstash/migrations/04_health_tests.rb +8 -0
  34. data/lib/gemstash/puma.rb +1 -1
  35. data/lib/gemstash/storage.rb +1 -0
  36. data/lib/gemstash/upstream.rb +2 -2
  37. data/lib/gemstash/version.rb +1 -1
  38. data/lib/gemstash/web.rb +5 -4
  39. metadata +20 -28
  40. data/lib/gemstash/gem_unyanker.rb +0 -67
  41. data/lib/gemstash/man/gemstash-authorize.1 +0 -51
  42. data/lib/gemstash/man/gemstash-configuration.5 +0 -215
  43. data/lib/gemstash/man/gemstash-customize.7 +0 -280
  44. data/lib/gemstash/man/gemstash-debugging.7 +0 -34
  45. data/lib/gemstash/man/gemstash-deploy.7 +0 -72
  46. data/lib/gemstash/man/gemstash-mirror.7 +0 -40
  47. data/lib/gemstash/man/gemstash-multiple-sources.7 +0 -89
  48. data/lib/gemstash/man/gemstash-private-gems.7 +0 -244
  49. data/lib/gemstash/man/gemstash-readme.7 +0 -234
  50. data/lib/gemstash/man/gemstash-setup.1 +0 -43
  51. data/lib/gemstash/man/gemstash-start.1 +0 -26
  52. data/lib/gemstash/man/gemstash-status.1 +0 -20
  53. data/lib/gemstash/man/gemstash-stop.1 +0 -20
  54. data/lib/gemstash/man/gemstash-version.1 +0 -22
@@ -1,175 +1,66 @@
1
- gemstash-customize(7) gemstash-customize(7)
2
-
3
-
4
-
5
- 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 Gem-
10
- stash uses, and how Gemstash caches certain requests.
11
-
12
- SETUP
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
- $ gemstash setup
17
- Where should files go? [~/.gemstash]
18
- Cache with what? [MEMORY, memcached] memcached
19
- What is the comma separated Memcached servers? [local-
20
- host:11211]
21
- What database adapter? [SQLITE3, postgres, mysql, mysql2] post-
22
- gres
23
- Where is the database? [postgres:///gemstash]
24
- Checking that the cache is available
25
- Checking that the database is available
26
- The database is not available
27
-
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
- $ gemstash setup --redo
34
- Where should files go? [~/.gemstash]
35
- Cache with what? [MEMORY, memcached] memcached
36
- What is the comma separated Memcached servers? [local-
37
- host:11211]
38
- What database adapter? [SQLITE3, postgres, mysql, mysql2]
39
- Checking that the cache is available
40
- Checking that the database is available
41
- You are all setup!
42
-
43
- Once all checks have passed, Gemstash will store your answers in the
44
- configuration file located at ~/.gemstash/config.yml.
45
-
46
- FILES
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
- DATABASE
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
- CACHE
88
- Certain things (like dependencies) are cached in memory. This avoids
89
- web calls to the gem source, and database calls for private gems. The
90
- memory cache can optionally be swapped out with a Memcached
91
- (http://memcached.org/) server (or cluster of servers). To use Mem-
92
- cached, you must update the :cache_type configuration key to be mem-
93
- cached, and provide the servers via the :memcached_servers configura-
94
- tion key:
95
-
96
- # ~/.gemstash/config.yml
97
- ---
98
- :cache_type: memcached
99
- :memcached_servers: memcached1.local:11211,memcached2.local:11211
100
-
101
- Note that the :memcached_servers requires a comma separated list of
102
- servers. All caching lasts for 30 minutes.
103
-
104
- SERVER
105
- Gemstash uses Puma (http://puma.io/) and Rack (http://rack.github.io/)
106
- as the server. Alternate server configurations are not currently sup-
107
- ported, but you can take a look at the Puma configuration
108
- (https://github.com/bundler/gemstash/blob/master/lib/gemstash/puma.rb)
109
- and the rackup file (https://github.com/bundler/gemstash/blob/mas-
110
- ter/lib/gemstash/config.ru) for inspiration.
111
-
112
- While the server is not customizable, the way Gemstash binds the port
113
- can be changed. To change the binding, update the :bind configuration
114
- key:
115
-
116
- # ~/.gemstash/config.yml
117
- ---
118
- :bind: tcp://0.0.0.0:4242
119
-
120
- This maps directly to the Puma bind flag
121
- (https://github.com/puma/puma#binding-tcp--sockets), and will support
122
- anything valid for that flag.
123
-
124
- The number of threads Puma uses is also customizable via the
125
- :puma_threads configuration key. The default is 16.
126
-
127
- PROTECTED FETCH
128
- Gemstash by default allows unauthenticated access for private gems.
129
- Authenticated access is available via the :protected_fetch configura-
130
- tion key.
131
-
132
- # ~/.gemstash/config.yml
133
- ---
134
- :protected_fetch: true
135
-
136
- More details on protected_fetch are here (gemstash help private-
137
- gems.7).
138
-
139
- FETCH TIMEOUT
140
- The default fetch timeout is 20 seconds. Use the :fetch_timeout con-
141
- figuration key to change it.
142
-
143
- ---
144
- :fetch_timeout: 20
145
-
146
- CONFIG FILE LOCATION
147
- By default, configuration for Gemstash will be at ~/.gemstash/con-
148
- fig.yml. This can be changed by providing the --config-file option to
149
- the various Gemstash commands:
150
-
151
- $ gemstash setup --config-file ./gemstash-config.yml
152
- $ gemstash authorize --config-file ./gemstash-config.yml
153
- $ gemstash start --config-file ./gemstash-config.yml
154
- $ gemstash stop --config-file ./gemstash-config.yml
155
- $ gemstash status --config-file ./gemstash-config.yml
156
-
157
- When providing --config-file to gemstash setup, the provided file will
158
- be output to with the provided configuration. This will overwrite any
159
- existing configuration. If the file doesn't exist when providing
160
- --config-file to gemstash start, gemstash stop, gemstash status, and
161
- gemstash authorize, the default configuration will be used.
162
-
163
- ERB PARSED CONFIG
164
- You may also create a ~/.gemstash/config.yml.erb file. If present,
165
- this will be used instead of ~/.gemstash/config.yml. For example, with
166
- this you can use environment variables in the config:
167
-
168
- # ~/.gemstash/config.yml.erb
169
- ---
170
- :db_adapter: postgres
171
- :db_url: <%= ENV["DATABASE_URL"] %>
172
-
173
-
174
-
175
- October 28, 2015 gemstash-customize(7)
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
@@ -1,29 +1,66 @@
1
- gemstash-debugging(7) gemstash-debugging(7)
2
1
 
3
2
 
4
3
 
5
- DEBUGGING GEMSTASH
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
4
 
11
- You might find it easier to view the log directly in your terminal. If
12
- you run Gemstash in non-daemonized form (gemstash help start.1), the
13
- log will be output directly to standard out:
14
5
 
15
- $ gemstash start --no-daemonize
16
6
 
17
- You can also check the status (gemstash help status.1) of the server:
18
7
 
19
- $ gemstash status
20
8
 
21
- The server status is checked by passing through to pumactl
22
- (https://github.com/puma/puma#pumactl).
23
9
 
24
- If you find a bug, please don't hesitate to open a bug report
25
- (https://github.com/bundler/gemstash#contributing)!
26
10
 
27
11
 
28
12
 
29
- October 28, 2015 gemstash-debugging(7)
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
@@ -1,59 +1,66 @@
1
- gemstash-deploy(7) gemstash-deploy(7)
2
1
 
3
2
 
4
3
 
5
- DEPLOYING GEMSTASH
6
- Bundler is here for the rescue to keep Gemstash up to date! Create a
7
- Gemfile pointing to Gemstash:
8
4
 
9
- # ./Gemfile
10
- source "https://rubygems.org"
11
- gem "gemstash"
12
5
 
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 bun-
15
- dle exec. Alternatively, you can gem uninstall gemstash and gem in-
16
- stall gemstash when you want to upgrade.
17
6
 
18
- Gemstash will automatically run any necessary migrations, so updating
19
- the gem is all that needs to be done.
20
7
 
21
- It is probably wise to stop Gemstash before upgrading, then starting
22
- again once you are done:
23
8
 
24
- $ bundle exec gemstash stop
25
- $ bundle update
26
- $ bundle exec gemstash start
27
9
 
28
- MONITORING
29
- Health monitoring is built in to Gemstash using the serv-
30
- er_health_check-rack (https://github.com/on-site/server_health_check-
31
- rack) gem. If you request /health from your Gemstash instance, you
32
- will get a JSON response along with an HTTP status code indicating suc-
33
- cess or failure. The JSON response will look something like this for a
34
- success case:
35
10
 
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
11
 
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
12
 
53
- DOWNGRADING
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
13
 
57
14
 
58
15
 
59
- October 25, 2015 gemstash-deploy(7)
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
@@ -1,33 +1,66 @@
1
- gemstash-mirror(7) gemstash-mirror(7)
2
1
 
3
2
 
4
3
 
5
- USING GEMSTASH AS A MIRROR
6
- If you don't have control over your Gemfile, or you don't want to force
7
- everyone on your team to go through the Gemstash server, you can use
8
- Bundler mirroring to bundle against your Gemstash server.
9
4
 
10
- For each source in your Gemfile, add a mirror pointing to your Gemstash
11
- server:
12
5
 
13
- $ bundle config mirror.http://rubygems.org http://localhost:9292
14
- $ bundle config mirror.https://my.gem-source.local http://localhost:9292/upstream/$(ruby -rcgi -e 'puts CGI.escape("https://my.gem-source.local")')
15
6
 
16
- From now on, bundler will fetch gems from those sources via your Gem-
17
- stash server.
18
7
 
19
- SIMPLER GEMSTASH MIRRORS
20
- This feature requires Bundler to be at least version 1.11.0.
21
8
 
22
- If you are using Bundler version 1.11.0 or greater, the mirroring be-
23
- comes a bit easier:
24
9
 
25
- $ bundle config mirror.http://rubygems.org http://localhost:9292
26
- $ bundle config mirror.https://my.gem-source.local http://localhost:9292
27
10
 
28
- Bundler will then send headers to Gemstash to indicate the correct up-
29
- stream.
30
11
 
31
12
 
32
13
 
33
- October 25, 2015 gemstash-mirror(7)
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+