Wordpress hosting system for Handshake https://hnshosting.au
Go to file
Nathan Woodburn 9d06151ed2
All checks were successful
Build Docker / Build Master (push) Successful in 22s
Build Docker / Build Bot (push) Successful in 22s
feat: Only send WP licence email on subscription start
2023-11-02 16:36:32 +11:00
.gitea/workflows actions: Build release for arm 2023-09-18 14:38:37 +10:00
assets feat: Add instructions for enabling HIP2 on WordPress site 2023-10-23 15:46:16 +11:00
discord-bot bot: Adding a few catches to the bot 2023-09-21 11:32:34 +10:00
master feat: Only send WP licence email on subscription start 2023-11-02 16:36:32 +11:00
worker fix: Fix wordpress rewrites for hip2 2023-10-23 15:42:38 +11:00
.gitignore main: Added worker interactions 2023-08-16 16:59:57 +10:00
LICENSE.md Initial commit 2023-08-16 12:53:35 +10:00
README.md feat: Add instructions for enabling HIP2 on WordPress site 2023-10-23 15:46:16 +11:00

HNSHosting Wordpress

This is split into two parts. There is the master server which is the server that will be used to manage the worker servers. Then there is the worker server which is the server that will be used to host the wordpress site.

This is done to make it easier to manage multiple wordpress sites on multiple servers.

Overview

The master server will be used to manage the worker servers. The worker servers will be used to host the wordpress sites. The bot will be used to provide an easier way to manage the master server.

Overview of system

Legend Description
Red Connections Secured by VPN or over LAN ONLY. (NOT API SECURED)
Yellow Connections HTTP/HTTPS public traffic

Features

  • Add new worker server to master server pool
  • Create wordpress site on random worker server
  • Optional Free mode (see Bot section)

Usage

After installing the master and discord bot you can use the following commands (as bot owner).

/addworker <ip> <private ip> <name> | add a worker to the master server pool
/listworkers                        | list all workers
/licence                            | Creates a licence key (valid for 1 wp site)

General commands (as anyone)

/createsite <domain> <licence key>  | Creates a wordpress site on a random worker server (uses up 1 licence key)
/siteinfo <domain>                  | Get info about a site (use after creating site to get TLSA and IP of the server)

Master server install

Docker is the easiest way to install the master server.

docker run -d -p 5000:5000 -e LICENCE_KEY=your-api-key -e WORKER_KEY=your-api-key -e ADMIN_KEY=admin-key --name hnshosting-master git.woodburn.au/nathanwoodburn/hnshosting-master:latest -v ./data:/data

You can also mount a docker volume to /data to store the files instead of mounting a host directory.

Alternatively you can install it manually. Set your .env file.

cd master
python3 -m pip install -r requirements.txt

Then to start the master api server

screen -dmS hnshosting-master python3 main.py

Stripe webhook

Create a new webhook endpoint on stripe and set the url to https://master-server-domain:5000/stripe-webhook (note: you need to add a https proxy to your master server if you want to use stripe) Add these environment variables to your master server

STRIPE_SECRET: your-stripe-secret-key
STRIPE_ENDPOINT_SECRET: your-stripe-endpoint-secret
SMTP_HOST: smtp-server
SMTP_PORT: smtp-port
SMTP_USER: smtp-user
SMTP_PASS: smtp-pass
SMTP_FROM: smtp-from (eg. HNSHosting <hosting@nathan.woodburn.au>) This is optional

Worker server install

Install prerequisites:

git clone https://git.woodburn.au/nathanwoodburn/hnshosting-wp.git
cd hnshosting-wp/worker
chmod +x install.sh
./install.sh

Just press enter when it shows any prompts.

Start the worker api server using

screen -dmS hnshosting-worker python3 main.py

Add worker to master server pool: The master server will need to be able to access port 5000 on the worker server over the PRIVATE ip. This is not secured by the api key so make sure you don't allow anyone else to access it.

curl -X POST http://master-server-ip:5000/add-worker?worker=worker-name&ip=worker-server-ip&priv=worker-server-private-ip -H "key: api-key"

Alternatively you can use the discord bot to add the worker to the master server pool.

/addworker <ip> <private ip> <name>

Discord bot install

Docker install

docker run -d -e MASTER_IP=<MASTER SERVER IP> -e DISCORD_TOKEN=<YOUR-BOT-TOKEN> -e LICENCE_KEY=your-api-key -e WORKER_KEY=your-api-key --name hnshosting-bot git.woodburn.au/nathanwoodburn/hnshosting-bot:latest

Enable the free mode by setting the following environment variable.
This will allow you to create a wordpress site without using a licence key using the /createsite command.

FREE_MODE: true

Hip2

HIP2 allows sending HNS to a domain. To enable HIP2 on your wordpress site you should

  1. Download the HIP2 plugin
  2. Upload the plugin to your wordpress site
  3. Activate the plugin
  4. Go to the settings page and enter your HNS wallet address
  5. Ensure it works by settings the permalink to post name and saving