dukecheng / Moonglade

The .NET Core blog system of https://edi.wang, runs on Microsoft Azure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸŒ• Moonglade

Build Status

The blog system for edi.wang. Written in .NET Core and runs on Microsoft Azure.

image

πŸŽ‰ Features

Basic: Post, Comment, Category, Archive, Tag, Page, Friendlink

Misc: Pingback, RSS/Atom/OPML, Open Search, Reader View

πŸ›  Build and Run

Tools Alternative
.NET Core 3.1 SDK N/A
Visual Studio 2019 Visual Studio Code
Azure SQL Database SQL Server 2019 / LocalDB (Dev Only)

Setup Database

Development Production
Create an SQL Server 2019 LocalDB database. e.g. moonglade-dev Create an Azure SQL Database or a SQL Server 2019 database. e.g. moonglade-production
Update the MoongladeDatabase as your database connection string in appsettings.Development.json Set environment variable: ConnectionStrings__MoongladeDatabase as your connection string.
Connection String Example

If you are deploying to Azure App Service, you can set the connection string in the Configuration blade.

"MoongladeDatabase": "Server=(localdb)\\MSSQLLocalDB;Database=moonglade-dev;Trusted_Connection=True;"

πŸ”¨ Build Source

Build and run ./src/Moonglade.sln

  • Default Admin Username: admin
  • Default Admin Password: admin123

βš™ Configuration

Below section discuss system settings in appsettings.[env].json. For blog settings, please use "/admin/settings" UI.

For production, it is strongly recommended to use Environment Variables over appsetting.json file.

πŸ›‘ Authentication

Azure Active Directory (Preferred)

"Authentication": {
  "Provider": "AzureAD",
  "AzureAd": {
    "Domain": "{YOUR-VALUE}",
    "TenantId": "{YOUR-VALUE}",
    "ClientId": "{YOUR-VALUE}",
  }
}

Local Account (Alternative)

Set Authentication:Provider to "Local" and assign a pair of username and password.

Password is not encrypted, use it at your own risk.

"Authentication": {
  "Provider": "Local",
  "Local": {
    "Username": "admin",
    "Password": "admin123",
  }
}

πŸ–Ό Image Storage

AppSettings:ImageStorage controls how blog post images are stored.

Azure Blob Storage (Preferred)

You need to create an Azure Blob Storage with container level permission.

"Provider": "azurestorage"
"AzureStorageSettings": {
  "ConnectionString": "YOUR CONNECTION STRING",
  "ContainerName": "YOUR CONTAINER NAME"
}

πŸ“‚ File System (Alternative)

"Provider": "filesystem",
"FileSystemSettings": {
  "Path": "${basedir}\\UploadedImages"
}

The Path can be relative or absolute. "$\{basedir\}" represents the website's current directory. Storing images files under website directory is NOT recommended.

☁ CDN

If GetImageByCDNRedirect is set to true, the blog will get images from client browser using a 302 redirect. This is especially useful when you have a CDN for your image resources, like what I did on Azure.

"CDNSettings": {
    "GetImageByCDNRedirect": true,
    "CDNEndpoint": "https://ews.azureedge.net/ediwang-images"
}

πŸ“§ Email Notification

If you need email notification for new comments, new replies and pingbacks, you have to setup the Moonglade.Notification API first. See https://github.com/EdiWang/Moonglade.Notification for instructions.

"Notification": {
  "Enabled": true,
  "ApiEndpoint": "{PROD-ENV-VARIABLE}",
  "ApiKey": "{PROD-ENV-VARIABLE}"
}

πŸ–₯ System Setttings

Key Data Type Description
Editor string HTML / Markdown
CaptchaSettings:ImageWidth int Pixel Width of Captcha Image
CaptchaSettings:ImageHeight int Pixel Height of Captcha Image
PostAbstractWords int How may words to show in post list abstract
ImageCacheSlidingExpirationMinutes int Time for cached images to expire
EnforceHttps bool Force website use HTTPS
AllowScriptsInCustomPage bool Allow JavaScript in Page content or not
EnableAudit bool Enable Audit Log or not
EnablePostRawEndpoint bool Enable /meta and /content endpoint for post URL
AutoDarkLightTheme bool Automatically switch light or dark theme on post reading screen

πŸ™„ FAQ

Does this blog coupled with Microsoft Azure?

No, the system design does not couple with Azure, but the blog works best on Azure. Every part of the system, like Authentication and Image Storage, can be configured to use non-Azure options.

About

The .NET Core blog system of https://edi.wang, runs on Microsoft Azure

License:GNU General Public License v3.0


Languages

Language:C# 65.2%Language:HTML 21.7%Language:JavaScript 5.5%Language:CSS 4.4%Language:TSQL 1.5%Language:PowerShell 1.3%Language:Dockerfile 0.3%