Skip to content

NethServer/ns8-kickstart

Repository files navigation

ns8-kickstart

This is a template module for NethServer 8. To start a new module from it:

  1. Click on Use this template. Name your repo with ns8- prefix (e.g. ns8-mymodule). Do not end your module name with a number, like ns8-baaad2!

  2. Clone the repository, enter the cloned directory and configure your GIT identity

  3. Rename some references inside the repo:

    modulename=$(basename $(pwd) | sed 's/^ns8-//')
    git mv imageroot/systemd/user/kickstart.service imageroot/systemd/user/${modulename}.service
    git mv tests/kickstart.robot tests/${modulename}.robot
    sed -i "s/kickstart/${modulename}/g" $(find .github/ * -type f)
    git commit -a -m "Repository initialization"
    
  4. Edit this README.md file, by replacing this section with your module description

  5. Adjust .github/workflows to your needs. clean-registry.yml might need the proper list of image names to work correctly. Unused workflows can be disabled from the GitHub Actions interface.

  6. Commit and push your local changes

Install

Instantiate the module with:

add-module ghcr.io/nethserver/kickstart:latest 1

The output of the command will return the instance name. Output example:

{"module_id": "kickstart1", "image_name": "kickstart", "image_url": "ghcr.io/nethserver/kickstart:latest"}

Configure

Let's assume that the kickstart instance is named kickstart1.

Launch configure-module, by setting the following parameters:

  • <MODULE_PARAM1_NAME>: <MODULE_PARAM1_DESCRIPTION>
  • <MODULE_PARAM2_NAME>: <MODULE_PARAM2_DESCRIPTION>
  • ...

Example:

api-cli run module/kickstart1/configure-module --data '{}'

The above command will:

  • start and configure the kickstart instance
  • (describe configuration process)
  • ...

Send a test HTTP request to the kickstart backend service:

curl http://127.0.0.1/kickstart/

Smarthost setting discovery

Some configuration settings, like the smarthost setup, are not part of the configure-module action input: they are discovered by looking at some Redis keys. To ensure the module is always up-to-date with the centralized smarthost setup every time kickstart starts, the command bin/discover-smarthost runs and refreshes the state/smarthost.env file with fresh values from Redis.

Furthermore if smarthost setup is changed when kickstart is already running, the event handler events/smarthost-changed/10reload_services restarts the main module service.

See also the systemd/user/kickstart.service file.

This setting discovery is just an example to understand how the module is expected to work: it can be rewritten or discarded completely.

Uninstall

To uninstall the instance:

remove-module --no-preserve kickstart1

Testing

Test the module using the test-module.sh script:

./test-module.sh <NODE_ADDR> ghcr.io/nethserver/kickstart:latest

The tests are made using Robot Framework

UI translation

Translated with Weblate.

To setup the translation process: