HUB
Sign inSign up

unholyw4r/ferryx-hub

By unholyw4r

•Updated 27 days ago

Trigger jobs on closed or local networks via a public hub and workers. No inbound access.

Image
Developer tools
0

1.7K

unholyw4r/ferryx-hub repository overview

⁠🚢 Ferryx Hub

Secure remote job triggering and deployment orchestration for private, VPN-only, and inbound-restricted networks.

Ferryx is a lightweight Hub-and-Worker system designed to execute deployment scripts and operational jobs in environments that cannot be reached directly from the internet.

Workers establish an outbound-only SignalR connection to a central Hub. CI/CD systems send authenticated webhook requests to the Hub, and the Hub routes each request to the appropriate Worker groups.

No inbound Worker port, static IP, or public Worker endpoint is required.


⁠✨ Features

  • Outbound-only Worker connections
  • JWT-protected deploy API
  • Target-to-group routing
  • Web-based management panel
  • Add, edit, and delete targets without restarting Hub
  • Live connected Worker monitoring
  • Persistent webhook and dispatch history
  • Worker execution status tracking
  • Exit code, execution duration, stdout, and stderr reporting
  • Automatic Worker reconnection
  • Built-in JWT generator
  • Worker Docker command generator
  • GitHub Actions and Jenkins compatible
  • Persistent configuration under /etc/ferryx

⁠🧱 Architecture

⁠🌐 Ferryx Hub

The Hub is normally installed on a publicly reachable server.

It:

  • receives authenticated HTTP deploy requests;
  • resolves the requested target;
  • determines which groups should be notified;
  • sends deploy events over SignalR;
  • displays connected Workers;
  • stores dispatch and execution history;
  • provides a complete management interface.
⁠🔒 Ferryx Worker

Workers run inside private or restricted networks.

Each Worker:

  • connects outbound to the Hub;
  • subscribes to one group;
  • receives matching deploy events;
  • executes its group-specific run.sh;
  • reports started, succeeded, or failed status;
  • reports exit code, duration, stdout, and stderr;
  • reconnects automatically when the Hub connection is interrupted.

⁠🚀 Run Ferryx Hub

docker run -d \
  --name ferryx \
  --restart unless-stopped \
  -p 18080:18080 \
  -e FERRYX_ADMIN_USERNAME='admin' \
  -e FERRYX_ADMIN_PASSWORD='change-me' \
  -e FERRYX_PUBLIC_URL='http://HUB_ADDRESS:18080' \
  -v /etc/ferryx:/etc/ferryx \
  unholyw4r/ferryx-hub:latest

The Hub always listens on container port 18080.

To publish it on a different host port:

-p 19000:18080

Then set:

-e FERRYX_PUBLIC_URL='http://HUB_ADDRESS:19000'

⁠🖥️ Management Panel

Open:

http://HUB_ADDRESS:18080/management/

The management panel provides:

  • connected Worker names and groups;
  • target and group management;
  • target creation, editing, and deletion;
  • incoming webhook history;
  • dispatch activity chart;
  • Worker execution results;
  • stdout and stderr inspection;
  • execution duration and exit code;
  • JWT generation with show, hide, and copy controls;
  • multi-group Worker Docker command generation.

Target changes made through the panel are written to the configuration file and applied immediately. Hub does not need to be restarted.

⁠Default credentials

If admin environment variables are not supplied:

Username: admin
Password: admin

Always configure a secure password in production:

-e FERRYX_ADMIN_USERNAME='admin' \
-e FERRYX_ADMIN_PASSWORD='YOUR_STRONG_PASSWORD'

The active management URL, configuration path, username, routing information, and startup status are printed in the container logs.

Passwords and JWT values are never printed.


⁠📁 Configuration

The Hub configuration is stored at:

/etc/ferryx/ferryx-hub.json

On first startup, Ferryx automatically creates the file and generates a secure JWT signing key.

Example:

{
  "Security": {
    "JwtKey": "AUTO_GENERATED_BASE64_KEY"
  },
  "Services": {
    "my-app": {
      "Groups": [
        "workgroup"
      ]
    },
    "billing-api": {
      "Groups": [
        "pre-prod",
        "production"
      ]
    }
  }
}

The mounted /etc/ferryx directory also contains:

  • dispatch history;
  • Worker execution history;
  • management authentication keys.

Keep this directory persistent.

Manual configuration-file changes require a Hub restart. Changes made through the management panel are applied immediately.


⁠🎯 Target and Group Routing

⁠Target

A Target represents an application or logical destination.

Examples:

billing-api
frontend
customer-service
my-app

The webhook request selects a Target using the target field.

⁠Group

A Group represents one or more Workers that should receive the deploy event.

Examples:

development
pre-prod
production
factory-network
workgroup

Each Worker subscribes to exactly one group.

A Target can route to multiple groups:

my-app → pre-prod, production

When my-app is triggered, every connected Worker subscribed to those groups receives the event.


⁠🔐 JWT Authentication

All deploy API requests and Worker connections require a Hub JWT.

Generate and copy a token from:

Management Panel → Hub JWT

The token should be stored as a protected CI/CD secret.

Example:

FERRYX_DEPLOY_TOKEN

Ferryx JWT tokens are intended for infrastructure-level trust. Protect both the token and the persistent /etc/ferryx directory.


⁠🧑‍🏭 Run Ferryx Worker

docker run -d \
  --name ferryx-worker \
  --restart unless-stopped \
  --user 0:0 \
  -e FERRYX_HUB_URL='http://HUB_ADDRESS:18080' \
  -e FERRYX_HUB_TOKEN='HUB_JWT' \
  -e FERRYX_GROUP='workgroup' \
  -v /ferryx/operation:/ferryx/operation \
  -v /var/run/docker.sock:/var/run/docker.sock \
  unholyw4r/ferryx-worker:latest
