Configuration and usage

Run from sources

No project-specific compilation is required. Clone the project and start the launcher directly:

git clone https://github.com/redpesk-samples/helloworld-python-binding.git
cd helloworld-python-binding
./bin/helloworld-python-binding -vvv

The service can also be started as a Python module:

python3 -m helloworld_python_binding -vvv

Runtime configuration

helloworld-python-binding creates and starts its own libafb binder when launched manually. For this development workflow, the default HTTP/WebSocket port is 1234.

The port can be selected with the command line:

./bin/helloworld-python-binding --port 1234 -vvv

or with the PORT environment variable:

export PORT=1234
./bin/helloworld-python-binding -vvv

The default AFB verbosity level is 2. Each -v increases it by one level, up to 9; use --verbose LEVEL to select an exact level.

When installed as a redpesk package, manifest.yml describes the packaged service and declares the helloworld API to the redpesk application framework. It is stored as rpconfig/manifest.yml in the sources and installed as .rpconfig/manifest.yml in the application directory.

Run the installed service

Start the packaged redpesk application through the application framework:

afm-util start helloworld-python-binding

The application framework starts the packaged service through the generated systemd unit. The transport used by that service is determined from the application configuration and is not guaranteed to be TCP on port 1234; for example, it may use a Unix socket.

Running the installed launcher directly is useful for development or debugging, but it bypasses the normal application-framework startup path and should not be used as the standard packaged-service workflow.

Call the API

When the service is started manually from the source tree with the default port, use afb-client from another terminal:

afb-client -H localhost:1234/api helloworld hello

The localhost:1234/api endpoint applies only to the manually started development instance above. When the packaged application is started with afm-util, use the transport endpoint configured by the application framework instead.

Calls to the application verbs also publish the helloworld/verb_called event. See the API reference for the complete verb, request, reply and event contract.

API export URI

The optional --api-uri argument exports the locally implemented API through an AFB transport URI. For example:

./bin/helloworld-python-binding --api-uri 'tcp:*:32123/helloworld' -vvv

Without this option, the API is created directly in the local binder.

Running on a redpesk target

The same RPM can be installed on a compatible redpesk target. Target provisioning and package deployment are platform-level operations and are intentionally not duplicated here:

Troubleshooting

Verify that the runtime packages and installed files are present:

rpm -q python3 afb-libpython
rpm -ql helloworld-python-binding

Increase the AFB verbosity when diagnosing API creation or request handling issues:

./bin/helloworld-python-binding -vvv