kpm 0.7.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +138 -0
  4. data/Gemfile +2 -0
  5. data/README.adoc +144 -107
  6. data/Rakefile +2 -1
  7. data/bin/kpm +4 -2
  8. data/kpm.gemspec +11 -8
  9. data/lib/kpm.rb +3 -0
  10. data/lib/kpm/account.rb +268 -338
  11. data/lib/kpm/base_artifact.rb +33 -39
  12. data/lib/kpm/base_installer.rb +69 -83
  13. data/lib/kpm/blob.rb +29 -0
  14. data/lib/kpm/cli.rb +3 -1
  15. data/lib/kpm/coordinates.rb +10 -12
  16. data/lib/kpm/database.rb +94 -113
  17. data/lib/kpm/diagnostic_file.rb +126 -147
  18. data/lib/kpm/formatter.rb +76 -48
  19. data/lib/kpm/inspector.rb +24 -34
  20. data/lib/kpm/installer.rb +53 -46
  21. data/lib/kpm/kaui_artifact.rb +4 -3
  22. data/lib/kpm/killbill_plugin_artifact.rb +10 -7
  23. data/lib/kpm/killbill_server_artifact.rb +13 -12
  24. data/lib/kpm/migrations.rb +26 -11
  25. data/lib/kpm/nexus_helper/actions.rb +52 -9
  26. data/lib/kpm/nexus_helper/cloudsmith_api_calls.rb +83 -0
  27. data/lib/kpm/nexus_helper/github_api_calls.rb +70 -0
  28. data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +130 -108
  29. data/lib/kpm/nexus_helper/nexus_facade.rb +5 -3
  30. data/lib/kpm/plugins_directory.rb +9 -8
  31. data/lib/kpm/plugins_directory.yml +14 -173
  32. data/lib/kpm/plugins_manager.rb +29 -24
  33. data/lib/kpm/sha1_checker.rb +31 -18
  34. data/lib/kpm/system.rb +104 -135
  35. data/lib/kpm/system_helpers/cpu_information.rb +56 -55
  36. data/lib/kpm/system_helpers/disk_space_information.rb +60 -63
  37. data/lib/kpm/system_helpers/entropy_available.rb +37 -39
  38. data/lib/kpm/system_helpers/memory_information.rb +52 -51
  39. data/lib/kpm/system_helpers/os_information.rb +45 -47
  40. data/lib/kpm/system_helpers/system_proxy.rb +10 -10
  41. data/lib/kpm/tasks.rb +381 -438
  42. data/lib/kpm/tenant_config.rb +68 -83
  43. data/lib/kpm/tomcat_manager.rb +10 -8
  44. data/lib/kpm/trace_logger.rb +18 -16
  45. data/lib/kpm/uninstaller.rb +81 -14
  46. data/lib/kpm/utils.rb +13 -14
  47. data/lib/kpm/version.rb +3 -1
  48. data/packaging/Gemfile +2 -0
  49. data/pom.xml +211 -40
  50. data/spec/kpm/remote/base_artifact_spec.rb +20 -20
  51. data/spec/kpm/remote/base_installer_spec.rb +35 -34
  52. data/spec/kpm/remote/cloudsmith_api_calls_spec.rb +40 -0
  53. data/spec/kpm/remote/github_api_calls_spec.rb +40 -0
  54. data/spec/kpm/remote/installer_spec.rb +80 -79
  55. data/spec/kpm/remote/kaui_artifact_spec.rb +7 -6
  56. data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +25 -30
  57. data/spec/kpm/remote/killbill_server_artifact_spec.rb +17 -16
  58. data/spec/kpm/remote/migrations_spec.rb +12 -11
  59. data/spec/kpm/remote/nexus_facade_spec.rb +32 -28
  60. data/spec/kpm/remote/tenant_config_spec.rb +30 -29
  61. data/spec/kpm/remote/tomcat_manager_spec.rb +4 -3
  62. data/spec/kpm/unit/actions_spec.rb +52 -0
  63. data/spec/kpm/unit/base_artifact_spec.rb +19 -18
  64. data/spec/kpm/unit/cpu_information_spec.rb +67 -0
  65. data/spec/kpm/unit/disk_space_information_spec.rb +47 -0
  66. data/spec/kpm/unit/entropy_information_spec.rb +36 -0
  67. data/spec/kpm/unit/formatter_spec.rb +163 -0
  68. data/spec/kpm/unit/inspector_spec.rb +34 -42
  69. data/spec/kpm/unit/installer_spec.rb +7 -6
  70. data/spec/kpm/unit/memory_information_spec.rb +102 -0
  71. data/spec/kpm/unit/os_information_spec.rb +38 -0
  72. data/spec/kpm/unit/plugins_directory_spec.rb +38 -22
  73. data/spec/kpm/unit/plugins_manager_spec.rb +62 -66
  74. data/spec/kpm/unit/sha1_checker_spec.rb +107 -60
  75. data/spec/kpm/unit/uninstaller_spec.rb +118 -72
  76. data/spec/kpm/unit_mysql/account_spec.rb +127 -142
  77. data/spec/spec_helper.rb +20 -18
  78. data/tasks/package.rake +18 -18
  79. metadata +42 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c651b2089fe9f33b3484e82dcdb4471980b6f4ad
