-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ACI deploy yaml with mounting azure fileshare (#104)
- Loading branch information
1 parent
cdda8f6
commit 7c6b908
Showing
4 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
AZURE_RESOUCE_GROUP= | ||
ACR_PASSWORD= | ||
AZURE_STORAGE_ACCOUNT_NAME= | ||
AZURE_STORAGE_ACCOUNT_KEY= | ||
AZURE_SSH_USERS= |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Deploy docker iamge to ACI | ||
|
||
## Create ACI | ||
|
||
The below commands are to create new ACI by mounting fileshare storage. | ||
|
||
This creation can only be done one time if no need to change settings. | ||
|
||
- first replace variables in YAML | ||
|
||
```shell | ||
source ./.azure/.env | ||
|
||
ACR_PASSWORD=${ACR_PASSWORD} \ | ||
AZURE_STORAGE_ACCOUNT_NAME=${AZURE_STORAGE_ACCOUNT_NAME} \ | ||
AZURE_STORAGE_ACCOUNT_KEY=${AZURE_STORAGE_ACCOUNT_KEY} \ | ||
SSH_USERS=$SSH_USERS \ | ||
./.azure/aci-deploy.sh temp.yaml | ||
``` | ||
|
||
- deploy | ||
|
||
```shell | ||
az login | ||
az container create --resource-group ${AZURE_RESOUCE_GROUP} --file temp.yaml | ||
|
||
# delete temp.yaml | ||
rm temp.yaml | ||
``` | ||
|
||
## Restart | ||
|
||
when new image is deployed, ACI can be restarted. | ||
|
||
```shell | ||
# restart | ||
az container restart --resource-group ${AZURE_RESOUCE_GROUP} --name cbsurge-rapida | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
YAML_FILE="./.azure/aci-deploy.yaml" | ||
|
||
if [ -z "$AZURE_STORAGE_ACCOUNT_NAME" ]; then | ||
echo "Error: AZURE_STORAGE_ACCOUNT_NAME is not set. Please provide a valid value." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$AZURE_STORAGE_ACCOUNT_KEY" ]; then | ||
echo "Error: AZURE_STORAGE_ACCOUNT_KEY is not set. Please provide a valid value." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$ACR_PASSWORD" ]; then | ||
echo "Error: ACR_PASSWORD is not set. Please provide a valid value." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$SSH_USERS" ]; then | ||
echo "Error: SSH_USERS is not set. Please provide a valid value." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$1" ]; then | ||
echo "Error: Output file name is not specified. Please provide an output file name as the first argument." | ||
exit 1 | ||
fi | ||
|
||
OUTPUT_FILE="$1" | ||
|
||
sed -e "s/{ACR_PASSWORD}/$ACR_PASSWORD/" \ | ||
-e "s/{AZURE_STORAGE_ACCOUNT_NAME}/$AZURE_STORAGE_ACCOUNT_NAME/" \ | ||
-e "s/{AZURE_STORAGE_ACCOUNT_KEY}/$AZURE_STORAGE_ACCOUNT_KEY/" \ | ||
-e "s/{SSH_USERS}/$SSH_USERS/" \ | ||
"$YAML_FILE" > $OUTPUT_FILE | ||
|
||
echo "$YAML_FILE was exported" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: '2019-12-01' | ||
location: eastus | ||
name: cbsurge-rapida | ||
properties: | ||
containers: | ||
- name: cbsurge-rapida | ||
properties: | ||
environmentVariables: | ||
- name: SSH_USERS | ||
value: "{SSH_USERS}" | ||
image: undpgeohub.azurecr.io/undp-data/geo-cb-surge:main | ||
ports: | ||
- port: 22 | ||
resources: | ||
requests: | ||
cpu: 4 | ||
memoryInGB: 16 | ||
volumeMounts: | ||
- mountPath: /home | ||
name: fileshare-volume | ||
imageRegistryCredentials: | ||
- server: undpgeohub.azurecr.io | ||
username: undpgeohub | ||
password: {ACR_PASSWORD} | ||
osType: Linux | ||
restartPolicy: OnFailure | ||
ipAddress: | ||
type: Public | ||
ports: | ||
- port: 22 | ||
dnsNameLabel: cbsurge-rapida | ||
volumes: | ||
- name: fileshare-volume | ||
azureFile: | ||
sharename: cbrapida-aci | ||
storageAccountName: {AZURE_STORAGE_ACCOUNT_NAME} | ||
storageAccountKey: {AZURE_STORAGE_ACCOUNT_KEY} | ||
tags: {} | ||
type: Microsoft.ContainerInstance/containerGroups |