12 Commits

Author SHA1 Message Date
kelly bd9165311f removing sast - updated dockerfile for best practies
Build and Push Docker Image / build (push) Successful in 39s
2026-05-10 22:32:46 -05:00
kelly 76ddfcca2f SAST config update
Build and Push Docker Image / build (push) Failing after 5m37s
2026-05-10 22:22:38 -05:00
kelly 57c76771d4 adding SAST
Build and Push Docker Image / build (push) Failing after 5m45s
2026-05-10 21:45:55 -05:00
kelly fa9a5ad430 Merge pull request 'adding gitea actions autobuild to docker hub' (#3) from v0.2.1 into main
Build and Push Docker Image / build (push) Successful in 19s
Reviewed-on: #3
2026-05-04 23:07:13 -05:00
kelly 150be6cf33 testing apprise notifications on build
Build and Push Docker Image / build (push) Successful in 19s
2026-05-04 23:04:53 -05:00
kelly e2ed830d1a corrected build file
Build and Push Docker Image / build (push) Successful in 19s
2026-05-04 22:56:38 -05:00
kelly 8a15cf1b23 updated tagging on build actions 2026-05-04 22:55:58 -05:00
kelly e11a9c3ac9 testing gitea actions
Build and Push Docker Image / build (push) Successful in 3m4s
2026-05-04 22:41:23 -05:00
kelly fe4886a305 Merge pull request 'implementing better error handling' (#2) from v0.2 into main
Reviewed-on: #2
2026-05-04 21:40:28 -05:00
kelly 32400d8413 implementing better error handling 2026-05-04 16:45:35 -05:00
kelly e56b2027cd updated to have apprise as a notification option 2026-04-29 21:14:40 -05:00
Kelly Thomas Reardon 327cb22bfd Merge pull request #1 from blinkfink182/v0.1
v0.1
2024-09-02 10:22:26 -05:00
4 changed files with 163 additions and 25 deletions
+86
View File
@@ -0,0 +1,86 @@
name: Build and Push Docker Image
on:
push:
branches:
- "**"
jobs:
build:
runs-on: ubuntu-latest
# permissions:
# contents: read # Required to checkout and read repo files
# security-events: write # Required to upload SARIF files to Security tab
steps:
- name: Checkout
uses: actions/checkout@v4
# - name: Run Trivy vulnerability scanner in repo mode
# uses: aquasecurity/trivy-action@v0.36.0
# with:
# scan-type: 'fs'
# ignore-unfixed: true
# format: 'sarif'
# output: 'trivy-results.sarif'
# severity: 'CRITICAL,HIGH'
# - name: Upload Trivy scan results to GitHub Security tab
# uses: github/codeql-action/upload-sarif@v4
# with:
# sarif_file: 'trivy-results.sarif'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Compute image tag
id: tag
run: |
BRANCH="${{ gitea.ref_name }}"
if [ "$BRANCH" = "main" ]; then
TAG="latest"
elif [[ "$BRANCH" == v* ]]; then
TAG="$BRANCH"
else
TAG="test"
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: blinkfink182/qbt-gluetun-portmgr:${{ steps.tag.outputs.tag }}
- name: Notify Apprise (success)
if: success()
run: |
curl -X POST \
-H "Content-Type: application/json" \
-d "{
\"tags\": \"all\",
\"title\": \"Gitea Build Succeeded\",
\"body\": \"Repo: ${{ gitea.repository }}\\nBranch: ${{ gitea.ref_name }}\\nImage tag built successfully\"
}" \
http://10.47.0.213:4444/notify/926263506803e21d72e382edd0caf3fb510a9629d860601dfb79506b5758c133
- name: Notify Apprise (failure)
if: failure()
run: |
curl -X POST \
-H "Content-Type: application/json" \
-d "{
\"tags\": \"all\",
\"title\": \"Gitea Build Failed\",
\"body\": \"Repo: ${{ gitea.repository }}\\nBranch: ${{ gitea.ref_name }}\\nCheck logs in Gitea\"
}" \
http://10.47.0.213:4444/notify/926263506803e21d72e382edd0caf3fb510a9629d860601dfb79506b5758c133
+3 -1
View File
@@ -1,11 +1,13 @@
FROM mcr.microsoft.com/powershell FROM mcr.microsoft.com/powershell
USER 1000:1000
ENV SCHEDULE=60 ENV SCHEDULE=60
ENV GLUETUNFORWARDEDPORTFILE="/tmp/forwarded_port" ENV GLUETUNFORWARDEDPORTFILE="/tmp/forwarded_port"
VOLUME /tmp VOLUME /tmp
WORKDIR /data WORKDIR /data
ADD ["Start-QBTGluetunPortMgr.ps1", "/data/"] COPY ["Start-QBTGluetunPortMgr.ps1", "/data/"]
ENTRYPOINT ["pwsh", "-Command", "/data/Start-QBTGluetunPortMgr.ps1"] ENTRYPOINT ["pwsh", "-Command", "/data/Start-QBTGluetunPortMgr.ps1"]
+57 -10
View File
@@ -5,6 +5,58 @@
[string] $qbtUser = $ENV:QBTUSER [string] $qbtUser = $ENV:QBTUSER
[string] $qbtPassword = $ENV:QBTPASSWORD [string] $qbtPassword = $ENV:QBTPASSWORD
[string] $notificationWebhookURL = $ENV:NOTIFICATIONWEBHOOKURL [string] $notificationWebhookURL = $ENV:NOTIFICATIONWEBHOOKURL
[string] $discordWebhookURL = $ENV:DISCORDWEBHOOKURL
[string] $appriseWebhookURL = $ENV:APPRISEWEBHOOKURL
[string] $appriseWebhookTag = $ENV:APPRISEWEBHOOKTAG
function Send-Notification
{
param(
# Content of the notification
[Parameter(Mandatory=$true)]
[string]
$content
)
if ($notificationWebhookURL -or $discordWebhookURL)
{
if ($discordWebhookURL) { $notificationWebhookURL = $discordWebhookURL }
$headers = @{
"Content-Type"="application/json"
}
$body = @{
content=$content
# content="QBitTorrent Listening Port updated to $gluetunForwardedPort"
}
$json = $body | ConvertTo-Json
try {
Invoke-WebRequest -URI $notificationWebhookURL -Method post -Body $json -Headers $headers
}
catch {
Write-Host "Notification Error Encountered: $($global:Error[0])"
}
}
elseif ($appriseWebhookURL)
{
$headers = @{
"Content-Type"="application/json"
}
$body = @{
title="QBitTorrent Port Manager"
body=$content
# body="QBitTorrent Listening Port updated to $gluetunForwardedPort"
tags="$appriseWebhookTag"
}
$json = $body | ConvertTo-Json
try {
Invoke-WebRequest -URI $appriseWebhookURL -Method post -Body $json -Headers $headers
}
catch {
Write-Host "Notification Error Encountered: $($global:Error[0])"
}
}
}
while ($true) while ($true)
{ {
@@ -18,9 +70,9 @@ while ($true)
username = $qbtUser username = $qbtUser
password = $qbtPassword password = $qbtPassword
} }
try {
$qbtSession = [Microsoft.PowerShell.Commands.WebRequestSession]::new() $qbtSession = [Microsoft.PowerShell.Commands.WebRequestSession]::new()
$qbtResponse = Invoke-WebRequest -Uri "http://$($qbtHost):$($qbtPort)/api/v2/auth/login" -WebSession $qbtSession -Method POST -Headers $qbtHeaders -Body $qbtBody $qbtResponse = Invoke-WebRequest -Uri "http://$($qbtHost):$($qbtPort)/api/v2/auth/login" -WebSession $qbtSession -Method POST -Headers $qbtHeaders -Body $qbtBody
$qbtQueryResponse = Invoke-WebRequest -Uri "http://$($qbtHost):$($qbtPort)/api/v2/app/preferences" -WebSession $qbtSession -Method GET $qbtQueryResponse = Invoke-WebRequest -Uri "http://$($qbtHost):$($qbtPort)/api/v2/app/preferences" -WebSession $qbtSession -Method GET
$qbtListenPort = (ConvertFrom-Json $qbtQueryResponse.Content).listen_port $qbtListenPort = (ConvertFrom-Json $qbtQueryResponse.Content).listen_port
Write-Host "Current QBT Listening port: $qbtListenPort" Write-Host "Current QBT Listening port: $qbtListenPort"
@@ -33,17 +85,12 @@ while ($true)
{ {
$qbtPortChangeBody = 'json={"listen_port":' + $gluetunForwardedPort + '}' $qbtPortChangeBody = 'json={"listen_port":' + $gluetunForwardedPort + '}'
$qbtPortChangeResponse = Invoke-WebRequest -Uri "http://$($qbtHost):$($qbtPort)/api/v2/app/setPreferences" -WebSession $qbtSession -Method POST -Headers $qbtHeaders -Body $qbtPortChangeBody $qbtPortChangeResponse = Invoke-WebRequest -Uri "http://$($qbtHost):$($qbtPort)/api/v2/app/setPreferences" -WebSession $qbtSession -Method POST -Headers $qbtHeaders -Body $qbtPortChangeBody
if ($notificationWebhookURL) Send-Notification -content "QBitTorrent Listening Port updated to $gluetunForwardedPort"
{
$headers = @{
"Content-Type"="application/json"
} }
$body = @{
content="QBitTorrent Listening Port updated to $gluetunForwardedPort"
}
$json = $body | ConvertTo-Json
Invoke-WebRequest -URI $notificationWebhookURL -Method post -Body $json -Headers $headers
} }
catch {
Write-Host "Error encountered: $($global:Error[0])"
Send-Notification -content "Error encountered: $($global:Error[0])"
} }
Write-Host "Sleeping for $schedule minutes..." Write-Host "Sleeping for $schedule minutes..."
Start-Sleep ($schedule * 60) Start-Sleep ($schedule * 60)
+4 -1
View File
@@ -10,6 +10,9 @@ services:
- QBTPORT=8787 # qbittorrent port - QBTPORT=8787 # qbittorrent port
- QBTUSER=admin # qbittorrent webUI username - QBTUSER=admin # qbittorrent webUI username
- QBTPASSWORD=adminpass # qbittorrent webUI password - QBTPASSWORD=adminpass # qbittorrent webUI password
- NOTIFICATIONWEBHOOKURL=https://discord.com/api/webhooks/<webhookURL> # discord notification wehook URL #- NOTIFICATIONWEBHOOKURL=https://discord.com/api/webhooks/<webhookURL> # DEPRECATED discord notification wehook URL
#- DISCORDWEBHOOKURL=https://discord.com/api/webhooks/<webhookURL> # discord notification wehook URL
#- APPRISEWEBHOOKURL=https://apprisehost/notify/config # apprise notification url
#- APPRISEWEBHOOKTAG=all # apprise notification tag
volumes: volumes:
- C:/Docker/qbittorrent/gluetun/tmp:/tmp # REQUIRED: Path to where the 'forwarded_port' file from gluetun is stored - C:/Docker/qbittorrent/gluetun/tmp:/tmp # REQUIRED: Path to where the 'forwarded_port' file from gluetun is stored