201 lines
7.7 KiB
JSON
201 lines
7.7 KiB
JSON
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json",
|
|
"contentVersion": "1.50.0.0",
|
|
"parameters": {
|
|
"containerName": {
|
|
"type": "string",
|
|
"maxLength": 63,
|
|
"defaultValue": "bds-maneger"
|
|
},
|
|
"TelegramBotToken": {
|
|
"type": "string",
|
|
"defaultValue": "null"
|
|
},
|
|
"WorldName": {
|
|
"type": "string",
|
|
"defaultValue": "Minecraft Bedrock"
|
|
},
|
|
"ServerDescription": {
|
|
"type": "string",
|
|
"defaultValue": "The Bds Maneger in Docker"
|
|
},
|
|
"ServerGameMode": {
|
|
"type": "string",
|
|
"defaultValue": "survival",
|
|
"allowedValues": ["survival","creative","hardcore"]
|
|
},
|
|
"ServerDifficulty": {
|
|
"type": "string",
|
|
"defaultValue": "normal",
|
|
"allowedValues": ["normal","easy"]
|
|
},
|
|
"ServerPlayers": {
|
|
"type": "string",
|
|
"defaultValue": "30",
|
|
"metadata": {
|
|
"description": "The more players, the more CPU, the more RAM will be needed."
|
|
},
|
|
"allowedValues": ["5","10","15","20","25","30","35","40","45","50","70","100","200"]
|
|
},
|
|
"ServerPlatform": {
|
|
"type": "string",
|
|
"defaultValue": "bedrock",
|
|
"allowedValues": ["bedrock", "java", "pocketmine", "jsprismarine"],
|
|
"metadata": {
|
|
"description": "Bedrock: Phones, Xbox, Nintendo switch, etc. Java: Desktops"
|
|
}
|
|
},
|
|
"numberCpuCores": {
|
|
"type": "string",
|
|
"defaultValue": "2",
|
|
"allowedValues": ["1","2","3","4"]
|
|
},
|
|
"RamMemory": {
|
|
"type": "string",
|
|
"allowedValues": ["1","2","4","6","8","10"],
|
|
"defaultValue": "4"
|
|
}
|
|
},
|
|
"variables": {
|
|
"bdsstorage": "bdssave",
|
|
"StorageName": "[concat('bdssave', uniqueString(resourceGroup().id))]",
|
|
"DnsName": "[concat('bdsdns-', uniqueString(resourceGroup().id))]",
|
|
"bds_ports": [
|
|
{
|
|
"port": "1932",
|
|
"protocol": "TCP"
|
|
},
|
|
{
|
|
"port": "6565",
|
|
"protocol": "TCP"
|
|
},
|
|
{
|
|
"port": "19132",
|
|
"protocol": "UDP"
|
|
},
|
|
{
|
|
"port": "19133",
|
|
"protocol": "UDP"
|
|
}
|
|
]
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts",
|
|
"apiVersion": "2019-06-01",
|
|
"name": "[variables('StorageName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"kind": "StorageV2",
|
|
"sku": {
|
|
"name": "Standard_LRS",
|
|
"tier": "Standard"
|
|
},
|
|
"properties": {
|
|
"accessTier": "Hot",
|
|
"allowBlobPublicAccess": true,
|
|
"allowSharedKeyAccess": true,
|
|
"largeFileSharesState": "Enabled"
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
|
|
"apiVersion": "2019-06-01",
|
|
"name": "[concat(variables('StorageName'), '/default/', variables('bdsstorage'))]",
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Storage/storageAccounts', variables('StorageName'))]"
|
|
]
|
|
},
|
|
// Docker Bds Manegerg Image
|
|
{
|
|
"location": "[resourceGroup().location]",
|
|
"name": "[parameters('containerName')]",
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Storage/storageAccounts/fileServices/shares', variables('StorageName'), 'default', variables('bdsstorage') )]"
|
|
],
|
|
"type": "Microsoft.ContainerInstance/containerGroups",
|
|
"apiVersion": "2019-12-01",
|
|
"properties": {
|
|
"containers": [
|
|
{
|
|
"name": "[parameters('containerName')]",
|
|
"properties": {
|
|
"image": "bdsmaneger/core:latest",
|
|
"resources": {
|
|
"requests": {
|
|
"cpu": "[int(parameters('numberCpuCores'))]",
|
|
"memoryInGB": "[float(parameters('RamMemory'))]"
|
|
}
|
|
},
|
|
"ports": "[variables('bds_ports')]",
|
|
"environmentVariables": [
|
|
{
|
|
"name": "TELEGRAM_TOKEN",
|
|
"value": "[parameters('TelegramBotToken')]"
|
|
},
|
|
{
|
|
"name": "WORLD_NAME",
|
|
"value": "[parameters('WorldName')]"
|
|
},
|
|
{
|
|
"name": "DESCRIPTION",
|
|
"value": "[parameters('ServerDescription')]"
|
|
},
|
|
{
|
|
"name": "GAMEMODE",
|
|
"value": "[parameters('ServerGameMode')]"
|
|
},
|
|
{
|
|
"name": "DIFFICULTY",
|
|
"value": "[parameters('ServerDifficulty')]"
|
|
},
|
|
{
|
|
"name": "PLAYERS",
|
|
"value": "[parameters('ServerPlayers')]"
|
|
},
|
|
{
|
|
"name": "SERVER",
|
|
"value": "[parameters('ServerPlatform')]"
|
|
},
|
|
{
|
|
"name": "BDS_VERSION",
|
|
"value": "latest"
|
|
}
|
|
],
|
|
"volumeMounts": [
|
|
{
|
|
"name": "save",
|
|
"mountPath": "/home/bds"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"restartPolicy": "OnFailure",
|
|
"osType": "Linux",
|
|
"ipAddress": {
|
|
"type": "Public",
|
|
"ports": "[variables('bds_ports')]",
|
|
"dnsNameLabel": "[variables('DnsName')]"
|
|
},
|
|
"volumes": [
|
|
{
|
|
"name": "save",
|
|
"azureFile": {
|
|
"shareName": "[variables('bdsstorage')]",
|
|
"StorageAccountName": "[variables('StorageName')]",
|
|
// https://stackoverflow.com/a/33227123
|
|
"storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('StorageName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[1].value]"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"tags": {}
|
|
}
|
|
],
|
|
"outputs": {
|
|
"containerIPv4Address": {
|
|
"type": "string",
|
|
"value": "[reference(resourceId('Microsoft.ContainerInstance/containerGroups/', parameters('containerName'))).ipAddress.ip]"
|
|
}
|
|
}
|
|
} |