⁠Required environment variables
VariableDescription
FERRYX_HUB_URLHub address, including port
FERRYX_HUB_TOKENJWT generated by Hub
FERRYX_GROUPGroup the Worker subscribes to
⁠Optional environment variables
VariableDescription
FERRYX_WORKER_NAMEWorker name shown in the management panel
FERRYX_OPERATION_ROOTCustom operation root; default is /ferryx/operation

If FERRYX_WORKER_NAME is omitted, the container hostname is used.

Do not set ASPNETCORE_URLS or ASPNETCORE_HTTP_PORTS. Worker configures its internal health endpoint automatically.

Publishing Worker port 16080 is not required for deploy execution. If host-level health access is needed, add:

-p 16080:16080

Health endpoint:

http://WORKER_ADDRESS:16080/health

⁠⚙️ Worker Job Script

Each Worker executes:

/ferryx/operation/{FERRYX_GROUP}/run.sh

Example:

/ferryx/operation/workgroup/run.sh

Example script:

#!/usr/bin/env bash
set -euo pipefail

APP_IMAGE="{{ferryx_Meta.latestimage}}"
ENVIRONMENT="{{ferryx_Env}}"
TARGET="{{ferryx_Target}}"
TAG="{{ferryx_Tag}}"
GROUP="{{ferryx_Group}}"

echo "Environment: ${ENVIRONMENT}"
echo "Target: ${TARGET}"
echo "Tag: ${TAG}"
echo "Group: ${GROUP}"
echo "Image: ${APP_IMAGE}"

docker pull "${APP_IMAGE}"
docker compose up -d
⁠Available placeholders
{{ferryx_Env}}
{{ferryx_Target}}
{{ferryx_Tag}}
{{ferryx_Group}}
{{ferryx_Meta.key}}
{{ferryx_Meta.nested.key}}

The meta object is free-form and can carry image names, build numbers, release IDs, or other deployment parameters.


⁠🔔 Trigger a Deployment

curl --fail --location 'http://HUB_ADDRESS:18080/api/deploy' \
  --header 'Authorization: Bearer HUB_JWT' \
  --header 'Content-Type: application/json' \
  --data '{
    "env": "pre-prod",
    "target": "my-app",
    "tag": "v1.4.2",
    "meta": {
      "latestimage": "registry.example.com/my-app:v1.4.2",
      "build": {
        "number": "1042"
      }
    }
  }'
⁠Payload fields
FieldRequiredDescription
targetYesSelects the configured Target
envNoEnvironment or deployment context
tagNoRelease, version, or informational tag
metaNoFree-form metadata passed to Worker scripts

Example successful Hub response:

{
  "dispatchId": 42,
  "status": "published",
  "groups": [
    "workgroup"
  ]
}

published means the Hub delivered the event to the matching SignalR groups. The authoritative job outcome is the per-Worker execution result displayed in the management panel.


⁠📁 GitHub Actions Example

name: Deploy pre-prod

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Trigger Ferryx deployment
        run: |
          curl --fail --location 'http://HUB_ADDRESS:18080/api/deploy' \
            --header "Authorization: Bearer ${{ secrets.FERRYX_DEPLOY_TOKEN }}" \
            --header 'Content-Type: application/json' \
            --data '{
              "env": "pre-prod",
              "target": "my-app",
              "tag": "${{ github.sha }}",
              "meta": {
                "latestimage": "registry.example.com/my-app:${{ github.sha }}"
              }
            }'

⁠📁 Jenkins Example

pipeline {
  agent any

  environment {
    FERRYX_DEPLOY_TOKEN = credentials('ferryx-deploy-token')
  }

  stages {
    stage('Deploy pre-prod') {
      steps {
        sh '''
          curl --fail --location 'http://HUB_ADDRESS:18080/api/deploy' \
            --header "Authorization: Bearer $FERRYX_DEPLOY_TOKEN" \
            --header 'Content-Type: application/json' \
            --data '{
              "env": "pre-prod",
              "target": "my-app",
              "tag": "v1",
              "meta": {
                "latestimage": "registry.example.com/my-app:latest"
              }
            }'
        '''
      }
    }
  }
}

⁠📊 Monitoring and Execution History

The management panel distinguishes between:

  • the webhook reaching Hub;
  • Hub publishing the dispatch;
  • each Worker starting the job;
  • each Worker succeeding or failing.

For every Worker execution, Hub can display:

  • dispatch ID;
  • Worker name;
  • group;
  • start and finish time;
  • duration;
  • exit code;
  • stdout;
  • stderr.

Dispatch and execution history survive Hub container restarts when /etc/ferryx is mounted persistently.


⁠✅ Best Fit

Ferryx is suitable for:

  • VPN-only environments;
  • private data centers;
  • NAT-restricted servers;
  • factory and office networks;
  • on-premise deployments;
  • Docker and Docker Compose deployments;
  • infrastructure maintenance scripts;
  • CI/CD systems that cannot directly reach deployment servers.

⁠✅ Summary

  • Public or centrally reachable Hub
  • Private outbound-only Workers
  • JWT-protected trigger API
  • Target-to-group routing
  • Full management interface
  • Persistent dispatch and execution history
  • Worker exit code and log reporting
  • Automatic long-term reconnection
  • No inbound Worker access required

Tag summary

Content type

Image

Digest

sha256:333830616…

Size

91 MB

Last updated

27 days ago

docker pull unholyw4r/ferryx-hub