Skip to content
Snippets Groups Projects
  • Tomasz Grabiec's avatar
    ccc51b6f
    modules: Add support for run configurations · ccc51b6f
    Tomasz Grabiec authored
    
        == Description of the problem ==
    
    Currently modules can only specify files which need to be
    copied. There is a need for a module to also declare ways it can be
    run, so that we can automatically prepare a runnable image. It
    should be easy to switch between run configurations.
    
    Currently it is enough for image configuration to happen at the
    time of image make process. In future this should be allowed
    on the already built image.
    
    We also need to be able to combine multiple modules in one
    image. For example in addition to the main application one might want
    to start various services like CLI, management API server, etc.
    
    Java apps should be able to specify JVM arguments, which must be
    passed to the JVM upon its creation, as well as regular run-java
    arguments (classpath, main classes, main arguments, etc.)
    
        == Solution ==
    
    This is not intended to be a permanent solution. The aim is to solve
    immediate need to have a fully modularized build in a scalable way.
    
    Every module has a new kind of file in its root directory which
    holds its configuration. The file is named 'module.py' and is
    a python script which uses osv's api for declaring run configurations.
    
    Using python as config language has several advantages:
     - more expresiveness, unlike json it allows for expression reuse
     - it's easier to extend the config language
     - we don't need as much parsing, gluing, error checking, error
       reporting code because we have it already
    
    There are currently two kinds of applications which can be declared:
    
       run(cmdline)  <- basic .so application
       run_java(jvm_args=[], classpath=[], args=[])  <- java applications
    
    Run configurations can be declared as simple module attributes
    which can be referenced from the image configuration file.
    
    Image configuration
    
    There is a new configuration file kind, which defines which modules
    and which run configurations should be included in the image. Files
    are located using path: ${OSV_BASE}/images/$(image-name).py
    
    Syntax:
    
      require(module) <-- declares that module should be included in the image
      		      and returns an object which allows to access module's
    		      attributes.
    
      run = []  <-- list of run configurations
    
    Example:
    
      _mgmt = require('mgmt')
      run = [ _mgmt.shell ]
    
    To use a particular image configuration run make like this:
    
      make image=fancy-tomcat
    
    The default configuration is named 'default'.
    
    This patch extracts mgmt into a module, which is embedded under
    ${OSV_BASE}/modules/mgmt
    
    The purpose of ${OSV_BASE}/config.json has been changed. It does not
    list modules which should be included anymore, image config file does
    that. It's a module look-up configuration which tells the build where
    to look for modules.
    
    Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
    ccc51b6f
    History
    modules: Add support for run configurations
    Tomasz Grabiec authored
    
        == Description of the problem ==
    
    Currently modules can only specify files which need to be
    copied. There is a need for a module to also declare ways it can be
    run, so that we can automatically prepare a runnable image. It
    should be easy to switch between run configurations.
    
    Currently it is enough for image configuration to happen at the
    time of image make process. In future this should be allowed
    on the already built image.
    
    We also need to be able to combine multiple modules in one
    image. For example in addition to the main application one might want
    to start various services like CLI, management API server, etc.
    
    Java apps should be able to specify JVM arguments, which must be
    passed to the JVM upon its creation, as well as regular run-java
    arguments (classpath, main classes, main arguments, etc.)
    
        == Solution ==
    
    This is not intended to be a permanent solution. The aim is to solve
    immediate need to have a fully modularized build in a scalable way.
    
    Every module has a new kind of file in its root directory which
    holds its configuration. The file is named 'module.py' and is
    a python script which uses osv's api for declaring run configurations.
    
    Using python as config language has several advantages:
     - more expresiveness, unlike json it allows for expression reuse
     - it's easier to extend the config language
     - we don't need as much parsing, gluing, error checking, error
       reporting code because we have it already
    
    There are currently two kinds of applications which can be declared:
    
       run(cmdline)  <- basic .so application
       run_java(jvm_args=[], classpath=[], args=[])  <- java applications
    
    Run configurations can be declared as simple module attributes
    which can be referenced from the image configuration file.
    
    Image configuration
    
    There is a new configuration file kind, which defines which modules
    and which run configurations should be included in the image. Files
    are located using path: ${OSV_BASE}/images/$(image-name).py
    
    Syntax:
    
      require(module) <-- declares that module should be included in the image
      		      and returns an object which allows to access module's
    		      attributes.
    
      run = []  <-- list of run configurations
    
    Example:
    
      _mgmt = require('mgmt')
      run = [ _mgmt.shell ]
    
    To use a particular image configuration run make like this:
    
      make image=fancy-tomcat
    
    The default configuration is named 'default'.
    
    This patch extracts mgmt into a module, which is embedded under
    ${OSV_BASE}/modules/mgmt
    
    The purpose of ${OSV_BASE}/config.json has been changed. It does not
    list modules which should be included anymore, image config file does
    that. It's a module look-up configuration which tells the build where
    to look for modules.
    
    Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
Makefile 1.94 KiB