Skip to content

Cheatsheet

1. root service commands

As root unix user:

Command Description
service metwork start start all installed metwork services
service metwork stop stop all installed metwork services
service metwork status check all installed metwork services
service metwork start mfserv start mfserv metwork services
service metwork stop mfserv stop mfserv metwork services
service metwork status mfserv check mfserv metwork services

Note: if you don't have service command on your Linux distribution, you can use /etc/rc.d/init.d/metwork instead of service metwork. For example: /etc/rc.d/init.d/metwork start instead of service metwork start. If your Linux distribution uses systemdcomponent, you can also start metwork services with classic systemctl commands.

2. root files or directories

Path Description
/etc/metwork.config.d/mfserv/config.ini override the mfserv module configuration at system level (note: the first line of this file must be [INCLUDE_config.ini])
/opt/metwork-mfserv/config/config.ini default mfserv module configuration (useful to see all configuration options) (do not edit this file => use the overriding previous file)
/etc/metwork.config.d/mfserv/plugins/ put some .plugin files here and they will be installed during mfserv service startup, put some .ini file fragments here as {plugin_name}.ini and they will be used as configuration override for the specified plugin

3. "load environment" commands

As a "not metwork" unix user (useless if you are logged as a "mfxxx" unix user as the "metwork environment" is already loaded):

Command Description
source /opt/metwork-mfserv/share/interactive_profile load the mfserv metwork interactive environment
source /opt/metwork-mfserv/share/profile load the mfserv metwork environment (same as above but without fancy stuff about banner, colors and prompt)
/opt/metwork-mfserv/bin/mfserv_wrapper {YOUR_COMMAND} execute the given command in the mfserv metwork environment without changing anything to the current environment

Note: if you don't have /opt/metwork-mfserv symbolic link, use /opt/metwork-mfserv-{BRANCH} instead.

4. module commands

As mfserv user:

Command Description
mfserv.start start mfserv services
mfserv.stop stop mfserv services
mfserv.status check mfserv services
layers list installed layers (loaded layers are prefixed by (*)), layers --help for more details
layer_load {LAYER_NAME} load the given layer (which must be installed), example: layer_load python3_devtools@mfext
layer_unload {LAYER_NAME} unload the given layer (which must be loaded), example: layer_unload python3@mfext
components list installed software components (loaded components are prefixed by (*)), components --help for more details
metwork_debug debug the current environment (layers, paths, versions...), useful for debugging or bug reporting
outside {YOUR_COMMAND} execute the given command outside the metwork environment without changing anything to the current environment

5. plugins management commands

As mfserv unix user:

Command Description
plugins.list list installed plugins
plugins.install {/full/path/file.plugin} install the given plugin file
plugins.uninstall {plugin_name} uninstall the given plugin name (the "plugin name" is given in the first column of the plugins.list output)
plugins.info {plugin_name} get some informations about the given plugin name (must be installed)
plugins.info {/full/path/file.plugin} get some informations about the given plugin file (does not need to be installed)
plugin_env {plugin_name} enter (interactively) in the given plugin environment
plugin_wrapper {plugin_name} {YOUR_COMMAND} execute the given command in the given plugin environment (without changing anything to your current environment), useful for cron jobs

6. plugins development commands and files

6.1 bootstrapping and building

As mfserv unix user, inside a plugin directory for make commands (you must have a Makefile and config.ini files inside the current working directory):

Command Description
bootstrap_plugin.py list list available plugin templates
bootstrap_plugin.py create --template={TEMPLATE} {PLUGIN_NAME} bootstrap a plugin directory {PLUGIN_NAME} from the given template
make develop install the current plugin in "development mode" (devlink)
make release release the current plugin as a .plugin file
make refresh the virtualenv or node_modules from requirements file
make clean "clean" the current plugin and keep only "non generated" files and directories (you should commit the remaining ones to your favorite version control system) ; after that, use make to regenerate the virtualenv or node_modules
make superclean same as clean target but also drop requirements2.txt, requirements3.txt and/or package-lock.json which can lead to a dependencies update (they are not frozen anymore) during next make call

6.2 interesting files inside the plugin directory

Relative path Description
config.ini main plugin configuration file
Makefile build configuration file (you probably don't need to touch this unless you have specific build directives to add to the custom:: target)
local/ local subdirectory (it mainly holds the python virtualenv), never touch this it's automatically generated)
bin/ if you put an executable in this directory, it will be available in PATH (in your plugin environment)
lib/ this library directory will be available in LD_LIBRARY_PATH and in PYTHONPATH (in your plugin environment), so you can put here shared libraries or python files you want to include easily
postinstall if this executable file is present during plugin installation, it will be automatically executed in the plugin environment just after the installation
python3_virtualenv_sources/
requirements-to-freeze.txt
main requirements file for python3 plugins (you shouldn't freeze versions here).
python3_virtualenv_sources/
requirements3.txt
frozen requirements file for python3 plugins (generated from requirements-to-freeze.txt file, deleted by make superclean, commit this file to your VCS to freeze your dependencies).
python3_virtualenv_sources/
allow_binary_packages
file to delete if you don't want pip to use binary packages (it will try to compile them during install)
python3_virtualenv_sources/
override
file to delete if you don't want pip to override packages available in mfext (it will try to use the version of mfext packages)
.layerapi2_label layerapi2 file to hold the plugin name as plugin_{plugin name}@module_in_lowercase
.layerapi2_dependencies layerapi2 file to hold the layers to load when entering the plugin environment (you can also put some plugins with the syntax plugin_{other plugin name}@module_in_lowercase to inherit from another plugin
.layerapi2_extra_env can be used to define extra environment variables in your plugin environment (see layerapi2 documentation)
.autorestart_includes file patterns (gitignore syntax) scanned for changes to trigger a plugin autorestart
.autorestart_excludes file patterns (gitignore syntax) to exclude for scanning (see above)
.plugin_format_version version of the framework used to bootstrap the plugin (don't change this, this is used for backward compatibility)
.releaseignore file patterns (gitignore syntax) to ignore in the release .plugin file

Note: mandatory files are in bold, all these files are not created by default (it mainly depends on the template you used) but you can create them afterwards.

Note: mandatory files are in bold, all these files are not created by default (it mainly depends on the template you used) but you can create them afterwards.