af9f6e5ca0
* feat(db): add SQL query wrapper for PostgreSQL placeholder conversion - Created query_wrapper module with functions to automatically convert SQLite ? placeholders to PostgreSQL $1, $2, ... format - Updated build.rs to handle mutually exclusive feature flags - Modified one query in mixnodes.rs as proof of concept - Added type conversions for PostgreSQL compatibility (u32->i64, u16->i32) This is a checkpoint commit before converting all queries to use the wrapper. * feat(nym-node-status-api): add PostgreSQL database support via feature flags Implement dual database support for SQLite and PostgreSQL through Cargo feature flags. The implementation uses a query wrapper that automatically converts SQLite-style ? placeholders to PostgreSQL-style $1, $2, ... placeholders at runtime. Key changes: - Add query wrapper functions that handle placeholder conversion - Convert all sqlx::query\! macros to use wrapper functions - Handle type conversions between databases (i64 vs i32) - Add feature-gated implementations for database-specific SQL syntax - Update Makefile with clippy targets for both database features - Document database support in README * feat(nym-node-status-agent): add multi-API support with random selection Agents can now connect to multiple APIs and randomly select one for each testrun: - Accept multiple --server arguments in format "address:port:auth_key" - Randomly shuffle server list before attempting connections - Try each server until a testrun is obtained - Submit results back only to the API that provided the testrun - Continue to next server if one is down or has no testruns available * feat(nym-node-status): implement primary/secondary server architecture - Agent now requests testruns only from primary server (first in list) - Results are submitted to all configured servers in parallel - Secondary servers accept external testruns via new v2 endpoint - Added auto-creation of gateway and testrun records on secondary servers - New database queries: get_or_create_gateway, insert_external_testrun - Client library enhanced with submit_results_with_context method * Bump Node status API version * Fix build workdir * Bump to 3.1.4 * Fix types and queries * 3.1.6 * Fix gateway perf, bump 3.1.7 * NodeId -> i32, 3.1.8 * Bump agent version * i64 -> i32 * Use image yq * Migration and more types * Update remaining JSONB columns * Simplify server config * Update build path * Change delimiter * bump agent * Split up pg and sqlite builds * More typing fixes, build-and-push script * Fix Dockerfile-pg * Bump node-status-api * TYping * Agent build script * More logging around testruns * Fail loudly on read errors * Cleanup * Debug get gateways query * Fix get_gateways query * Use pg cert, 3.1.16 * Submit regular results to primary server * Bump freshenss cutoff * Update Cargo.lock * fix: resolve rebase conflicts and compilation errors After rebasing onto develop, fixed several issues: - Fixed borrowed data escapes error by using sqlx::query directly in transaction functions - Removed unused imports and cleaned up code - Maintained database-specific implementations for transaction functions * fmt * Make PG default to make lives easier * Performance improvements for Explorer v2 * Fix sqlite build * Fix PG migration * Tests round 1 * DB tests * More tests * And some more tests * And some more, more tests * cargo fmt * Fix some failing lints * Fix lioness version problems * Clippy in tests --------- Co-authored-by: dynco-nym <173912580+dynco-nym@users.noreply.github.com>
81 lines
3.0 KiB
YAML
81 lines
3.0 KiB
YAML
name: Build and upload Node Status agent container to harbor.nymte.ch
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
gateway_probe_git_ref:
|
|
type: string
|
|
default: nym-vpn-core-v1.4.0
|
|
required: true
|
|
description: Which gateway probe git ref to build the image with
|
|
release_image:
|
|
description: 'Tag image as a release'
|
|
required: true
|
|
default: false
|
|
type: boolean
|
|
|
|
env:
|
|
WORKING_DIRECTORY: "nym-node-status-api/nym-node-status-agent"
|
|
CONTAINER_NAME: "node-status-agent"
|
|
|
|
jobs:
|
|
build-container:
|
|
runs-on: arc-ubuntu-22.04-dind
|
|
steps:
|
|
- name: Login to Harbor
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: harbor.nymte.ch
|
|
username: ${{ secrets.HARBOR_ROBOT_USERNAME }}
|
|
password: ${{ secrets.HARBOR_ROBOT_SECRET }}
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Configure git identity
|
|
run: |
|
|
git config --global user.email "lawrence@nymtech.net"
|
|
git config --global user.name "Lawrence Stalder"
|
|
|
|
- name: Get version from cargo.toml
|
|
id: get_version
|
|
run: |
|
|
yq -oy '.package.version' ${{ env.WORKING_DIRECTORY }}/Cargo.toml
|
|
|
|
- name: cleanup-gateway-probe-ref
|
|
id: cleanup_gateway_probe_ref
|
|
run: |
|
|
GATEWAY_PROBE_GIT_REF=${{ github.event.inputs.gateway_probe_git_ref }}
|
|
GIT_REF_SLUG="${GATEWAY_PROBE_GIT_REF//\//-}"
|
|
echo "git_ref=${GIT_REF_SLUG}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Set GIT_TAG variable
|
|
run: echo "GIT_TAG=${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}-${{ steps.cleanup_gateway_probe_ref.outputs.git_ref }}" >> $GITHUB_ENV
|
|
|
|
- name: Set RELEASE_TAG variable
|
|
if: github.event.inputs.release_image == 'true'
|
|
run: echo "RELEASE_TAG=golden-" >> $GITHUB_ENV
|
|
|
|
- name: Set IMAGE_NAME_AND_TAGS variable
|
|
run: echo "IMAGE_NAME_AND_TAGS=${{ env.CONTAINER_NAME }}:${{ env.RELEASE_TAG }}${{ steps.get_version.outputs.result }}-${{ steps.cleanup_gateway_probe_ref.outputs.git_ref }}" >> $GITHUB_ENV
|
|
|
|
- name: New env vars
|
|
run: echo "RELEASE_TAG='$RELEASE_TAG' GIT_TAG='$GIT_TAG' IMAGE_NAME_AND_TAGS='$IMAGE_NAME_AND_TAGS'"
|
|
|
|
# - name: Remove existing tag if exists
|
|
# run: |
|
|
# if git rev-parse $${{ env.GIT_TAG }} >/dev/null 2>&1; then
|
|
# git push --delete origin $${{ env.GIT_TAG }}
|
|
# git tag -d $${{ env.GIT_TAG }}
|
|
# fi
|
|
|
|
# - name: Create tag
|
|
# run: |
|
|
# git tag -a $${{ env.GIT_TAG }} -m "Version ${{ steps.get_version.outputs.result }}-${{ steps.cleanup_gateway_probe_ref.outputs.git_ref }}"
|
|
# git push origin $${{ env.GIT_TAG }}
|
|
|
|
- name: BuildAndPushImageOnHarbor
|
|
run: |
|
|
docker build --build-arg GIT_REF=${{ github.event.inputs.gateway_probe_git_ref }} -f ${{ env.WORKING_DIRECTORY }}/Dockerfile . -t harbor.nymte.ch/nym/${{ env.IMAGE_NAME_AND_TAGS }}
|
|
docker push harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }} --all-tags
|