diff --git a/.gitignore b/.gitignore index 3a59ee7..1807edb 100644 --- a/.gitignore +++ b/.gitignore @@ -350,4 +350,8 @@ MigrationBackup/ .ionide/ # Additional files -.env \ No newline at end of file +.env +__queuestorage__/ +__azurite* +directus-address.json +test.sh \ No newline at end of file diff --git a/azure-deploy.sh b/azure-deploy.sh index 1e87931..33703dc 100644 --- a/azure-deploy.sh +++ b/azure-deploy.sh @@ -23,11 +23,55 @@ az group create \ -l $location echo "Deploying Resources..."; -az deployment group create \ +uid=`az deployment group create \ --name AzureSQL_Directus \ - --resource-group $resourceGroup \ + --resource-group "$resourceGroup" \ --template-file azuredeploy.json \ --parameters \ - location=$location + location="$location" \ + --query "properties.outputs.uniqueId.value" \ + --output tsv` + +echo "Generated Unique Id: $uid" + +echo "Writing client/directus-address.json..." +file="./client/directus-address.json" +site="https://directus-${uid}.azurewebsites.net" +rm -f -- $file +cat << EOF >> $file +[ + "$site" +] +EOF + +echo "Getting access to created storage account..." +storage="directus${uid}" +AZURE_STORAGE_CONNECTION_STRING=`az storage account show-connection-string -g "$resourceGroup" -n "$storage" --query "connectionString" -o tsv` + +echo "Creating container..." +az storage container create \ + --connection-string "$AZURE_STORAGE_CONNECTION_STRING" \ + -n '$web' + +echo "Uploading files..." +az storage blob upload-batch \ + --connection-string "$AZURE_STORAGE_CONNECTION_STRING" \ + -d '$web' \ + -s ./client + +echo "Enabling static website..." +az storage blob service-properties update \ + --connection-string "$AZURE_STORAGE_CONNECTION_STRING" \ + --account-name $storage \ + --static-website \ + --index-document index.html + +website=`az storage account show -g dm-directus-4 -n directusyxxjmrwglmr62 --query "primaryEndpoints.web" -o tsv` + +echo "Website available at: $website" + +echo "Creating Directus 'Todo' collection..." + +echo "Creating sample Todo items..." echo "Done." \ No newline at end of file diff --git a/azuredeploy.json b/azuredeploy.json index 8ab0b66..ec50a0e 100644 --- a/azuredeploy.json +++ b/azuredeploy.json @@ -427,5 +427,11 @@ "publicAccess": "None" } } - ] + ], + "outputs": { + "uniqueId": { + "type": "string", + "value": "[uniqueString(resourceGroup().id)]" + } + } } diff --git a/client/client-rest.html b/client/client-rest.html index 6b3c9d2..8ee2760 100644 --- a/client/client-rest.html +++ b/client/client-rest.html @@ -74,7 +74,8 @@

REST style