|
2 | 2 |
|
3 | 3 | ## Pre-requisite |
4 | 4 |
|
5 | | -```bash |
6 | | -brew update && brew install azure-cli |
7 | | -``` |
| 5 | +An [Azure Subscription](https://azure.microsoft.com/en-us/pricing/purchase-options/azure-account). |
| 6 | + |
8 | 7 |
|
| 8 | +## Deploy infrastructure from CLI |
9 | 9 |
|
10 | | -An existing [App Service on Linux app](https://learn.microsoft.com/en-us/azure/app-service/). |
11 | | -An Azure Storage account. |
12 | | -An Azure file share and directory. |
| 10 | +You can deploy a minimal infrastructure to host the CSS using the Azure CLI and the arm template in `./infrastructure/template.json` ([install Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)). |
13 | 11 |
|
| 12 | +You'll need to choose a [resource group](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/overview#resource-groups) name and a [location](https://learn.microsoft.com/en-us/azure/reliability/regions-list#azure-regions-list-1). |
14 | 13 |
|
15 | | -## Deploy ARM Template from local |
| 14 | +```zsh |
| 15 | +CSS_INFRASTRUCTURE_RESOURCE_GROUP_NAME=css |
| 16 | +CSS_INFRASTRUCTURE_LOCATION="UK South" |
| 17 | +``` |
16 | 18 |
|
| 19 | +To keep track of the app service name which is useful for retrieving its publish profile and setting up the GiHub Action secrets, you can set a deployment time: |
| 20 | + |
| 21 | +```zsh |
| 22 | +CSS_INFRASTRUCTURE_DEPLOYMENT_TIME=$(date '+%Y%m%d%H%M%S') |
| 23 | +``` |
17 | 24 |
|
| 25 | +Then login (and select the desired Azure Subscription), create the resource group if it doesn't exist and deploy the arm template. |
18 | 26 |
|
19 | | -```bash |
| 27 | +```zsh |
20 | 28 | az login |
21 | 29 |
|
22 | | -az group create --name 182764JH --location "UK South" |
| 30 | +az group create --name $CSS_INFRASTRUCTURE_RESOURCE_GROUP_NAME --location $CSS_INFRASTRUCTURE_LOCATION |
23 | 31 |
|
24 | | -az deployment group create --resource-group <resource-group-name> --template-file <path-to-template> |
| 32 | +az deployment group create --resource-group $CSS_INFRASTRUCTURE_RESOURCE_GROUP_NAME --template-file ./infrastructure/template.json --parameters deployment_time=$CSS_INFRASTRUCTURE_DEPLOYMENT_TIME |
| 33 | +``` |
25 | 34 |
|
26 | | -az deployment group create --resource-group 182764JH --template-file ./infrastructure/template.json |
27 | 35 |
|
| 36 | +## Deploy CSS in an existing App service using a GitHub action |
28 | 37 |
|
| 38 | +You'll need a copy of this repository with two [actions secrets set](https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets): `AZUREAPPSERVICE_NAME` & `AZUREAPPSERVICE_PUBLISHPROFILE`. |
29 | 39 |
|
| 40 | +The app service name is the one you set deploying the infrastructure: |
30 | 41 |
|
| 42 | +```zsh |
| 43 | +echo ${CSS_INFRASTRUCTURE_DEPLOYMENT_TIME}app |
| 44 | +``` |
31 | 45 |
|
32 | | -az deployment sub create --location <location> --template-file <path-to-template> |
| 46 | +Retrieve the app service's Publish Profile: |
33 | 47 |
|
34 | | -az deployment sub create --location "UK South" --template-file ./infrastructure/template.json |
| 48 | +```zsh |
| 49 | +az webapp deployment list-publishing-profiles --resource-group $CSS_INFRASTRUCTURE_RESOURCE_GROUP_NAME --name ${CSS_INFRASTRUCTURE_DEPLOYMENT_TIME}app --xml |
| 50 | +``` |
35 | 51 |
|
| 52 | +Then just trigger the Deploy CSS action from GitHub. |
36 | 53 |
|
| 54 | +See also: [Deploy Node.js to Azure App Services](https://docs.github.com/en/actions/how-tos/deploy/deploy-to-third-party-platforms/nodejs-to-azure-app-service). |
37 | 55 |
|
38 | | -``` |
39 | 56 |
|
40 | | -GitHub action authenticate for ARM Template deploy. |
| 57 | +## Setting up CSS |
41 | 58 |
|
| 59 | +This repository is setup to run CSS with bare minimum Solid standard functionality using [ACP](https://solidproject.org/TR/acp) for authorization. |
42 | 60 |
|
43 | | -## Setup CI |
| 61 | +Considering you will start from an empty Azure blob storage, in its initial state, CSS will find no authorization and all requests will return a `401` Unauthorized HTTP Error. |
44 | 62 |
|
45 | | -App Service > Configuration > General settings > SCM Basic Auth Publishing > ON |
| 63 | +You can bootstrap your environment by uploading the adequate access control policies and creating the default folder and resource structure in your Azure Blob storage file share. |
46 | 64 |
|
47 | | -App Service > Overview > Download publish profile |
| 65 | +For example, you could upload `data/.acr` to make the Solid server fully open to everyone (Read, Write, Control) and then let your app bootstrap permissions. |
48 | 66 |
|
49 | | -Github > settings > Secrets and variables > Actions > set |
50 | 67 |
|
51 | | -AZUREAPPSERVICE_PUBLISHPROFILE |
| 68 | +## Note |
52 | 69 |
|
53 | | -Set |
| 70 | +The first boot of the CSS will take a little time (about 3 minutes). If you choose a [paid App Service Plan](https://azure.microsoft.com/en-gb/pricing/details/app-service/linux/), your CSS instance could always be on and not have to go through booting time often. |
54 | 71 |
|
55 | | -AZUREAPPSERVICE_NAME (using template name) |
| 72 | +Currently, the App Service Free Plan is limited to 60 CPU minutes / day. |
0 commit comments