项目作者: saksmt

项目描述 :
Cross-platform utility tool for running Apache Karaf
高级语言: Kotlin
项目地址: git://github.com/saksmt/karaf-runner.git
创建时间: 2016-06-29T16:48:29Z
项目社区:https://github.com/saksmt/karaf-runner

开源协议:MIT License

下载


karaf-runner

Cross-platform (actually not tested on M$ Windows) utility tool for running Apache Karaf

Features

  • Locate and pre-install features/kars
  • Handle cross-project dependencies
  • Copy configuration based on environment and project
  • Handling of multiple Karaf images/version/assemblies
  • Locating and running custom Karaf assemblies built with maven karaf-assembly plugin

Quick usage example

Simple as pie - just run the following:

  1. karaf-runner run from-kars --environment dev
  2. # or if you want to run your project from features:
  3. karaf-runner run from-features
  4. # or maybe you want to run custom Karaf assembly?
  5. karaf-runner run from-assembly

For more see sections below

Installation

Unix-like systems

1

  1. sudo ./install [--installation-path /usr/local/bin] [--configuration-file /usr/local/etc/karaf-runner/config]

1.1 (optional)

You may want to configure where your configuration templates and images would live

  1. # /usr/loca/etc/karaf-runner/config
  2. templatesPath += /usr/local/etc/karaf-runner
  3. imagesPath += /opt/karaf-runner/images

2

  1. sudo karaf-runner image install /path/to/directory/with/karaf-assembly

Also you can simply cd into directory with assembly and run command without path.
(Actually path needn’t to be direct parent of assembly, any parent in hierarchy is allowed,
ex. /path/to is also accepted)

3

It’s time to run it!

Windows

Windows users MUST SUFFER :smiling_imp:

OK, it’s just a joke: just build it with maven and at every execution of karaf-runner
pass -Dkaraf-runner.configurationFile=PATH_TO_YOUR_CONFIGURATION, every thing else is
backward compatible with Unix-like-section, just replace prefix according to following table:

Unix Windows
/usr/local/etc %HOME%\.config
/opt %HOME%\.opt

Also you can use configuration file to place your templates and images where you want

Template hierarchy

  1. -- /templates_root
  2. |
  3. +-- /base - base configuration, copied to every instance
  4. | |
  5. | +-- /my.awesome.config.cfg
  6. |
  7. +-- /project-skel - configuration for projects (one subdir - one project)
  8. | |
  9. | +-- /my-project - concrete project configuration
  10. | |
  11. | +-- /my.another.awesome.config.cfg
  12. |
  13. +-- /skel - configuration for environments (one subdir - one environment)
  14. | |
  15. | +-- /dev - configuration files for dev environment
  16. | |
  17. | +-- /my.dev.env.related.config.cfg
  18. |
  19. +-- /project-config - contains configuration for projects in environments
  20. |
  21. +-- /my-project - contains configuration for "my-project" in environments
  22. |
  23. +-- /dev - contains configuration for "my-project" in "dev" env
  24. |
  25. +-- /config.for.my-project.started.in.dev.env.cfg

Configuration

Every project dir may contain .karaf-runner.project file with karaf-runner configuration for that project.
Configuration consists of 3 parts:

  1. Projects description - contains list of project names, all of them would be used
  2. Dependencies description - contains paths of projects on which current depends
  3. Image - you can specify image to use instead of “default” as default one

Karaf-runner would scan also dependent configurations, so if your project (A) depends on project B, depending on project C
with names: C and D, you’ll have project names as following: C, D, B, A

Dependency paths may be both absolute and relative on your choice.

Format

Format is much like qmake’s .pro files, except of the only operator supported is += ^^

Keys:

  • projects
  • project - alias for projects
  • dependencies
  • dependency - alias for dependencies
  • images
  • image - alias for images

Example

  1. image = caterpillar
  2. projects += pim
  3. projects += pom
  4. dependencies += ../ssm