4
- data.tar.gz: 8c746fc62e9332919f0082ffd25b96d450a91d64
2
+ SHA256:
3
+ metadata.gz: ee0a0c6bd9401fa083710541772db690618749d31ea65a6531aee02bfcbc075b
4
+ data.tar.gz: b46b7a3777be07cd3b6ca5be05ef5c76504e4c8ca7e54938487c42b017b251c7
5
5
  SHA512:
6
- metadata.gz: c0da2ef993caf070b2aaa3840e75220c1c9f26f4490bd3a2f5a3c4ca309de9a431e7198600733c2db317e2e2bff557438c447a753ddabc6f08f0c98f21ca4a09
7
- data.tar.gz: 859900d8b192dd29cdd7f0ecd925b527654e397baac2c0771e7c145876da58ef03ea0508cc4ac5b3fb3595e1017d7820e0203487e28dfbb13aaf1b17c7de05ad
6
+ metadata.gz: f1d274c79ad9762432a649c144d32f4365cc93ab57f841a58293c666d432895056872882b1edee2b1e6493e83a5f27d719825f490f8ca594188c906665253cf4
7
+ data.tar.gz: 9fbe10b774582a2bf60f534b134d1180109efcd18ff8dc6cc901de74a4e9ee1ee8e11416c5848cee4a7658b3703c67d2c93c590804ec9a25500e9902a7f6189d
data/.gitignore CHANGED
@@ -7,3 +7,5 @@ kpm-*-linux-x86_64.tar.gz
7
7
  kpm-*-osx.tar.gz
8
8
  traveling-ruby-*.tar.gz
9
9
  *.asc
