File tree Expand file tree Collapse file tree 4 files changed +120
-0
lines changed
Expand file tree Collapse file tree 4 files changed +120
-0
lines changed Original file line number Diff line number Diff line change 1+ AZURE_RESOUCE_GROUP =
2+ ACR_PASSWORD =
3+ AZURE_STORAGE_ACCOUNT_NAME =
4+ AZURE_STORAGE_ACCOUNT_KEY =
5+ AZURE_SSH_USERS =
Original file line number Diff line number Diff line change 1+ # Deploy docker iamge to ACI
2+
3+ ## Create ACI
4+
5+ The below commands are to create new ACI by mounting fileshare storage.
6+
7+ This creation can only be done one time if no need to change settings.
8+
9+ - first replace variables in YAML
10+
11+ ``` shell
12+ source ./.azure/.env
13+
14+ ACR_PASSWORD=${ACR_PASSWORD} \
15+ AZURE_STORAGE_ACCOUNT_NAME=${AZURE_STORAGE_ACCOUNT_NAME} \
16+ AZURE_STORAGE_ACCOUNT_KEY=${AZURE_STORAGE_ACCOUNT_KEY} \
17+ SSH_USERS=$SSH_USERS \
18+ ./.azure/aci-deploy.sh temp.yaml
19+ ```
20+
21+ - deploy
22+
23+ ``` shell
24+ az login
25+ az container create --resource-group ${AZURE_RESOUCE_GROUP} --file temp.yaml
26+
27+ # delete temp.yaml
28+ rm temp.yaml
29+ ```
30+
31+ ## Restart
32+
33+ when new image is deployed, ACI can be restarted.
34+
35+ ``` shell
36+ # restart
37+ az container restart --resource-group ${AZURE_RESOUCE_GROUP} --name cbsurge-rapida
38+ ```
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ YAML_FILE=" ./.azure/aci-deploy.yaml"
4+
5+ if [ -z " $AZURE_STORAGE_ACCOUNT_NAME " ]; then
6+ echo " Error: AZURE_STORAGE_ACCOUNT_NAME is not set. Please provide a valid value."
7+ exit 1
8+ fi
9+
10+ if [ -z " $AZURE_STORAGE_ACCOUNT_KEY " ]; then
11+ echo " Error: AZURE_STORAGE_ACCOUNT_KEY is not set. Please provide a valid value."
12+ exit 1
13+ fi
14+
15+ if [ -z " $ACR_PASSWORD " ]; then
16+ echo " Error: ACR_PASSWORD is not set. Please provide a valid value."
17+ exit 1
18+ fi
19+
20+ if [ -z " $SSH_USERS " ]; then
21+ echo " Error: SSH_USERS is not set. Please provide a valid value."
22+ exit 1
23+ fi
24+
25+ if [ -z " $1 " ]; then
26+ echo " Error: Output file name is not specified. Please provide an output file name as the first argument."
27+ exit 1
28+ fi
29+
30+ OUTPUT_FILE=" $1 "
31+
32+ sed -e " s/{ACR_PASSWORD}/$ACR_PASSWORD /" \
33+ -e " s/{AZURE_STORAGE_ACCOUNT_NAME}/$AZURE_STORAGE_ACCOUNT_NAME /" \
34+ -e " s/{AZURE_STORAGE_ACCOUNT_KEY}/$AZURE_STORAGE_ACCOUNT_KEY /" \
35+ -e " s/{SSH_USERS}/$SSH_USERS /" \
36+ " $YAML_FILE " > $OUTPUT_FILE
37+
38+ echo " $YAML_FILE was exported"
Original file line number Diff line number Diff line change 1+ apiVersion : ' 2019-12-01'
2+ location : eastus
3+ name : cbsurge-rapida
4+ properties :
5+ containers :
6+ - name : cbsurge-rapida
7+ properties :
8+ environmentVariables :
9+ - name : SSH_USERS
10+ value : " {SSH_USERS}"
11+ image : undpgeohub.azurecr.io/undp-data/geo-cb-surge:main
12+ ports :
13+ - port : 22
14+ resources :
15+ requests :
16+ cpu : 4
17+ memoryInGB : 16
18+ volumeMounts :
19+ - mountPath : /home
20+ name : fileshare-volume
21+ imageRegistryCredentials :
22+ - server : undpgeohub.azurecr.io
23+ username : undpgeohub
24+ password : {ACR_PASSWORD}
25+ osType : Linux
26+ restartPolicy : OnFailure
27+ ipAddress :
28+ type : Public
29+ ports :
30+ - port : 22
31+ dnsNameLabel : cbsurge-rapida
32+ volumes :
33+ - name : fileshare-volume
34+ azureFile :
35+ sharename : cbrapida-aci
36+ storageAccountName : {AZURE_STORAGE_ACCOUNT_NAME}
37+ storageAccountKey : {AZURE_STORAGE_ACCOUNT_KEY}
38+ tags : {}
39+ type : Microsoft.ContainerInstance/containerGroups
You can’t perform that action at this time.
0 commit comments