Usage

  1. Usage
  2. karaf-runner <install|run|image|get-path|shutdown|help> {arguments} [options]
  3. Modules
  4. help Show this help message
  5. get-path [OPTIONS] Get path where karaf currently installed
  6. Options:
  7. --image=<IMAGE_NAME>, -i <IMAGE_NAME> Specifies image name
  8. Defaults to "default" (/opt/karaf-runner/images/$IMAGE_NAME)
  9. --raw, -r Just show path, without user message (useful for scripts)
  10. install <MODE> [OPTIONS] Installs karaf of specified version
  11. Options:
  12. --image=<IMAGE_NAME>, -i <IMAGE_NAME> Specifies image name
  13. Defaults to "default" (/opt/karaf-runner/images/$IMAGE_NAME)
  14. --project-name=<PROJECT_NAME>, Explicitly specify project names, repeat option for
  15. -p <PROJECT_NAME> setting more than one project name
  16. -P Disable ask for project name and don't copy project templates
  17. --templates-path=<PATH>, -T <PATH> Specify path, where templates live
  18. Defaults to /usr/local/etc/karaf
  19. --environment=<ENV>, --env=<ENV>, -e <ENV> Specifies environment of configuration, if not set
  20. doesn't copy environment related templates
  21. --use-assembly, -A Tells not to use base image and search
  22. for assembly dir instead (don't affects assembly mode)
  23. Arguments (MODES):
  24. from-features Install karaf and use features as deployment files
  25. from-kars Install karaf and use kar's as deployment files
  26. assembly Don't install image and lookup for assembly dir instead
  27. (semantically equal to "vanilla -A")
  28. vanilla Install karaf and don't use any deployment files
  29. shutdown [OPTIONS] Drop currently installed karaf
  30. Options:
  31. --image=<IMAGE_NAME>, -i <IMAGE_NAME> Specifies image name
  32. Defaults to "default" (/opt/karaf-runner/images/$IMAGE_NAME)
  33. image <MODE> [OPTIONS] Manipulate image
  34. Options:
  35. --image=<IMAGE_NAME>, -i <IMAGE_NAME> Specifies image name
  36. Defaults to "default" (/opt/karaf-runner/images/$IMAGE_NAME)
  37. Arguments (MODES):
  38. drop-cache Drop image cache (use it when you've updated any base karaf image)
  39. If image was updated with karaf-runner it is called automatically
  40. update [IMAGE_PATH] Replace current image with specified one (default path is $PWD)
  41. Path may be absolute path to image (assembly dir) or just one of
  42. the parent paths
  43. install [IMAGE_PATH] Alias for "update"
  44. run <MODE> [OPTIONS] Install karaf and immediately run it
  45. Options:
  46. --image=<IMAGE_NAME>, -i <IMAGE_NAME> Specifies image name
  47. Defaults to "default" (/opt/karaf-runner/images/$IMAGE_NAME)
  48. --project-name=<PROJECT_NAME>, Explicitly specify project names, repeat option for
  49. -p <PROJECT_NAME> setting more than one project name
  50. -P Disable ask for project name and don't copy project templates
  51. --templates-path=<PATH>, -T <PATH> Specify path, where templates live
  52. Defaults to /usr/local/etc/karaf
  53. --environment=<ENV>, --env=<ENV>, -e <ENV> Specifies environment of configuration, if not set
  54. doesn't copy environment related templates
  55. --use-assembly, -A Tells not to use base image and search
  56. for assembly dir instead (don't affects assembly mode)
  57. --endless, -E Endless run of karaf (restart on exit)
  58. --debug, -d Run karaf in debug mode
  59. Arguments:
  60. from-features Install karaf and use features as deployment files
  61. from-kars Install karaf and use kar's as deployment files
  62. assembly Don't install image and lookup for assembly dir instead
  63. (semantically equal to "vanilla -A")
  64. vanilla Install karaf and don't use any deployment files

License

All source code is licensed under MIT license