10
+ .rakeTasks
11
+ pom.xml.versionsBackup
data/.rubocop.yml ADDED
@@ -0,0 +1,138 @@
1
+ # RuboCop 0.69.0 dropped support for 2.2
2
+ #AllCops:
3
+ # TargetRubyVersion: 2.2
4
+ Gemspec/RequiredRubyVersion:
5
+ Enabled: false
6
+
7
+ Layout/LineLength:
8
+ Enabled: false
9
+
10
+ Layout/EmptyLinesAroundAttributeAccessor:
11
+ Enabled: true
12
+
13
+ Layout/SpaceAroundMethodCallOperator:
14
+ Enabled: true
15
+
16
+ # Alternative?
17
+ Gemspec/RubyVersionGlobalsUsage:
18
+ Enabled: false
19
+
20
+ Layout/DefEndAlignment:
21
+ AutoCorrect: true
22
+
23
+ Lint/DeprecatedOpenSSLConstant:
24
+ Enabled: true
25
+
26
+ Lint/DuplicateElsifCondition:
27
+ Enabled: true
28
+
29
+ Lint/MixedRegexpCaptureTypes:
30
+ Enabled: true
31
+
32
+ Lint/RaiseException:
33
+ Enabled: true
34
+
35
+ Lint/StructNewOverride:
36
+ Enabled: true
37
+
38
+ Lint/SuppressedException:
39
+ AllowComments: true
40
+
41
+ Metrics/AbcSize:
42
+ Enabled: false
43
+
44
+ Metrics/BlockLength:
45
+ Enabled: false
46
+
47
+ Metrics/BlockNesting:
48
+ Enabled: false
49
+
50
+ Metrics/ClassLength:
51
+ Enabled: false
52
+
53
+ Metrics/CyclomaticComplexity:
54
+ Enabled: false
55
+
56
+ Metrics/MethodLength:
57
+ Enabled: false
58
+
59
+ Metrics/ModuleLength:
60
+ Enabled: false
61
+
62
+ Metrics/ParameterLists:
63
+ Enabled: false
64
+
65
+ Metrics/PerceivedComplexity:
66
+ Enabled: false
67
+
68
+ Security/YAMLLoad:
69
+ Enabled: false
70
+
71
+ Style/Documentation:
72
+ Enabled: false
73
+
74
+ Style/EmptyElse:
75
+ EnforcedStyle: empty
76
+
77
+ # We must support old Rubies
78
+ Style/HashSyntax:
79
+ Enabled: false
80
+
81
+ # Ruby 2.3+ only
82
+ Style/NumericPredicate:
83
+ Enabled: false
84
+
85
+ # Ruby 2.3+ only
86
+ Style/SafeNavigation:
87
+ Enabled: false
88
+
89
+ Style/GuardClause:
90
+ Enabled: false
91
+
92
+ Style/AccessorGrouping:
93
+ Enabled: true
94
+
95
+ Style/ArrayCoercion:
96
+ Enabled: true
97
+
98
+ Style/BisectedAttrAccessor:
99
+ Enabled: true
100
+
101
+ Style/CaseLikeIf:
102
+ Enabled: true
103
+
104
+ Style/ExponentialNotation:
105
+ Enabled: true
106
+
107
+ Style/HashAsLastArrayItem:
108
+ Enabled: true
109
+
110
+ Style/HashEachMethods:
111
+ Enabled: true
112
+
113
+ Style/HashLikeCase:
114
+ Enabled: true
115
+
116
+ Style/HashTransformKeys:
117
+ Enabled: true
118
+
119
+ Style/HashTransformValues:
120
+ Enabled: true
121
+
122
+ Style/RedundantAssignment:
123
+ Enabled: true
124
+
125
+ Style/RedundantFetchBlock:
126
+ Enabled: true
127
+
128
+ Style/RedundantFileExtensionInRequire:
129
+ Enabled: true
130
+
131
+ Style/RedundantRegexpCharacterClass:
132
+ Enabled: true
133
+
134
+ Style/RedundantRegexpEscape:
135
+ Enabled: true
136
+
137
+ Style/SlicingWithRange:
138
+ Enabled: true
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/README.adoc CHANGED
@@ -3,65 +3,50 @@
3
3
  :toclevels: 9
4
4
 
5
5
  [[kpm-the-kill-bill-package-manager]]
6
- # KPM: the Kill Bill Package Manager
6
+ = KPM: the Kill Bill Package Manager
7
7
 
8
- The goal of KPM is to facilitate the installation of Kill Bill, its plugins and Kaui.
9
-
10
- kpm can be used interactively to search and download individual artifacts (Kill Bill war, plugins, etc.) or to perform an automatic Kill Bill installation using a configuration file.
8
+ KPM is a command line utility which facilitates the installation of Kill Bill, its plugins and Kaui. It also provides utility helpers useful for the day-to-day management of a production system.
11
9
 
12
10
  toc::[]
13
11
 
14
- [[installation]]
15
- ## Installation
12
+ [[kpm-installation]]
13
+ == KPM Installation
16
14
 
17
- [[pre-built-binaries-recommended-linux-and-macos-only]]
18
- ### Pre-built binaries (recommended, Linux and MacOS only)
15
+ [[pre-built-binaries-recommended]]
16
+ === Pre-built binaries (recommended)
17
+ image:https://img.shields.io/maven-central/v/org.kill-bill.billing.installer/kpm?color=blue&label=kpm[kpm]
19
18
 
