Skip to content

Commit

Permalink
Squash commits and + x64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jldeen committed Apr 3, 2020
1 parent 48bc2ff commit 83a4e18
Show file tree
Hide file tree
Showing 15 changed files with 671 additions and 70 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/master_ghostest27jd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches:
- 64bit

name: ghosttest


env:
resourceGroup: "ghostest27jd2"
location: centralus
subName: "ca-jessde-demo-test"
storageName: "ghostest27jd"
webappName: "ghostest27jd"
storageSku: Standard_LRS

jobs:
build:
runs-on: windows-latest
steps:
# checkout branch
- name: git checkout master branch
uses: actions/checkout@master

# log into Azure
- name: "Login via Azure CLI"
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Set up Node.js version
uses: actions/setup-node@v1
with:
node-version: '10.15.2'

- run: npm install

- run: npm run build --if-present
env:
CI: true

- name: Clean up
run: |
'Remove-Item .\node_modules -Recurse'
deploy:
runs-on: ubuntu-latest
needs: build
steps:
# log into Azure
- name: "Login via Azure CLI"
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

# checkout branch
- name: git checkout master branch
uses: actions/checkout@master

# create resource group
- name: "Create Resource Group"
run: |
az group create --subscription "$subName" --name $resourceGroup --location $location
- name: "Create App Service Plan"
run : |
az appservice plan create -g $resourceGroup -n $webappName --sku S1
- name: 'create storage'
run: |
az storage account create -n $storageName -g $resourceGroup -l $location --sku $storageSku
- name: 'webapp create'
run: |
az webapp create --resource-group $resourceGroup --plan $webappName --name $webappName
az webapp log config -n $webappName -g $resourceGroup --web-server-logging filesystem
- name: 'web app config'
run: |
az webapp config set -g $resourceGroup -n $webappName \
--always-on true \
--use-32bit-worker-process false \
--web-sockets-enabled true \
--remote-debugging-enabled true
- name: 'app settings'
run: |
connString=$(az storage account show-connection-string --resource-group $resourceGroup --name $storageName -o tsv)
az webapp config appsettings set --resource-group $resourceGroup --name $webappName --settings \
url=https://$webappName.azurewebsites.net \
WEBSITE_NODE_DEFAULT_VERSION="D:\Program Files\nodejs\10.15.2\node" \
languageWorkers:node:defaultExecutablePath="D:\Program Files\nodejs\10.15.2\node" \
WEBSITE_NPM_DEFAULT_VERSION="6.4.1" \
NODE_ENV="production" \
npm_config_arch="x64" \
AZURE_STORAGE_CONNECTION_STRING=$connString
- name: 'Run Azure webapp deploy action using publish profile credentials'
uses: azure/webapps-deploy@v2
with:
app-name: 'ghostest27jd'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_27a2430c6eac4fd5b68e3b43483608dc }}
package: .
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Ghost-Azure
# Ghost-Azure x64 with @jldeen's [Azure Storage Adapter](https://github.com/jldeen/ghost-azurestorage)

## Pre-Notes:
This project is intended to help someone get started, but is not intended for production - you should always use a full CI/CD pipeline for production.

