This is a template module for NethServer 8. To start a new module from it:
-
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
-
Clone the repository, enter the cloned directory and configure your GIT identity
-
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"
-
Edit this
README.md
file, by replacing this section with your module description -
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. -
Commit and push your local changes
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"}
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/
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.
To uninstall the instance:
remove-module --no-preserve kickstart1
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
Translated with Weblate.
To setup the translation process:
- add GitHub Weblate app to your repository
- add your repository to [hosted.weblate.org]((https://hosted.weblate.org) or ask a NethServer developer to add it to ns8 Weblate project