20
- Note that this installation method assumes `/bin/bash` to be available on your system.
19
+ On Linux and MacOS, you can use the pre-built binaries. KPM self-contained builds are available on http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.kill-bill.billing.installer%22%20AND%20a%3A%22kpm%22[Maven Central] with coordinates `org.kill-bill.billing.installer:kpm`.
21
20
 
22
- KPM builds are available on http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.kill-bill.billing.installer%22%20AND%20a%3A%22kpm%22[Maven Central] with coordinates `org.kill-bill.billing.installer:kpm`.
21
+ Download the `.tar.gz` package matching your architecture (Linux and MacOS only).
23
22
 
24
- Download the package matching your architecture.
23
+ Note that this installation method assumes `/bin/bash` to be available on your system.
25
24
 
26
25
  [[through-rubygems]]
27
- ### Through Rubygems
28
-
29
- Ruby is required to run KPM itself (it is not a dependency of Kill Bill).
30
-
31
- Ruby 2.1+ or JRuby 1.7.20+ is recommended. If you don’t have a Ruby installation yet, use https://rvm.io/rvm/install[RVM]:
32
-
33
- ....
34
- gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
35
- \curl -sSL https://get.rvm.io | bash -s stable --ruby
36
- ....
26
+ === Through Rubygems
27
+ image:https://img.shields.io/gem/v/kpm?color=blue&label=kpm[kpm]
37
28
 
38
- After following the post-installation instructions, you should have access to the `ruby` and `gem` executables.
29
+ On Windows, you can install KPM via https://rubygems.org/gems/kpm[RubyGems.org]. For this, you need to first install Ruby. Ruby can be installed via https://rubyinstaller.org/[RubyInstaller]. Once installed, you can run the following command to install KPM:
30
+ [source,bash]
31
+ gem install kpm
39
32
 
40
- You can then run:
41
33
 
42
- ....
43
- gem install kpm
44
- ....
45
34
 
46
- [[quick-start]]
47
- ## Quick start
35
+ [[kpm-commands]]
36
+ == KPM Commands
48
37
 
49
- The following commands
38
+ [[kill-bill-installation]]
39
+ === Kill Bill installation
50
40
 
51
- ....
52
- mkdir killbill
53
- cd killbill
54
- kpm install
55
- ....
41
+ [[kpm-install]]
42
+ ==== kpm install
56
43
 
57
- will setup https://github.com/killbill/killbill[Kill Bill] and https://github.com/killbill/killbill-admin-ui-standalone[Kaui], i.e.:
44
+ `kpm install` (with no argument) will setup https://github.com/killbill/killbill[Kill Bill] and https://github.com/killbill/killbill-admin-ui-standalone[Kaui] in your current directory, including:
58
45
 
59
- * http://tomcat.apache.org/[Tomcat] (open-source Java web server) is setup in the `killbill` directory
60
- * The Kill Bill application (war) is installed in the `killbill/webapps` directory
61
- * The Kill Bill UI (Kaui war) is installed in the `killbill/webapps` directory
62
- * Default plugins are installed in the `/var/tmp/bundles` directory, among them:
63
- * `jruby.jar`, required to run Ruby plugins
64
- * the https://github.com/killbill/killbill-kpm-plugin[KPM plugin], required to (un-)install plugins at runtime
46
+ * http://tomcat.apache.org/[Tomcat] (open-source Java web server)
47
+ * The Kill Bill application (war) is installed in the `./webapps` directory
48
+ * The Kill Bill UI (Kaui war) is installed in the `./webapps` directory
49
+ * Default OSGI bundles are installed in the `/var/tmp/bundles` directory
65
50
 
66
51
  To start Kill Bill, simply run
67
52
 
@@ -71,28 +56,23 @@ To start Kill Bill, simply run
71
56
 
72
57
  You can then verify Kill Bill is running by going to http://127.0.0.1:8080/kaui.
73
58
 
74
- [[using-kpm]]
75
- ## Using KPM
59
+ [[kpm-install-using-a-kpm.yml-file]]
60
+ ==== kpm install Using A `kpm.yml` File
76
61
 
