Difference between revisions of "MOD command line interface"

From MOD Wiki
Jump to navigation Jump to search
Line 74: Line 74:
  
 
After the file descriptor is in place, the plugin can be compiled and published in the cloud.
 
After the file descriptor is in place, the plugin can be compiled and published in the cloud.
 
The most basic command for publishing a plugin is:
 
<source lang="console">
 
$ modcli bundle publish <path/to/.json>
 
</source>
 
 
When using this command it's important the the <code>.mk</code> file used for the package is in the same directory is the <code>.json</code> file.
 
If .mk file is located somewhere else, for example when using the mod-plugin-builder, the <code>-p</code> flag can be used to provide a path to this file. This is done as follows:
 
<source lang="console">
 
$ modcli bundle publish -p ../mod-plugin-builder <path/to/.json>
 
</source>
 
 
When using the mod-plugin-builder, and the <code>.mk</code> file is in <code>mod-plugin-builder/plugins/package/<package-name>/<package-name>.mk</code> the modcli only needs the path the mod-plugin-builder repo, not the full path the package directory. When the <code>.mk</code> file is not located is not located in the same directory as the <code>.json</code> file and is also not in the plugin builder, a relative path
 
the directory where the <code>.mk</code> can be given.
 
 
 
When running the command the output should look something like this:
 
When running the command the output should look something like this:
  
Line 119: Line 104:
 
$ curl "https://api-labs.moddevices.com/v2/lv2/plugins?pretty=true&budle_name=eg-amp.lv2"
 
$ curl "https://api-labs.moddevices.com/v2/lv2/plugins?pretty=true&budle_name=eg-amp.lv2"
 
</source>
 
</source>
 +
 +
The most basic command for publishing a plugin is:
 +
<source lang="console">
 +
$ modcli bundle publish <path/to/.json>
 +
</source>
 +
 +
When using this command it's important the the <code>.mk</code> file used for the package is in the same directory is the <code>.json</code> file.
 +
If .mk file is located somewhere else, for example when using the mod-plugin-builder, the <code>-p</code> flag can be used to provide a path to this file. This is done as follows:
 +
<source lang="console">
 +
$ modcli bundle publish -p ../mod-plugin-builder <path/to/.json>
 +
</source>
 +
 +
When using the mod-plugin-builder, and the <code>.mk</code> file is in <code>mod-plugin-builder/plugins/package/<package-name>/<package-name>.mk</code> the modcli only needs the path the mod-plugin-builder repo, not the full path the package directory. When the <code>.mk</code> file is not located is not located in the same directory as the <code>.json</code> file and is also not in the plugin builder, a relative path
 +
the directory where the <code>.mk</code> can be given.

Revision as of 15:26, 24 September 2020

The MOD command line interface (modcli) is a small python tool that is used to communicate with the cloud API and ease the process of building and publishing your plugin.

Installation

First you will need to follow the instructions from the mod-devel-cli project to install the tool.

Once installed you can check the status:

$ modcli config list
Active environment: labs
Authenticated in [labs]: No
Registered environments: ['dev', 'labs']

If your active environment is not 'labs' then you have to change it:

$ modcli config set_active_env labs
Current environment set to: labs

Next you need to authenticate. The modcli tool will authenticate using SSO against MOD Forum. So make sure you register for an account first. Then:

$ modcli auth login_sso
SSO login requires you have a valid account in MOD Forum (https://forum.moddevices.com).
If your browser has an active session the credentials will be used for this login. Confirm? [y/N]: y
Logging in to [labs]...
You're now logged in as [xxx] in [labs].

Publish a plugin

Once the modcli is installed it can be used to interact with the mod cloud API. All the steps for publishing a plugin are described bellow.

Create project descriptor file

For this tutorial we'll build the lv2 examples from here.

Now you need to create a project descriptor file so the cloud knows how to compile and publish your plugin. If you followed the tutorials on creating a plugin and deploying to your Duo you must have a buildroot .mk file in a folder. If your project is called lv2-examples then your package folder should be named lv2-examples and there must be a .mk file named lv2-examples.mk inside that folder.

Now create a new descriptor file named lv2-example.json inside your package folder with contents:

{
    "bundles": [
        { "name": "eg-amp.lv2" },
        { "name": "eg-fifths.lv2" },
        { "name": "eg-metro.lv2", "stable": true, "image_required": "1.5.0" },
        { "name": "eg-midigate.lv2" },
        { "name": "eg-sampler.lv2" },
        { "name": "eg-scope.lv2" }
     ],
    "project": "LV2 Examples",
    "developer": "David Robillard",
    "buildroot_pkg": "lv2-examples",
    "project_url": "https://github.com/drobilla/lv2"
}

In that descriptor you have to define:

  • bundles - The list of bundles that will be published after the source code is compiled
  • project - The project name
  • developer - The name of the developer
  • buildroot_pkg - The name of your buildroot package (it has to match the .mk filename)
  • project_url - The url of the project

For each bundle in the bundle list you can define:

  • name - The bundle name (it has to match the folder name of the bundle in the compilation output)
  • stable - When set to false the plugins of the bundle will be considered being in BETA (if not defined it's assumed to be false)
  • image_required - Define a minimum version of the MOD Image that your bundle requires (if not defined it's assumed to be 1.0.0)

Compile and publish a plugin in the cloud

After the file descriptor is in place, the plugin can be compiled and published in the cloud. When running the command the output should look something like this:

$ modcli bundle publish lv2-example.json
Submitting release process for project ./lv2-examples.json using file lv2-examples.tar.gz
URL: https://pipeline-labs.moddevices.com/bundle
Release process created: xxx
Uploading buildroot package lv2-examples.tar.gz ...
Checksum match ok!
Cleaning up...
Process url: https://pipeline-labs.moddevices.com/bundle/xxx/?pretty=true
Done

Please see the section about the mod license interface above for more information on how to set this up.

At the end you'll see a process url. You can load it with curl:

$ curl "https://pipeline-labs.moddevices.com/bundle/xxx/?pretty=true"

That's the publishing process that has been created in the cloud. Keep refreshing it until the status changes to finished or error. You can check the logs opening the logs_href URL in case there any issues. Once the status changes to finished the plugin is available in the labs cloud API.

To verify the published bundles you can call the cloud API:

$ curl "https://api-labs.moddevices.com/v2/lv2/plugins?pretty=true&budle_name=eg-amp.lv2"

The most basic command for publishing a plugin is:

$ modcli bundle publish <path/to/.json>

When using this command it's important the the .mk file used for the package is in the same directory is the .json file. If .mk file is located somewhere else, for example when using the mod-plugin-builder, the -p flag can be used to provide a path to this file. This is done as follows:

$ modcli bundle publish -p ../mod-plugin-builder <path/to/.json>

When using the mod-plugin-builder, and the .mk file is in mod-plugin-builder/plugins/package/<package-name>/<package-name>.mk the modcli only needs the path the mod-plugin-builder repo, not the full path the package directory. When the .mk file is not located is not located in the same directory as the .json file and is also not in the plugin builder, a relative path the directory where the .mk can be given.