CW-11: Visualise workflows

### [Building a TollGate module](https://github.com/OpenTollGate/tollgate-module-relay-go/actions/runs/13858291486) (nostr client)

The following mermaid graph visualises what happens when we make changes to a module.

  • Build binary
  • - [x] verifies that the code can be compiled for all the targets that we care about in less than two minutes.

  • Package module
  • - [x] Uses the OpenWRT SDK to generate packages quickly

    - [x] Builds a newer golang version, which is required by the relay

    - [x] Was using the wrong golang-package.mk. See [here](

    Referenced event not yet available nevent1qvzqq…hqgg3aaj
    ).

    - [ ] [Packages the module](https://github.com/OpenTollGate/tollgate-sdk/actions/runs/13858302129) for OpenWRT

    - [x] Resolved sonic error

    - [ ] [Separate step](

    Referenced event not yet available nevent1qvzqq…0gaqcqdr
    ) for relay specific stuff

    - [ ] Currently hitting errors when installing the package - migration to action

    - [ ] opkg-make-index not required for now

    - [ ] package format seems wrong - perhaps opkg-build is required?

    - [ ] [[Prebuild Golang]] to save about 10 minutes per run. Issue [here](

    Referenced event not yet available nevent1qvzqq…yqnxt7af
    )

  • Generate image
  • - [ ] Installs the package from the previous step in an OpenWRT image

    ```mermaid

    graph TD

    Trigger[Push/PR to main] --> build-binary

    build-binary -->|Matrix: Targets| Build

    Build --> UploadBlossom

    UploadBlossom --> PublishNIP94[Publish NIP-94 announcement]

    PublishNIP94 --> Verify

    Verify --> UploadArtifact

    build-binary --> build-package

    build-package -->|Matrix: 3 Models| BuildPackage

    BuildPackage --> UploadBlossomPackage

    UploadBlossomPackage --> PublishNIP94Package[Publish NIP-94 announcement]

    PublishNIP94Package --> VerifyPackage

    VerifyPackage --> UploadArtifactPackage

    build-package --> build-firmware

    build-firmware -->|Matrix: 3 Models| BuildFirmware

    BuildFirmware --> UploadBlossomFirmware

    UploadBlossomFirmware --> PublishNIP94Firmware[Publish NIP-94 announcement]

    PublishNIP94Firmware --> VerifyFirmware

    VerifyFirmware --> UploadArtifactFirmware

    %% Define classes for styling

    classDef bitcoinOrange fill:#f7931a,stroke:#e68a00,color:white;

    classDef nostrPurple fill:#8624f5,stroke:#6c13d8,color:white;

    classDef nip94Color fill:#00bcd4,stroke:#0097a7,color:white;

    %% Apply classes to nodes

    class build-binary,build-package,build-firmware bitcoinOrange;

    class UploadBlossom,UploadBlossomPackage,UploadBlossomFirmware nostrPurple;

    class PublishNIP94,PublishNIP94Package,PublishNIP94Firmware nip94Color;

    ```

    ### Making a TollGate release (OpenWRT image)

    The packages that were announced with NIP-94 events when building modules need to be installed in an OpenWRT image.

    The tollgate-os image builder

    - [ ] searches for the NIP-94 events that match the version numbers in the release json

    - [x] downloads the respective packages from nostr

    - [ ] installs the packages in an OpenWRT image

    - [x] uploads the image to blossom

    - [x] publishes a NIP-94 event announcing the image

    #### Example release

    ```

    {

    "modules": {

    "tollgate-module-crowsnest-go": {

    "version": "0.1.0",

    "description": "Crowsnest module for observation and monitoring"

    },

    "tollgate-module-janitor-go": {

    "version": "0.1.0",

    "description": "Janitor module for system maintenance and cleanup"

    },

    "tollgate-module-merchant-go": {

    "version": "0.1.0",

    "description": "Merchant module for payment processing"

    },

    "tollgate-module-relay-go": {

    "version": "0.1.0",

    "description": "Relay module for message handling and forwarding"

    },

    "tollgate-module-valve-go": {

    "version": "0.1.0",

    "description": "Valve module for traffic control and access management"

    },

    "tollgate-module-whoami-go": {

    "version": "0.1.0",

    "description": "WhoAmI module for identity and authentication services"

    }

    },

    "nip94eventwhitelist": {

    "authorized_npubs": [

    "...",

    "...",

    "..."

    ]

    },

    "relays": [

    "wss://relay.damus.io",

    "wss://nos.lol",

    "wss://nostr.mom",

    "wss://relay.nostr.band",

    "wss://relay.snort.social"

    ],

    "last_updated": "2025-03-13"

    }

    ```

    ```mermaid

    graph TD

    Start[Start Image Builder] --> ReadConfig[Read Release JSON]

    ReadConfig --> FetchModules[Fetch Modules via NIP-94]

    FetchModules --> BuildImage[Build OpenWRT Image]

    BuildImage --> UploadImage[Upload to Blossom]

    UploadImage --> AnnounceRelease[Publish NIP-94 Announcement]

    %% Define classes for styling

    classDef input fill:#4caf50,stroke:#2e7d32,color:white;

    classDef process fill:#2196f3,stroke:#0d47a1,color:white;

    classDef nostr fill:#8624f5,stroke:#6c13d8,color:white;

    classDef output fill:#f7931a,stroke:#e68a00,color:white;

    %% Apply classes to nodes

    class Start,ReadConfig input;

    class BuildImage process;

    class FetchModules,AnnounceRelease nostr;

    class UploadImage output;

    ```


    ### Goals for the coming week

    - [ ] Start a TIP-01 draft

    - [ ] Pre-build golang

    - [ ] Get the package from the new SDK action to install

    - [ ] Implement the release image build from NIP-94 events

    - [ ] Figure out how to build rust modules with the SDK (merchant)


    No comments yet.