77
- [[custom-installation-through-kpm.yml-file]]
78
- ### Custom Installation Through `kpm.yml` File
79
-
80
- KPM allows you to specify a configuration file, `kpm.yml`, to describe what should be installed. The configuration file is a `yml`. The following shows the syntax of the `kpm.yml` file:
62
+ KPM also lets you specify a configuration file, `kpm.yml`, to describe what should be installed. For example:
81
63
 
82
64
  ....
83
65
  killbill:
84
- version: 0.18.0
66
+ version: 0.20.12
85
67
  plugins:
86
68
  java:
87
69
  - name: analytics
88
- ruby:
89
- - name: stripe
90
70
  ....
91
71
 
92
72
  This instructs kpm to:
93
73
 
94
- * Download Kill Bill version 0.18.0
95
- * Setup the https://github.com/killbill/killbill-analytics-plugin[Analytics] (Java) plugin and the https://github.com/killbill/killbill-stripe-plugin[Stripe] (Ruby) plugin
74
+ * Download Kill Bill version 0.20.12
75
+ * Setup the https://github.com/killbill/killbill-analytics-plugin[Analytics] (Java) plugin (you would still need to manually install the plugin https://github.com/killbill/killbill-analytics-plugin/blob/master/src/main/resources/org/killbill/billing/plugin/analytics/ddl.sql[DDL file])
96
76
 
97
77
  To start the installation:
98
78
 
@@ -100,14 +80,11 @@ To start the installation:
100
80
  kpm install kpm.yml
101
81
  ....
102
82
 
103
- Here is a more advanced example:
83
+ Here is a more advanced example, specifying a custom Nexus repository and non-standard deployment directories:
104
84
 
105
85
  ....
106
86
  killbill:
107
- group_id: org.kill-bill.billing
108
- artifact_id: killbill-profiles-killbill
109
- version: 0.18.10
110
- default_bundles_version: 0.36.11
87
+ version: 0.20.12
111
88
  nexus:
112
89
  ssl_verify: false
113
90
  url: http://nexus.acme
@@ -118,70 +95,45 @@ killbill:
118
95
  - name: acme:custom
119
96
  artifact_id: custom-plugin
120
97
  version: 0.0.1-SNAPSHOT
121
- ruby:
122
- - name: kpm
123
98
  plugins_dir: /var/tmp/bundles
124
99
  webapp_path: /var/lib/tomcat/webapps/ROOT.war
125
100
  ....
126
101
 
127
- [[custom-downloads]]
128
- ### Custom Downloads
102
+ [[artifacts-downloads]]
103
+ ==== Artifacts Downloads
129
104
 
130
- You can also download specific versions/artifacts directly with the following commands – bypassing the kpm.yml file:
105
+ You can download specific artifacts with the following commands:
131
106
 
132
- * `kpm pull_kaui_war <version>`
133
- * `kpm pull_kb_server_war <version>`
134
- * `kpm install_ruby_plugin plugin-key <kb-version>`
135
- * `kpm install_java_plugin plugin-key <kb-version>`
107
+ * `kpm pull_kaui_war <version>`: downloads the Kaui war
108
+ * `kpm pull_kb_server_war <version>`: downloads the Kill Bill war
109
+ * `kpm install_java_plugin plugin-key <kb-version>`: downloads a Java plugin identified by `plugin-key`
110
+ * `kpm install_ruby_plugin plugin-key <kb-version>`: downloads a Ruby plugin identified by `plugin-key`
111
+ * `kpm pull_defaultbundles <kb-version>`: downloads the default Kill Bill OSGI bundles
136
112
 
137
- For more details see `kpm help`.
113
+ This is especially useful when scripting deployments.
138
114
 
139
- [[dev-mode]]
140
- ### Dev Mode
115
+ Note: previous plugin versions aren't cleaned up by default to facilitate rollbacks. If your deployment is stateful, unused, old plugin versions will slow the Kill Bill startup time. To cleanup these entries, use `kpm cleanup` which will delete all non-default plugin versions, or `kpm uninstall`.
141
116
 
