You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Go to file
Anduin Xue 6c62325c4a
Use local simplemde static files.
2 weeks ago
assets Add new font. 3 weeks ago
src Use local simplemde static files. 2 weeks ago
.editorconfig Upgrade some format. 1 month ago
.gitignore Upgrade some format. 1 month ago
LICENSE Add readme. 3 months ago
MoongladePure.sln Fix a start up issue. 3 months ago
README.md Update more text. 3 weeks ago

README.md

MoongladePure

MoongladePure is a fork of Moonglade. Regain control over your data.

MoongladePure can be deployed completely on-premises without coupling to any particular cloud.

MoongladePure supports AirGap deployment. It doesn't require an Internet connection to use. 100% local!

Deployment

It is suggested to use Ubuntu 22.04 LTS as the operating system.

Prerequisites

  • MySQL
  • .NET
  • Caddy(Optional)

Prepare MySQL Server

Install MySQL server as the database of MoongladePure.

The database can be a different server from the Web app server.

sudo apt install mysql-server -y
sudo systemctl enable mysql
sudo systemctl start mysql

Set admin password:

sudo mysql_secure_installation

Or

sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mynewpassword';
exit;

To sign in your MySQL:

sudo mysql -u root -p

Create a database for MoongladePure:

CREATE DATABASE MoongladePure;
CREATE USER 'moongladepure'@'localhost' IDENTIFIED BY 'YOUR_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON MoongladePure.* TO 'moongladepure'@'localhost';
FLUSH PRIVILEGES;
exit;

Prepare a storage path

Create a folder for MoongladePure to store data:

sudo mkdir /mnt/datastore
sudo chown -R www-data:www-data /mnt/datastore

Download MoongladePure

You can download MoongladePure via:

wget https://git.aiursoft.cn/Aiursoft/MoongladePure/archive/master.tar.gz
tar -zxvf ./master.tar.gz
ls

Build MoongladePure

Install dotnet6 first.

sudo apt install -y dotnet6

Prepare a directory:

sudo mkdir -p /opt/apps/MoongladePure
sudo chown -R www-data:www-data /opt/apps/MoongladePure

Then build it:

dotnet publish -c Release -o ./bin -r linux-x64 --no-self-contained ./moongladepure/src/Moonglade.Web/MoongladePure.Web.csproj

Copy the files to the directory:

sudo cp ./bin/* /opt/apps/MoongladePure/ -rv
sudo chown -R www-data:www-data /opt/apps/MoongladePure

Download related fonts:

sudo mkdir /usr/share/fonts
sudo wget https://git.aiursoft.cn/Aiursoft/MoongladePure/raw/branch/master/assets/OpenSans-Regular.ttf -O /usr/share/fonts/OpenSans-Regular.ttf
sudo chown www-data:www-data /usr/share/fonts/OpenSans-Regular.ttf

Edit the configuration

Copy the configuration file as production first:

sudo -u www-data cp /opt/apps/MoongladePure/appsettings.json /opt/apps/MoongladePure/appsettings.Production.json

Then edit the production JSON file.

  • Make the database connection string to your real database.
  • Make the storage path to be your real storage path.
sudo -u www-data vim /opt/apps/MoongladePure/appsettings.Production.json

Run MoongladePure

First register MoongladePure as a service:

echo '[Unit]
Description=MoongladePure Service
After=network.target mysql.service
Wants=network.target mysql.service

[Service]
Type=simple
User=www-data
ExecStart=/usr/bin/dotnet /opt/apps/MoongladePure/MoongladePure.Web.dll --urls=http://0.0.0.0:48466/
WorkingDirectory=/opt/apps/MoongladePure
Restart=always
RestartSec=10
KillSignal=SIGINT
Environment="ASPNETCORE_ENVIRONMENT=Production"
Environment="DOTNET_PRINT_TELEMETRY_MESSAGE=false"
Environment="DOTNET_CLI_TELEMETRY_OPTOUT=1"
Environment="ASPNETCORE_FORWARDEDHEADERS_ENABLED=true"

[Install]
WantedBy=multi-user.target' | sudo tee -a /etc/systemd/system/moongladepure.service

Then start the service.

sudo systemctl daemon-reload
sudo systemctl enable moongladepure
sudo systemctl start moongladepure

Now you can visit your MoongladePure site via http://your-ip:48466.

The admin panel is at http://your-ip:48466/admin. The default username is admin and password is admin123.

Prepare HTTPS

Please make sure you have a domain name ready and point to your server's IP address.

Then install a reverse proxy server. For example, I'm using Caddy.

echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
sudo apt update
sudo apt install caddy -y

Then edit the Caddyfile:

sudo vim /etc/caddy/Caddyfile

Add the following content:

your.domain.com {
        reverse_proxy http://localhost:48466 {
        }
}

Then restart Caddy:

sudo systemctl restart caddy

Now try to open your browser and try:

https://your.domain.com

Advanced setup

MoongladePure supports scaling out. You can deploy multiple MoongladePure instances to serve your users.

Moonglade-scale-out

The following articles might be needed.

You can follow the best practice after having a Linux server.

If you deployed the MySQL database on another server, you might need to set up MySQL to allow remote connection.

If you want to share the storage path on a different remote server to scale out, you can use NFS to share the folder.

Yes! MoongladePure is stateless. You can setup multiple MoongladePure Web servers to scale out and shares the same database and NFS storage.

And in that case, you need Caddy as a load balance. Here are some tips:

It is also suggested to mount a big disk to save your blog's content. View more here: