Skip to content

Commit ee4e524

Browse files
Improve template & readme
1 parent 42a8b15 commit ee4e524

File tree

4 files changed

+48
-40
lines changed

4 files changed

+48
-40
lines changed

.github/workflows/CD.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CD
1+
name: Deploy CSS
22

33
on:
44
push:

README.md

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,71 @@
22

33
## Pre-requisite
44

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+
87

8+
## Deploy infrastructure from CLI
99

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)).
1311

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).
1413

15-
## Deploy ARM Template from local
14+
```zsh
15+
CSS_INFRASTRUCTURE_RESOURCE_GROUP_NAME=css
16+
CSS_INFRASTRUCTURE_LOCATION="UK South"
17+
```
1618

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+
```
1724

25+
Then login (and select the desired Azure Subscription), create the resource group if it doesn't exist and deploy the arm template.
1826

19-
```bash
27+
```zsh
2028
az login
2129

22-
az group create --name 182764JH --location "UK South"
30+
az group create --name $CSS_INFRASTRUCTURE_RESOURCE_GROUP_NAME --location $CSS_INFRASTRUCTURE_LOCATION
2331

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+
```
2534

26-
az deployment group create --resource-group 182764JH --template-file ./infrastructure/template.json
2735

36+
## Deploy CSS in an existing App service using a GitHub action
2837

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`.
2939

40+
The app service name is the one you set deploying the infrastructure:
3041

42+
```zsh
43+
echo ${CSS_INFRASTRUCTURE_DEPLOYMENT_TIME}app
44+
```
3145

32-
az deployment sub create --location <location> --template-file <path-to-template>
46+
Retrieve the app service's Publish Profile:
3347

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+
```
3551

52+
Then just trigger the Deploy CSS action from GitHub.
3653

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).
3755

38-
```
3956

40-
GitHub action authenticate for ARM Template deploy.
57+
## Setting up CSS
4158

59+
This repository is setup to run CSS with bare minimum Solid standard functionality using [ACP](https://solidproject.org/TR/acp) for authorization.
4260

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.
4462

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.
4664

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.
4866

49-
Github > settings > Secrets and variables > Actions > set
5067

51-
AZUREAPPSERVICE_PUBLISHPROFILE
68+
## Note
5269

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.
5471

55-
AZUREAPPSERVICE_NAME (using template name)
72+
Currently, the App Service Free Plan is limited to 60 CPU minutes / day.

infrastructure/template.json

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@
66
"defaultValue": "[resourceGroup().location]",
77
"type": "string"
88
},
9+
"deployment_time": {
10+
"defaultValue": "[utcNow('yyyyMMddHHmmss')]",
11+
"type": "string"
12+
},
913
"app_service_plan_name": {
10-
"defaultValue": "[concat(utcNow('yyyyMMddHHmmss'), 'plan')]",
14+
"defaultValue": "[concat(parameters('deployment_time'), 'plan')]",
1115
"type": "string"
1216
},
1317
"app_service_name": {
14-
"defaultValue": "[concat(utcNow('yyyyMMddHHmmss'), 'app')]",
18+
"defaultValue": "[concat(parameters('deployment_time'), 'app')]",
1519
"type": "string"
1620
},
1721
"storage_account_name": {
18-
"defaultValue": "[concat(utcNow('yyyyMMddHHmmss'), 'blob')]",
22+
"defaultValue": "[concat(parameters('deployment_time'), 'blob')]",
1923
"type": "string"
2024
},
2125
"file_share_name": {
@@ -351,19 +355,6 @@
351355
"active": true
352356
}
353357
},
354-
{
355-
"type": "Microsoft.Web/sites/hostNameBindings",
356-
"apiVersion": "2024-11-01",
357-
"name": "[concat(parameters('app_service_name'), '/', parameters('app_service_name'), '-bvh5hqh9g6g9anhx.uksouth-01.azurewebsites.net')]",
358-
"location": "[parameters('location')]",
359-
"dependsOn": [
360-
"[resourceId('Microsoft.Web/sites', parameters('app_service_name'))]"
361-
],
362-
"properties": {
363-
"siteName": "css",
364-
"hostNameType": "Verified"
365-
}
366-
},
367358
{
368359
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
369360
"apiVersion": "2025-01-01",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"main": "./index.js",
88
"scripts": {
99
"start": "node . --config ./config/config.json --baseUrl \"https://$WEBSITE_HOSTNAME\" --rootFilePath /data --mainModulePath . --loggingLevel info --port $PORT",
10-
"start:dev": "node . --config ./config/config.json --rootFilePath data/ --mainModulePath . --loggingLevel info --port 8080"
10+
"start:dev": "node . --config ./config/config.json --rootFilePath ./data --mainModulePath . --loggingLevel info --port 8080"
1111
},
1212
"files": [
1313
"config"

0 commit comments

Comments
 (0)