142
- If you are a developer and either modifying an existing plugin or creating a new plugin, KPM can be used to install the code of your plugin. Before going further, make sure you read the http://docs.killbill.io/latest/plugin_development.html[Plugin Development Documentation] first.
117
+ [[kpm-uninstall]]
118
+ ==== kpm uninstall
143
119
 
144
- Let’s assume you are modifying the code for the (Ruby) CyberSource plugin. You would have to first build the plugin package, and then you could use KPM to install the plugin. We suggest you specify a `plugin_key` with a namespace `dev:` to make it clear this is not a released version.
120
+ `kpm uninstall plugin-key` will uninstall a plugin identified by `plugin-key` (all versions are uninstalled by default).
145
121
 
146
- ....
147
- kpm install_ruby_plugin 'dev:cybersource' --from-source-file="<PATH_TO>/killbill-cybersource-3.3.0.tar.gz"
148
- ....
122
+ [[kpm-migrations]]
123
+ ==== kpm migrations
149
124
 
150
- Let’s assume now that you are modifying the code for the (Java) Adyen plugin. The plugin first needs to be built using the `maven-bundle-plugin` to produce the OSGI jar under the `target` directory. Then, this `jar` can be installed using KPM (you would also need to specify a version here since the archive does not embed any metadata, unlike Ruby plugins packages). The same applies with regard to the `plugin_key` where we suggest to specify a namespace `dev:`.
125
+ `kpm migrations` is used to download database migration files when upgrading Kill Bill or plugins. See our http://docs.killbill.io/0.20/database_migrations.html[database migrations guief] for more details.
151
126
 
152
- ....
153
- kpm install_java_plugin 'dev:adyen' --from-source-file="<PATH_TO>/adyen-plugin-0.3.2-SNAPSHOT.jar" --version="0.3.2"
154
- ....
127
+ [[operations]]
128
+ === Operations
155
129
 
156
- The command `kpm inspect` can be used to see what has been installed. In the case of `dev` plugins, most of the infofrmation related to `GROUP ID`, `ARTIFACT ID`, `PACKAGING` and `SHA1` will be missing because no real download occured.
130
+ [[kpm-inspect]]
131
+ ==== kpm inspect
157
132
 
158
- Finally, when it is time to use a released version of a plugin, we first recommend to uninstall the `dev` version, by using the `kpm uninstall` command and using the `plugin_key`, and then installing the released version. For instance the following sequence could happen:
133
+ The command `kpm inspect` can be used to see which plugins have been installed:
159
134
 
160
135
  ....
161
- > kpm inspect
162
- ___________________________________________________________________________________________________________________________
163
- | PLUGIN NAME | PLUGIN KEY | TYPE | GROUP ID | ARTIFACT ID | PACKAGING | VERSIONS sha1=[], def=(*), del=(x) |
164
- ___________________________________________________________________________________________________________________________
165
- | killbill-cybersource | dev:cybersource | ruby | ??? | ??? | ??? | 3.3.0[???](*) |
166
- | adyen | dev:adyen | java | ??? | ??? | ??? | 0.3.2[???](*) |
167
- ___________________________________________________________________________________________________________________________
168
-
169
- > kpm uninstall 'dev:cybersource'
170
- Removing the following versions of the killbill-cybersource plugin: 3.3.0
171
- Done!
172
-
173
- > kpm inspect
174
-
175
- _____________________________________________________________________________________________________________
176
- | PLUGIN NAME | PLUGIN KEY | TYPE | GROUP ID | ARTIFACT ID | PACKAGING | VERSIONS sha1=[], def=(*), del=(x) |
177
- _____________________________________________________________________________________________________________
178
- | adyen | dev:adyen | java | ??? | ??? | ??? | 0.3.2[???](*) |
179
- _____________________________________________________________________________________________________________
180
-
181
- > kpm install_ruby_plugin cybersource
182
- [...]
183
-
184
- > kpm inspect
136
+ kpm inspect --destination=/var/tmp/bundles
185
137
  _______________________________________________________________________________________________________________________________________________________
186
138
  | PLUGIN NAME | PLUGIN KEY | TYPE | GROUP ID | ARTIFACT ID | PACKAGING | VERSIONS sha1=[], def=(*), del=(x) |