## Why Ghost-Azure?
Straight out of the box, the current 1.x and 2.x versions of Ghost aren't compatible with the Azure App Service. Ghost-Azure resolves this by providing a production-ready template which can be hosted directly on Azure App Service. In the background, an Azure Function ([Ghost-Release-Uploader](https://github.com/YannickRe/Ghost-Release-Uploader)) makes sure that this repository stays up-to-date with the latest releases of Ghost.
Most of the work has been done by [Radoslav Gatev](https://www.gatevnotes.com/introducing-ghost-2-on-azure-web-app-service/) who created the deployment template and the release uploader. Due to unknown reasons his repository wasn't being kept up-to-date with the latest releases, so we forked it and ran our own processes.
Expand Down
103 changes: 89 additions & 14 deletions azuredeploy.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.2",
"parameters": {
"siteName": {
Expand Down Expand Up @@ -45,6 +45,16 @@
],
"defaultValue": "Not configured"
},
"storageAccountType": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS",
"Premium_LRS"
]
},
"Email Username": {
"type": "string",
"defaultValue": ""
Expand All @@ -65,20 +75,47 @@
}
},
"variables": {
"storageAccountName": "[concat('ghoststore', uniquestring(resourceGroup().id))]",
"storageAccountId": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
"skuMapping": "[if(equals(parameters('sku'), 'Free'), 'F', if(equals(parameters('sku'), 'Shared'), 'D', if(equals(parameters('sku'), 'Basic'), 'B', if(equals(parameters('sku'), 'Standard'), 'S', if(equals(parameters('sku'), 'Premium'), 'P', 'F')))))]",
"sku": "[concat(variables('skuMapping'), parameters('Worker Size'))]",
"appInsightsName": "[concat(parameters('siteName'), '-insights')]"
"appInsightsName": "[concat(parameters('siteName'), '-insights')]",
"siteProperties": {
"netFrameworkVersion": "v4.7",
"use32BitWorkerProcess": false,
"httpsonly": true,
"webSocketsEnabled": true,
"alwaysOn": true,
"requestTracingEnabled": true,
"httpLoggingEnabled": true,
"logsDirectorySizeLimit": 40,
"detailedErrorLoggingEnabled": true,
"remoteDebuggingEnabled": true
}
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2018-11-01",
"name": "[variables('storageAccountName')]",
"location": "[parameters('siteLocation')]",
"sku": {
"name": "[parameters('storageAccountType')]"
},
"kind": "StorageV2",
"properties": {}
},
{
"name": "[parameters('hostingPlanName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[parameters('siteLocation')]",
"apiVersion": "2016-09-01",
"apiVersion": "2018-02-01",
"sku": {
"name": "[variables('sku')]"
},
"dependsOn": [],
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
],
"properties": {
"name": "[parameters('hostingPlanName')]",
"numberOfWorkers": 1
Expand All @@ -88,7 +125,7 @@
"name": "[parameters('siteName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('siteLocation')]",
"apiVersion": "2016-08-01",
"apiVersion": "2018-11-01",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
],
Expand All @@ -101,14 +138,51 @@
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2018-11-01",
"name": "web",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]"
],
"properties": "[variables('siteProperties')]"
},
{
"apiVersion": "2018-11-01",
"name": "logs",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
],
"properties": {
"applicationLogs": {
"fileSystem": {
"level": "Warning"
}
},
"httpLogs": {
"fileSystem": {
"retentionInMb": 40,
"retentionInDays": 30,
"enabled": true
}
},
"failedRequestsTracing": {
"enabled": true
},
"detailedErrorMessages": {
"enabled": true
}
}
},
{
"name": "appsettings",
"type": "config",
"apiVersion": "2016-08-01",
"apiVersion": "2018-11-01",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]",
"[resourceId('Microsoft.Web/sites/sourcecontrols', parameters('siteName'), 'web')]",
"[resourceId('Microsoft.Insights/components', variables('appInsightsName'))]"
"[resourceId('Microsoft.Insights/components', variables('appInsightsName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
],
"properties": {
"url": "[concat('https://', reference(resourceId('Microsoft.Web/sites', parameters('siteName'))).hostNames[0])]",
Expand All @@ -117,18 +191,19 @@
"mail__options__auth__user": "[parameters('Email Username')]",
"mail__options__auth__pass": "[parameters('Email Password')]",
"mail__from": "[parameters('Email From Address')]",
"WEBSITE_NODE_DEFAULT_VERSION": "10.15.2",
"npm_config_arch": "x64",
"WEBSITE_NODE_DEFAULT_VERSION": "~10",
"NODE_ENV": "production",
"APPINSIGHTS_INSTRUMENTATION_KEY": "[reference(concat('Microsoft.Insights/components/', variables('appInsightsName'))).InstrumentationKey]"
"APPINSIGHTS_INSTRUMENTATION_KEY": "[reference(concat('Microsoft.Insights/components/', variables('appInsightsName'))).InstrumentationKey]",
"AZURE_STORAGE_CONNECTION_STRING": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',concat(listKeys(variables('storageAccountId'), '2018-11-01').keys[0].value))]"
}
},
{
"name": "web",
"type": "sourcecontrols",
"apiVersion": "2016-08-01",
"apiVersion": "2018-11-01",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]"
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]",
"[resourceId('Microsoft.Web/sites/config', parameters('siteName'), 'appsettings')]"
],
"properties": {
"repoUrl": "[parameters('repoUrl')]",
Expand Down Expand Up @@ -157,4 +232,4 @@
}
}
]
}
}
8 changes: 8 additions & 0 deletions config.production.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,13 @@
"frontend": {
"maxAge": 600
}
},
"storage": {
"active": "ghost-storage-azure",
"ghost-storage-azure": {
"useHttps" : "true",
"cacheControl" : "2592000",
"useDatedFolder" : true
}
}
}
21 changes: 21 additions & 0 deletions content/adapters/storage/ghost-storage-azure/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2019 Jessica Deen <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit 83a4e18

Please sign in to comment.