Websoft9 / websoft9

Applications self-hosting and DevOps platform for running open source, web-based linux Panel of lite PaaS
https://www.websoft9.com
Other
2.21k stars 336 forks source link

update to gen2 for azure at [mcloud] #496

Closed chendelin1982 closed 5 months ago

chendelin1982 commented 5 months ago

What type of your feature request?

we use gen1 VM, it should update to gen2

qiaofeng1227 commented 5 months ago
az vm create             --resource-group w9group --name websoft9-enterprise-UbuntuLTS22.04             --image Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:22.04.202405010 --size Standard_B2ms             --vnet-name websoft9-enterprise-UbuntuLTS22.04             --nsg websoft9  --use-unmanaged-disk --storage-account w9vmimages             --os-disk-name websoft9-enterprise-UbuntuLTS22.04 --admin-username websoft9             --ssh-key-value /root/.ssh/websoft9_auto.pub

--use-unmanaged-disk --storage-account w9vmimages -> delete

qiaofeng1227 commented 5 months ago
az storage container generate-sas             --name vhds --permissions rl              --start $(date -d "-2 day" +"%Y-%m-%d")              --expiry $(date -d "+10 day" +"%Y-%m-%d")
(0, '"st=2024-05-20&se=2024-06-01&sp=rl&sv=2022-11-02&sr=c&sig=PyofYsdnWHHXIrJUsp66ZVf9t1YmM7/4Mi62JOAtIQ4%3D"')

OS VHD URL创建成功:
https://w9vmimages.blob.core.windows.net/vhds/websoft9-free-Debian11.vhd?st=2024-05-20&se=2024-06-01&sp=rl&sv=2022-11-02&sr=c&sig=PyofYsdnWHHXIrJUsp66ZVf9t1YmM7/4Mi62JOAtIQ4%3D

恭喜你,websoft9-free-Debian11制作完成!

    ---万事俱备,只欠上架
您选择的是【测试VHD(创建VM)】操作,接下来请谨慎仔细做出操作对象选择

az storage blob list -c vhds | jq '[.[] | {id:.name,name:.name}]'

    选择任务或对象 [1/2/3..]:  

     0.websoft9-aitablelatest-UbuntuLTS22.04.vhd 
     1.websoft9-mysqlFavorite-Debian11.vhd 
     2.websoft9-mysqlFavorite-UbuntuLTS22.04.vhd 
     3.websoft9-postgresqlFavorite-Debian11.vhd 
     4.websoft9-postgresqlFavorite-UbuntuLTS22.04.vhd 
     5.websoft9-semaphoreFavorite-Debian11.vhd 

采用gen2生产的vhd,查询不出来

qiaofeng1227 commented 5 months ago

创建服务器

az vm create   --resource-group w9group --name websoft9-testFavorite-UbuntuLTS20.04   --image Canonical:0001-com-ubuntu-server-focal:20_04-lts-gen2:20.04.202404270 --size Standard_B2s     --vnet-name websoft9-testFavorite-UbuntuLTS20.04   --nsg websoft9    --os-disk-name websoft9-testFavorite-UbuntuLTS20.04 --admin-username websoft9   --ssh-key-value /root/.ssh/websoft9_auto.pub --security-type Standard

停止服务器
az vm deallocate --resource-group w9group --name websoft9-testFavorite-UbuntuLTS20.04

az vm generalize --resource-group w9group --name websoft9-testFavorite-UbuntuLTS20.04

az image create --resource-group w9group  --name websoft9-testFavorite-UbuntuLTS20.04 --source websoft9-testFavorite-UbuntuLTS20.04 --hyper-v-generation V2

az vm create   --resource-group w9group --name websoft9-testFavorite-UbuntuLTS20.04-check   --image websoft9-testFavorite-UbuntuLTS20.04 --size Standard_B2s     --vnet-name websoft9-testFavorite-UbuntuLTS20.04-check   --nsg websoft9    --os-disk-name websoft9-testFavorite-UbuntuLTS20.04-check --admin-username websoft9   --ssh-key-value /root/.ssh/websoft9_auto.pub 
qiaofeng1227 commented 5 months ago
qiaofeng1227 commented 5 months ago

托管型磁盘,vhd由azure来管理,查询不可见。

[root@d202384b9961 mcloud]# az disk show --name websoft9-testFavorite-UbuntuLTS20.04 --resource-group w9group
{
  "LastOwnershipUpdateTime": "2024-05-25T03:24:59.560251+00:00",
  "creationData": {
    "createOption": "FromImage",
    "imageReference": {
      "id": "/Subscriptions/18eff780-3c7d-438c-9fba-c39248752278/Providers/Microsoft.Compute/Locations/centralus/Publishers/Canonical/ArtifactTypes/VMImage/Offers/0001-com-ubuntu-server-focal/Skus/20_04-lts-gen2/Versions/20.04.202404270"
    }
  },
  "diskIOPSReadWrite": 120,
  "diskMBpsReadWrite": 25,
  "diskSizeBytes": 32213303296,
  "diskSizeGB": 30,
  "diskState": "Attached",
  "encryption": {
    "type": "EncryptionAtRestWithPlatformKey"
  },
  "hyperVGeneration": "V2",
  "id": "/subscriptions/18eff780-3c7d-438c-9fba-c39248752278/resourceGroups/w9group/providers/Microsoft.Compute/disks/websoft9-testFavorite-UbuntuLTS20.04",
  "location": "centralus",
  "managedBy": "/subscriptions/18eff780-3c7d-438c-9fba-c39248752278/resourceGroups/w9group/providers/Microsoft.Compute/virtualMachines/websoft9-testFavorite-UbuntuLTS20.04",
  "name": "websoft9-testFavorite-UbuntuLTS20.04",
  "networkAccessPolicy": "AllowAll",
  "osType": "Linux",
  "provisioningState": "Succeeded",
  "publicNetworkAccess": "Enabled",
  "resourceGroup": "w9group",
  "sku": {
    "name": "Premium_LRS",
    "tier": "Premium"
  },
  "supportedCapabilities": {
    "acceleratedNetwork": true,
    "architecture": "x64",
    "diskControllerTypes": "SCSI, NVMe"
  },
  "supportsHibernation": true,
  "tags": {},
  "tier": "P4",
  "timeCreated": "2024-05-25T03:24:59.560251+00:00",
  "type": "Microsoft.Compute/disks",
  "uniqueId": "6478417a-6dc9-403e-88e7-14b188924283"
}
qiaofeng1227 commented 5 months ago

可为托管型磁盘生成vhd url

[root@d202384b9961 mcloud]# az vm deallocate --resource-group w9group --name websoft9-testFavorite-UbuntuLTS20.04
[root@d202384b9961 mcloud]# az disk grant-access --resource-group w9group --name websoft9-testFavorite-UbuntuLTS20.04 --duration-in-seconds 604800
{
  "accessSas": "https://md-q3vf52khznlv.z35.blob.storage.azure.net/rd43xhc1cqjb/abcd?sv=2018-03-28&sr=b&si=8290fd4d-0c84-44a2-87b5-48f66140d7a2&sig=fZoNkwq%2BCn4PlrOHg3PGA553Ophre9VfZw1UVefjsf8%3D",
  "securityDataAccessSas": null
}
qiaofeng1227 commented 5 months ago

https://learn.microsoft.com/en-us/cli/azure/vm?view=azure-cli-latest#az-vm-create

qiaofeng1227 commented 5 months ago