187
139
  _______________________________________________________________________________________________________________________________________________________
@@ -190,6 +142,56 @@ ________________________________________________________________________________
190
142
  _______________________________________________________________________________________________________________________________________________________
191
143
  ....
192
144
 
145
+ Note: `GROUP ID`, `ARTIFACT ID`, `PACKAGING` and `SHA1` can be missing (`???`) when installing plugins which aren't hosted in a Nexus repository. This isn't an issue.
146
+
147
+ [[kpm-system]]
148
+ ==== kpm system
149
+
150
+ The command `kpm system` is a superset of the `inspect` command. In addition to plugins information, the command will return details about the Kill Bill and Kaui installation, Java and Ruby environment, details about the OS, CPU, Memory and disks, entropy available, etc.
151
+
152
+ Note: for non-standard deployments, you will need to tell KPM the location of the Kill Bill and Kaui webapp (see `kpm help system`).
153
+
154
+ [[kpm-diagnostic]]
155
+ ==== kpm diagnostic
156
+
157
+ The command `kpm diagnostic` is a superset of the `system` command. It will connect to your Kill Bill instance to gather tenant configuration information and account data (if a specific account is specified) and will gather all log files.
158
+
159
+ You will need to instruct KPM how to connect to your Kill Bill instance (see `kpm help diagnostic`).
160
+
161
+ [[kpm-account]]
162
+ ==== kpm account
163
+
164
+ `kpm account` exports all account data from a running system and re-imports it in another Kill Bill installation. This is an advanced command and is usually run as part of `kpm agnostic`.
165
+
166
+ [[kpm-tenant_config]]
167
+ ==== kpm tenant_config
168
+
169
+ `kpm tenant_config` exports tenant specific data from a running system. This is an advanced command and is usually run as part of `kpm agnostic`.
170
+
171
+ [[kpm-cleanup]]
172
+ ==== kpm cleanup
173
+
174
+ `kpm cleanup` which will delete all non-default plugin versions. The `--dry-run` option can be used to double check first what would be deleted.
175
+
176
+ [[plugins-development]]
177
+ === Plugins development
178
+
179
+ [[kpm-info]]
180
+ ==== kpm info
181
+
182
+ `kpm info` lists the libraries to use when writing a plugin for a specific Kill Bill version. It also lists all of the official plugins for that specific version.
183
+
184
+ [[installing-custom-plugins]]
185
+ ==== Installing Custom Plugins
186
+
187
+ If you are a developer and either modifying an existing plugin or creating a new plugin, KPM can be used to install the code of your plugin. Before going further, make sure you read the http://docs.killbill.io/latest/plugin_development.html[Plugin Development Documentation] first.
188
+
189
+ Let’s assume now that you are modifying the code for the (Java) Adyen plugin. The plugin first needs to be built using the `maven-bundle-plugin` to produce the OSGI jar under the `target` directory. Then, this `jar` can be installed using KPM. We suggest you specify a `plugin_key` with a namespace `dev:` to make it clear this is not a released version:
190
+
191
+ ....
192
+ kpm install_java_plugin 'dev:adyen' --from-source-file="<PATH_TO>/adyen-plugin-0.3.2-SNAPSHOT.jar" --version="0.3.2"
193
+ ....
194
+
193
195
  [[internals]]
194
196
  ## Internals
195
197
 
@@ -225,14 +227,17 @@ Test suite that requires an instance of `mysql` running and verifies the followi
225
227
  [[plugin-keys]]
226
228
  ### Plugin Keys
227
229
 
228
- In the `kpm.yml` example provided above, the plugins are named using their `pluginKey` (the value for the `name` in the `kpm.yml`) . The `pluginKey` is the identifier for the plugin: * For plugins maintained by the Kill Bill team, this identifier matches the key in the https://github.com/killbill/killbill-cloud/blob/master/kpm/lib/kpm/plugins_directory.yml[file based repository] of well-known plugins * For other plugins, this key is either specified when installing the plugin through api call, or default to the `pluginName`. For more information, please refer to the Plugin Developer Guide.
230
+ Plugins are named using their `pluginKey` (the value for the `name` entry in the `kpm.yml`) . The `pluginKey` is the identifier for the plugin:
231
+
232
+ * For plugins maintained by the Kill Bill team, this identifier matches the key in the https://github.com/killbill/killbill-cloud/blob/master/kpm/lib/kpm/plugins_directory.yml[file based repository] of well-known plugins
233
+ * For other plugins, this key is either specified when installing the plugin through api call, or default to the `pluginName`. For more information, please refer to the http://docs.killbill.io/latest/plugin_development.html[Plugin Development guide].
229
234
 
