WebRTC load Test staging 10m {"asia-southeast1":1500} #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run a Load Test | |
run-name: ${{ inputs.playback-protocol }} load Test ${{ inputs.environment }} ${{ inputs.duration }} ${{ inputs.playback-region-viewers-json }} | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: Environment to load test | |
required: true | |
type: choice | |
options: [ "production", "staging" ] | |
default: "staging" | |
duration: | |
description: Duration of the test | |
required: true | |
type: string | |
default: 5m | |
streamer-region: | |
description: Streamer region (from Google Cloud) | |
type: string | |
required: true | |
default: us-central1 | |
playback-protocol: | |
description: Playback protocol | |
required: true | |
type: choice | |
options: [ "WebRTC", "HLS" ] | |
default: "WebRTC" | |
access-control: | |
description: Enable JWT access control | |
type: boolean | |
required: true | |
default: false | |
playback-region-viewers-json: | |
description: Number of viewers per region (from Google Cloud) | |
type: string | |
required: true | |
default: '{"us-central1":20,"europe-west2":20,"asia-southeast1":20}' | |
streamer-input-file: | |
description: File to ingest | |
type: string | |
required: true | |
default: 'https://test-harness-gcp.livepeer.fish/countdown_720p_30fps_2sGOP_noBframes_5min.mp4' | |
region: | |
description: "(Optional) Single-node test: Region of node to be tested (also needs pod index below). e.g.: mdw" | |
type: string | |
required: false | |
pod-index: | |
description: "(Optional) Single-node test: Index of the Catalyst pod to be tested (also needs region above). e.g.: 0" | |
type: string | |
required: false | |
extra-args: | |
description: "(Optional) Additional arguments to send to load test orchestrator" | |
type: string | |
required: false | |
jobs: | |
load-test: | |
name: Run ${{ inputs.playback-protocol }} load test | |
runs-on: ubuntu-latest | |
container: | |
image: livepeer/webrtc-load-tester:master | |
steps: | |
- name: calculate-dates-and-times | |
id: timestamp | |
uses: lee-dohm/calculate-dates-and-times@v1.0.2 | |
with: | |
format: "" | |
- name: Discord start notification | |
uses: Ilshidur/action-discord@0.3.2 | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
DISCORD_USERNAME: ${{ github.triggering_actor }} | |
DISCORD_EMBEDS: > | |
[{ | |
"title": "${{ inputs.playback-protocol }} load test starting", | |
"description": "A load test is starting in **${{ inputs.environment }}**", | |
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
"timestamp": "${{ steps.timestamp.outputs.date }}", | |
"author": { | |
"name": "${{ github.triggering_actor }}", | |
"url": "${{ github.server_url }}/${{ github.triggering_actor }}", | |
"icon_url": "${{ github.server_url }}/${{ github.triggering_actor }}.png?s=32" | |
}, | |
"fields": [{ | |
"name": "Environment", | |
"value": "${{ inputs.environment }}", | |
"inline": true | |
}, { | |
"name": "Triggered timestamp", | |
"value": "${{ steps.timestamp.outputs.date }}", | |
"inline": true | |
}, { | |
"name": "Duration", | |
"value": "${{ inputs.duration }}", | |
"inline": true | |
}, { | |
"name": "Streamer region", | |
"value": "${{ inputs.streamer-region }}", | |
"inline": true | |
}, { | |
"name": "Viewers regions", | |
"value": ${{ toJSON(inputs.playback-region-viewers-json) }}, | |
"inline": true | |
}, { | |
"name": "Single-node target", | |
"value": "${{ inputs.region }}-${{ inputs.pod-index }}", | |
"inline": true | |
}, { | |
"name": "Access control", | |
"value": "${{ inputs.access-control }}", | |
"inline": true | |
}] | |
}] | |
- name: Prepare environment | |
id: env | |
run: | | |
# Base configs | |
if [ "${{ inputs.environment }}" = "production" ]; then | |
API_SERVER="livepeer.com" | |
API_TOKEN="${{ secrets.LOAD_TEST_PROD_API_KEY }}" | |
STREAMER_BASE_URL="rtmp://rtmp.livepeer.com/live/" | |
PLAYBACK_BASE_URL="https://lvpr.tv/" | |
if [ "${{ inputs.access-control }}" = "true" ]; then | |
if [ -z "${{ inputs.region }}" ] && [ -z "${{ inputs.pod-index }}" ]; then | |
echo "Error: access-control is only available for single node tests" | |
exit 1 | |
fi | |
PLAYBACK_JWT_PRIVATE_KEY="${{ secrets.LOAD_TEST_PROD_JWT_PRIVATE_KEY }}" | |
fi | |
else | |
API_SERVER="livepeer.monster" | |
API_TOKEN="${{ secrets.LOAD_TEST_STAGING_API_KEY }}" | |
STREAMER_BASE_URL="rtmp://rtmp.livepeer.monster/live/" | |
PLAYBACK_BASE_URL="https://monster.lvpr.tv/" | |
if [ "${{ inputs.access-control }}" = "true" ]; then | |
if [ -z "${{ inputs.region }}" ] && [ -z "${{ inputs.pod-index }}" ]; then | |
echo "Error: access-control is only available for single node tests" | |
exit 1 | |
fi | |
PLAYBACK_JWT_PRIVATE_KEY="${{ secrets.LOAD_TEST_STAGING_JWT_PRIVATE_KEY }}" | |
fi | |
fi | |
# Override with inputs | |
if [ -n "${{ inputs.region }}" ] && [ -n "${{ inputs.pod-index }}" ]; then | |
if [ "${{ inputs.environment }}" = "production" ]; then | |
STREAMER_BASE_URL="rtmp://${{ inputs.region }}-prod-catalyst-${{ inputs.pod-index }}.lp-playback.studio/live" | |
PLAYBACK_MANIFEST_URL="https://${{ inputs.region }}-prod-catalyst-${{ inputs.pod-index }}.lp-playback.studio/webrtc/video+%s" | |
if [ "${{ inputs.playback-protocol }}" = "HLS" ]; then | |
PLAYBACK_BASE_URL="${PLAYBACK_BASE_URL}?lowLatency=false" | |
PLAYBACK_MANIFEST_URL="https://${{ inputs.region }}-prod-catalyst-${{ inputs.pod-index }}.lp-playback.studio/hls/video+%s/index.m3u8" | |
fi | |
else | |
STREAMER_BASE_URL="rtmp://${{ inputs.region }}-staging-staging-catalyst-${{ inputs.pod-index }}.livepeer.monster/live" | |
PLAYBACK_MANIFEST_URL="https://${{ inputs.region }}-staging-staging-catalyst-${{ inputs.pod-index }}.livepeer.monster/webrtc/video+%s" | |
if [ "${{ inputs.playback-protocol }}" = "HLS" ]; then | |
PLAYBACK_BASE_URL="${PLAYBACK_BASE_URL}?lowLatency=false" | |
PLAYBACK_MANIFEST_URL="https://${{ inputs.region }}-staging-staging-catalyst-${{ inputs.pod-index }}.livepeer.monster/hls/video+%s/index.m3u8" | |
fi | |
fi | |
fi | |
echo "api-server=${API_SERVER}" >> "${GITHUB_OUTPUT}" | |
echo "api-token=${API_TOKEN}" >> "${GITHUB_OUTPUT}" | |
echo "streamer-base-url=${STREAMER_BASE_URL}" >> "${GITHUB_OUTPUT}" | |
echo "playback-base-url=${PLAYBACK_BASE_URL}" >> "${GITHUB_OUTPUT}" | |
echo "playback-manifest-url=${PLAYBACK_MANIFEST_URL}" >> "${GITHUB_OUTPUT}" | |
echo "playback-jwt-private-key=${PLAYBACK_JWT_PRIVATE_KEY}" >> "${GITHUB_OUTPUT}" | |
- name: Load Test | |
run: webrtc-load-tester orchestrator ${{ inputs.extra-args }} | |
env: | |
LT_WEBRTC_DURATION: ${{ inputs.duration }} | |
LT_WEBRTC_API_SERVER: ${{ steps.env.outputs.api-server }} | |
LT_WEBRTC_API_TOKEN: ${{ steps.env.outputs.api-token }} | |
LT_WEBRTC_STREAMER_REGION: ${{ inputs.streamer-region }} | |
LT_WEBRTC_STREAMER_BASE_URL: ${{ steps.env.outputs.streamer-base-url }} | |
LT_WEBRTC_STREAMER_INPUT_FILE: ${{ inputs.streamer-input-file }} | |
LT_WEBRTC_PLAYBACK_BASE_URL: ${{ steps.env.outputs.playback-base-url }} | |
LT_WEBRTC_PLAYBACK_MANIFEST_URL: "${{ steps.env.outputs.playback-manifest-url }}" | |
LT_WEBRTC_PLAYBACK_JWT_PRIVATE_KEY: ${{ steps.env.outputs.playback-jwt-private-key }} | |
LT_WEBRTC_PLAYBACK_VIEWERS_PER_WORKER: 10 | |
LT_WEBRTC_PLAYBACK_MACHINE_TYPE: n2-highcpu-4 | |
LT_WEBRTC_PLAYBACK_REGION_VIEWERS_JSON: '${{ inputs.playback-region-viewers-json }}' | |
LT_WEBRTC_PLAYBACK_BASE_SCREENSHOT_FOLDER_OS: ${{ secrets.LOAD_TEST_SCREENSHOT_FOLDER_OS }} | |
LT_WEBRTC_GOOGLE_CREDENTIALS_JSON: '${{ secrets.LOAD_TEST_GOOGLE_CREDENTIALS_JSON }}' | |
- name: Discord finish notification | |
uses: Ilshidur/action-discord@0.3.2 | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
DISCORD_USERNAME: ${{ github.triggering_actor }} | |
DISCORD_EMBEDS: > | |
[{ | |
"title": "${{ inputs.playback-protocol }} load test finished successfully", | |
"description": "The load test has finished successfully", | |
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
"color": 24576, | |
"author": { | |
"name": "${{ github.triggering_actor }}", | |
"url": "${{ github.server_url }}/${{ github.triggering_actor }}", | |
"icon_url": "${{ github.server_url }}/${{ github.triggering_actor }}.png?s=32" | |
}, | |
"fields": [{ | |
"name": "Environment", | |
"value": "${{ inputs.environment }}", | |
"inline": true | |
}, { | |
"name": "Triggered timestamp", | |
"value": "${{ steps.timestamp.outputs.date }}", | |
"inline": true | |
}] | |
}] | |
- name: Discord failure notification | |
uses: Ilshidur/action-discord@0.3.2 | |
if: failure() | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
DISCORD_USERNAME: ${{ github.triggering_actor }} | |
DISCORD_EMBEDS: > | |
[{ | |
"title": "${{ inputs.playback-protocol }} load test has failed!", | |
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
"color": 8388608, | |
"author": { | |
"name": "${{ github.triggering_actor }}", | |
"url": "${{ github.server_url }}/${{ github.triggering_actor }}", | |
"icon_url": "${{ github.server_url }}/${{ github.triggering_actor }}.png?s=32" | |
}, | |
"fields": [{ | |
"name": "Environment", | |
"value": "${{ inputs.environment }}", | |
"inline": true | |
}, { | |
"name": "Triggered timestamp", | |
"value": "${{ steps.timestamp.outputs.date }}", | |
"inline": true | |
}] | |
}] | |
- name: Discord cancel notification | |
uses: Ilshidur/action-discord@0.3.2 | |
if: cancelled() | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
DISCORD_USERNAME: ${{ github.triggering_actor }} | |
DISCORD_EMBEDS: > | |
[{ | |
"title": "${{ inputs.playback-protocol }} load test was cancelled!", | |
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
"color": 11778048, | |
"author": { | |
"name": "${{ github.triggering_actor }}", | |
"url": "${{ github.server_url }}/${{ github.triggering_actor }}", | |
"icon_url": "${{ github.server_url }}/${{ github.triggering_actor }}.png?s=32" | |
}, | |
"fields": [{ | |
"name": "Environment", | |
"value": "${{ inputs.environment }}", | |
"inline": true | |
}, { | |
"name": "Triggered timestamp", | |
"value": "${{ steps.timestamp.outputs.date }}", | |
"inline": true | |
}] | |
}] |