🐳

PaperWaveのバックエンドをAzureに移行

に公開

PaperWaveのバックエンドをGoogle CloudからAzureに移行する

作成日: 2025-07-17


Created at: 2025-07-17

目標

GCPではGCE + Artifact Registryで構成している.Cloud Runなどは対応させてない.とりあえず同じ構成をAzureで再現するところを今日の目標にする.
UTokyo Azureに移行したいというのが動機.


Created at: 2025-07-17

コンテナーレジストリの作成

まずはDocker ImageをAzureに置きたい.コンテナーレジストリがそれに対応してそう.
https://learn.microsoft.com/ja-jp/azure/container-registry/container-registry-intro

「ロールの割り当てアクセス許可モード (プレビュー)」の意味がわからない.
ドキュメントを見てもわからないので,Geminiに解説をお願いする.

解説を見ると,まずACがaccess controlの略だろうと推測できる.ただ,その前の部分の略語は教えてくれないので追加質問,理解した.

  • ABAC (Attribute-Based Access Control)
  • RBAC (Role-Based Access Control)

そこまで細かい設定は不要なので,RBACで良いとわかる.

リソースの作成完了.


Created at: 2025-07-17

Azure CLI

まだインストールしてなかったので,入れる.
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos?view=azure-cli-latest

az login
az acr login --name xxx

環境変数を書き換えてbuild & push.難なくできた.


Created at: 2025-07-17

Azure Container Instances

仮想マシンではなく,こちらで作るらしい.仮想マシンのイメージには,コンテナが出てこない.

az container create コマンドの認証にはadminの作成で対応できる.Cursorに聞いて教えてもらった.

# Admin userを有効化
az acr update -n <ACR_NAME> --admin-enabled true

# 認証情報の取得
az acr credential show -n <ACR_NAME>

エラー

(MissingSubscriptionRegistration) The subscription is not registered to use namespace 'Microsoft.ContainerInstance'. See https://aka.ms/rps-not-found for how to register subscriptions.
az provider register --namespace Microsoft.ContainerInstance
(InvalidOsType) The 'osType' for container group '<null>' is invalid. The value must be one of 'Windows,Linux'.
Code: InvalidOsType
Message: The 'osType' for container group '<null>' is invalid. The value must be one of 'Windows,Linux'.

Linuxとは明示する必要あり

できた.後は動いてるか確認する.

PaperGararge Diary

Discussion