Last active
April 4, 2022 14:37
-
-
Save ChenTanyi/0ee8c432cba990249e839bc20b2b7da7 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -e | |
# Simply create an Azure Web App with qBittorrent (only can download due to incoming TCP/UDP connection would be blocked) | |
RESOURCE_GROUP="" | |
APPSERVICE_PLAN="" | |
WEBAPP="" | |
STORAGE_ACCOUNT="" | |
# if no resource group and app service plan, uncomment the following command | |
# az group create -n "$RESOURCE_GROUP" -l eastus | |
# az appservice plan create -n "$APPSERVICE_PLAN" -g "$RESOURCE_GROUP" --sku B1 --is-linux | |
az storage account create -n "$STORAGE_ACCOUNT" -g "$RESOURCE_GROUP" | |
STORAGE_KEY=$(az storage account keys list -n "$STORAGE_ACCOUNT" -g "$RESOURCE_GROUP" --query "[0].value" -o tsv) | |
FILE_ENDPOINT=$(az storage account show -n "$STORAGE_ACCOUNT" -g "$RESOURCE_GROUP" --query "primaryEndpoints.file" -o tsv) | |
STORAGE_CONNSTR=$(az storage account show-connection-string -n "$STORAGE_ACCOUNT" -g "$RESOURCE_GROUP" --file-endpoint "$FILE_ENDPOINT" --query "connectionString" -o tsv) | |
az storage share create -n qbit --connection-string "$STORAGE_CONNSTR" --quota 128 | |
az storage share create -n qbit-config --connection-string "$STORAGE_CONNSTR" --quota 1 | |
FILE_HOST=${FILE_ENDPOINT#https://} | |
FILE_HOST=${FILE_HOST%/} | |
FILE_HOST_IP=$(dig +short "$FILE_HOST" | tail -1) | |
envsubst < qbit.tmplate.yml > docker-compose.yml | |
# az webapp create -n "$WEBAPP" -g "$RESOURCE_GROUP" -p "$APPSERVICE_PLAN" -i wernight/qbittorrent | |
# az webapp config appsettings set -n "$WEBAPP" -g "$RESOURCE_GROUP" --settings WEBSITES_PORT=8080 | |
# az webapp config storage-account add -g "$RESOURCE_GROUP" -n "$WEBAPP" -a "$STORAGE_ACCOUNT" -k "$STORAGE_KEY" -i qbit -t AzureFiles --sn qbit -m /downloads | |
# az webapp config storage-account add -g "$RESOURCE_GROUP" -n "$WEBAPP" -a "$STORAGE_ACCOUNT" -k "$STORAGE_KEY" -i qbit-config -t AzureFiles --sn qbit-config -m /config | |
# az webapp config storage-account list -g "$RESOURCE_GROUP" -n "$WEBAPP" -o json | |
az webapp create -n "$WEBAPP" -g "$RESOURCE_GROUP" -p "$APPSERVICE_PLAN" --multicontainer-config-type compose --multicontainer-config-file docker-compose.yml | |
az webapp update -n "$WEBAPP" -g "$RESOURCE_GROUP" --https-only |
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
#!/bin/bash | |
set -e | |
# Simply create an Azure Web App with v2proxy (UUID is required, REQ_PATH is optional) | |
RESOURCE_GROUP="" | |
APPSERVICE_PLAN="" | |
WEBAPP="" | |
UUID="" | |
REQ_PATH="" | |
# if no resource group and app service plan, uncomment the following command | |
# az group create -n "$RESOURCE_GROUP" -l eastus | |
# az appservice plan create -n "$APPSERVICE_PLAN" -g "$RESOURCE_GROUP" --sku B1 --is-linux | |
az webapp create -n "$WEBAPP" -g "$RESOURCE_GROUP" -p "$APPSERVICE_PLAN" -i chentanyi/v2proxy | |
az webapp update -n "$WEBAPP" -g "$RESOURCE_GROUP" --https-only | |
az webapp config appsettings set -n "$WEBAPP" -g "$RESOURCE_GROUP" --settings UUID="$UUID" | |
az webapp config appsettings set -n "$WEBAPP" -g "$RESOURCE_GROUP" --settings REQ_PATH="$REQ_PATH" |
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
version: "3" | |
services: | |
gotty: | |
image: wernight/qbittorrent | |
ports: | |
- 80:8080 | |
volumes: | |
- downloads:/downloads | |
- config:/config | |
volumes: | |
downloads: | |
driver_opts: | |
type: cifs | |
o: "addr=$FILE_HOST,username=$STORAGE_ACCOUNT,password=$STORAGE_KEY" | |
device: "//$FILE_HOST/qbit" | |
config: | |
driver_opts: | |
type: cifs | |
o: "addr=$FILE_HOST,username=$STORAGE_ACCOUNT,password=$STORAGE_KEY" | |
device: "//$FILE_HOST/qbit-config" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment