A Dockerized Rust worker designed for R2PS processing with SoftHSM token integration and Kafka messaging.
Before you begin, ensure you have the following installed on your machine:
- Docker (v20.10+)
- Docker Compose (v2.0+)
- Make (v4.0+)
The project relies on environment variables stored in .env files.
-
Environment Files:
.env.softhsm: Configuration for SoftHSM tokens..env.opaque: Opaque configuration secrets.
(Ensure these files are in the root directory and contain valid keys.)
-
Kafka: The worker connects to a local Kafka cluster.
- Bootstrap Servers:
kafka-1:19092,kafka-2:19092,kafka-3:19092
- Bootstrap Servers:
-
Platform specific configuration:
- Create an .env file with custom config. Examples can be found in the repo .env_linux and .env_mac
This project uses a Makefile to simplify common operations.
Build all containers in docker compose
make buildStart the Kafka initialization and the Rust worker:
make upTo copy the tokens from the running container to your host machine (useful for debugging or backups):
make copy-tokensCheck if the directory was populated correctly on the host:
make verify-tokensIf you encounter "Permission Denied" errors when accessing the softhsm-tokens directory on your host, run this command to match the container's user permissions:
make fix-permissionsFollow the logs of the Rust worker in real-time:
make logsStop the containers:
make downThe container runs with a specific User ID (UID) and Group ID (GID). If the host directory ./softhsm-tokens is owned by a different user, you will see permission errors.
Solution: Run make fix-permissions after copying the tokens. This command uses sudo chown to match the current user's UID/GID with the container's expectations.
If the worker fails to start, check that the init-kafka service has completed successfully.
make logs