2023-08-16 13:47:49 +10: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.
2023-08-16 17:43:30 +10:00
## 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.
## Usage
2023-08-24 15:30:41 +10:00
After installing the master and discord bot you can use the following commands (as bot owner).
```
/addworker < ip > < name > | add a worker to the master server pool (Make sure the master can access port 5000 on the worker, and don't allow anyone else to access it)
/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)
```
2023-08-16 17:43:30 +10:00
2023-08-16 13:47:49 +10:00
## Master server install
2023-08-16 17:22:54 +10:00
Docker is the easiest way to install the master server.
2023-08-16 13:47:49 +10:00
2023-08-24 15:30:41 +10:00
```sh
2023-08-16 17:22:54 +10:00
docker run -d -p 5000:5000 -e LICENCE-API=your-api-key -e WORKER_KEY=your-api-key --name hnshosting-master git.woodburn.au/nathanwoodburn/hnshosting-master:latest -v ./data:/data
2023-08-16 13:47:49 +10:00
```
2023-08-16 17:22:54 +10:00
You can also mount a docker volume to /data to store the files instead of mounting a host directory.
2023-08-16 13:47:49 +10:00
2023-08-16 17:22:54 +10:00
Alternatively you can install it manually.
Set your .env file.
2023-08-24 15:30:41 +10:00
```sh
2023-08-16 17:22:54 +10:00
cd master
python3 -m pip install -r requirements.txt
2023-08-24 15:30:41 +10:00
```
Then to start the master api server
```sh
screen -dmS hnshosting-master python3 main.py
2023-08-16 17:22:54 +10:00
```
2023-08-16 13:47:49 +10:00
## Worker server install
Install prerequisites:
2023-08-24 15:30:41 +10:00
```sh
git clone https://git.woodburn.au/nathanwoodburn/hnshosting-wp.git
cd hnshosting-wp/worker
2023-08-16 13:47:49 +10:00
chmod +x install.sh
./install.sh
2023-08-16 16:59:57 +10:00
```
2023-08-24 15:30:41 +10:00
Then to start the worker api server
```sh
screen -dmS hnshosting-worker python3 main.py
```
2023-08-16 16:59:57 +10:00
Add worker to master server:
2023-08-24 15:30:41 +10:00
```sh
2023-08-16 16:59:57 +10:00
curl -X POST http://master-server-ip:5000/add-worker?worker=worker-name& ip=worker-server-ip -H "key: api-key"
2023-08-16 17:43:30 +10:00
```
## Discord bot install
Docker install
2023-08-24 15:30:41 +10:00
```sh
2023-08-24 13:42:10 +10:00
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
2023-08-16 13:47:49 +10:00
```