230
235
  [[caching]]
231
236
  ### Caching
232
237
 
233
238
  KPM relies on the `kpm.yml` file to know what to install, and as it installs the pieces, it keeps track of what was installed so that if it is invoked again, it does not download again the same binaries. The generic logic associated with that file is the following:
234
239
 
235
- 1. When installing a binary (`war`, `jar`, `tar.gz`..), KPM will download both the binary and the `sha1` from the server, compute the `sha1` for the binary and compare the two (verify that binary indeed matches its remote `sha1`). Then, binary is installed and `sha1.yml` file is updated. The `sha1` entry in that `sha1.yml` file will now represent the local `sha1` version (note that for `tar.gz` binaries which have been uncompressed, the local `sha1` is not anymore easily recomputable).
240
+ 1. When installing a binary (`war`, `jar`, `tar.gz`, ...), KPM will download both the binary and the `sha1` from the server, compute the `sha1` for the binary and compare the two (verify that binary indeed matches its remote `sha1`). Then, the binary is installed and `sha1.yml` file is updated. The `sha1` entry in that `sha1.yml` file will now represent the local `sha1` version (note that for `tar.gz` binaries which have been uncompressed, the local `sha1` is not anymore easily recomputable).
236
241
  2. When attempting to download again the same binary, KPM will compare the value in the `sha1.yml` and the one on the remote server and if those match, it will not download the binary again.
237
242
 
238
243
  There are some non standard scenario that could occur in case of users tampering with the data (or remove server unavailable):
@@ -242,4 +247,36 @@ There are some non standard scenario that could occur in case of users tampering
242
247
  * `sha1` entry in the `sha1.yml` exists but has the special value `SKIP` : Binary will _not_ be downloaded again
243
248
  * Binary does not exist on the file system (or has been replaced with something else): KPM will ignore. Note that correct way to remove plugins is to use the `KPM uninstall` command.
244
249
 
245
- Note that you can override that behavior with the `--force-download` switch.
250
+ Notes:
251
+
252
+ * You can override that behavior with the `--force-download` switch
253
+ * When `--force-download` is specified (`false` by default), network access to a Nexus instance is required. Otherwise, downloads are idempotent even if no outbound networking is allowed (on initial download, the Nexus metadata is cached in the `sha1.yml` file which is re-used on subsequent installation if no outbound networking is allowed -- by default, KPM will try to get the latest metadata from Nexus though)
254
+
255
+ [[gh-packages]]
256
+ ### GitHub Packages
257
+
258
+ Starting with version 0.9.0, experimental support for GitHub packages has been added:
259
+
260
+ ....
261
+ kpm install_java_plugin acme:plugin \
262
+ --overrides url:https://maven.pkg.github.com/acme/plugin token:<TOKEN> \
263
+ --group-id com.acme \
264
+ --artifact-id plugin \
265
+ --version 0.0.1
266
+ ....
267
+
268
+ Replace `TOKEN` with a GitHub personal access token.
269
+
270
+ [[cloudsmith]]
271
+ ### Cloudsmith
272
+
273
+ Starting with version 0.10.0, experimental support for Cloudsmith has been added:
274
+
275
+ ....
276
+ kpm pull_kb_server_war 0.22.21-SNAPSHOT \
277
+ --overrides url:https://dl.cloudsmith.io/<TOKEN>/<ORG>/<REPO>/maven \
278
+ --group-id org.kill-bill.billing \
279
+ --artifact-id killbill-profiles-killbill
280
+ ....
281
+
282
+ Replace `TOKEN` with a Cloudsmith entitlement token, and specify the right `ORG` and `REPO`.