Compare commits
13 Commits
dbbb60cab8
...
v0.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
51bcdda5d4
|
|||
|
b38de6ad52
|
|||
|
b642cf7269
|
|||
|
3e3c2fe61e
|
|||
|
04edb8b456
|
|||
|
45c1ea3557
|
|||
|
778c1b3d92
|
|||
|
19806b7b1b
|
|||
|
908a4e0422
|
|||
|
d217309e74
|
|||
|
ce8827ed97
|
|||
|
3b914abf7a
|
|||
|
d7c6e1cf70
|
@@ -21,10 +21,12 @@ jobs:
|
|||||||
run : |
|
run : |
|
||||||
cd master
|
cd master
|
||||||
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
|
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
|
||||||
tag_num=$(git rev-parse --short HEAD)
|
|
||||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
|
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
|
||||||
tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
|
tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
|
||||||
tag=${tag//\//-}
|
tag=${tag//\//-}
|
||||||
|
tag_num=${GITHUB_RUN_NUMBER}
|
||||||
|
echo "tag_num=$tag_num"
|
||||||
|
|
||||||
if [[ "$tag" == "main" ]]; then
|
if [[ "$tag" == "main" ]]; then
|
||||||
tag="latest"
|
tag="latest"
|
||||||
else
|
else
|
||||||
@@ -60,10 +62,10 @@ jobs:
|
|||||||
run : |
|
run : |
|
||||||
cd discord-bot
|
cd discord-bot
|
||||||
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
|
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
|
||||||
tag_num=$(git rev-parse --short HEAD)
|
|
||||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
|
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
|
||||||
tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
|
tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
|
||||||
tag=${tag//\//-}
|
tag=${tag//\//-}
|
||||||
|
tag_num=${GITHUB_RUN_NUMBER}
|
||||||
if [[ "$tag" == "main" ]]; then
|
if [[ "$tag" == "main" ]]; then
|
||||||
tag="latest"
|
tag="latest"
|
||||||
else
|
else
|
||||||
@@ -74,5 +76,4 @@ jobs:
|
|||||||
docker tag hnshosting-bot:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag_num
|
docker tag hnshosting-bot:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag_num
|
||||||
docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag_num
|
docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag_num
|
||||||
docker tag hnshosting-bot:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag
|
docker tag hnshosting-bot:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag
|
||||||
docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag
|
docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag
|
||||||
|
|
||||||
16
.gitea/workflows/release.yml
Normal file
16
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: Build Docker for Release
|
||||||
|
run-name: Build Docker Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
TEST:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Print tag
|
||||||
|
run: echo "tag=${GITHUB_REF#refs/tags/}"
|
||||||
@@ -24,7 +24,7 @@ The bot will be used to provide an easier way to manage the master server.
|
|||||||
After installing the master and discord bot you can use the following commands (as bot owner).
|
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)
|
/addworker <ip> <private ip> <name> | add a worker to the master server pool
|
||||||
/listworkers | list all workers
|
/listworkers | list all workers
|
||||||
/licence | Creates a licence key (valid for 1 wp site)
|
/licence | Creates a licence key (valid for 1 wp site)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from dotenv import load_dotenv
|
|||||||
import discord
|
import discord
|
||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
import requests
|
import requests
|
||||||
|
import asyncio
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
TOKEN = os.getenv('DISCORD_TOKEN')
|
TOKEN = os.getenv('DISCORD_TOKEN')
|
||||||
@@ -69,7 +70,22 @@ async def createsite(ctx, domain: str, licence: str):
|
|||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
json = r.json()
|
json = r.json()
|
||||||
if json['success'] == "true":
|
if json['success'] == "true":
|
||||||
await ctx.response.send_message(f"Site {domain} creating...\nPlease wait a few minutes and then send /siteinfo domain:{domain}")
|
await ctx.response.send_message(f"Site {domain} creating...\nI'll send you a message when it's ready")
|
||||||
|
|
||||||
|
ready = False
|
||||||
|
while ready == False:
|
||||||
|
ready = await check_site_ready(domain)
|
||||||
|
if ready == False:
|
||||||
|
await asyncio.sleep(5)
|
||||||
|
|
||||||
|
r = requests.get(f"http://{Master_IP}:{Master_Port}/site-info?domain={domain}")
|
||||||
|
json = r.json()
|
||||||
|
if json['success'] == "true":
|
||||||
|
await ctx.user.send(f"Site {domain} is ready!\nHere is the site info for {json['domain']}\nA: `{json['ip']}`\nTLSA: `{json['tlsa']}`\nMake sure you put the TLSA in either `_443._tcp.{domain}` or `*.{domain}`")
|
||||||
|
else:
|
||||||
|
await ctx.user.send(f"Error getting site info\n" + json['error'])
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
await ctx.response.send_message(f"Error creating site\n" + json['error'])
|
await ctx.response.send_message(f"Error creating site\n" + json['error'])
|
||||||
else:
|
else:
|
||||||
@@ -88,6 +104,17 @@ async def siteinfo(ctx, domain: str):
|
|||||||
else:
|
else:
|
||||||
await ctx.response.send_message(f"Error getting site info\n" + r.text)
|
await ctx.response.send_message(f"Error getting site info\n" + r.text)
|
||||||
|
|
||||||
|
async def check_site_ready(domain):
|
||||||
|
r = requests.get(f"http://{Master_IP}:{Master_Port}/site-info?domain={domain}")
|
||||||
|
if r.status_code == 200:
|
||||||
|
json = r.json()
|
||||||
|
if json['success'] == "true":
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
# When the bot is ready
|
# When the bot is ready
|
||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ KERNEL_VERSION=$(uname -r)
|
|||||||
sudo apt-mark hold linux-image-generic linux-headers-generic linux-generic linux-image-$KERNEL_VERSION linux-headers-$KERNEL_VERSION
|
sudo apt-mark hold linux-image-generic linux-headers-generic linux-generic linux-image-$KERNEL_VERSION linux-headers-$KERNEL_VERSION
|
||||||
|
|
||||||
# Install Docker
|
# Install Docker
|
||||||
|
sudo apt update
|
||||||
sudo apt install apt-transport-https ca-certificates curl software-properties-common python3-pip nginx -y
|
sudo apt install apt-transport-https ca-certificates curl software-properties-common python3-pip nginx -y
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
|||||||
Reference in New Issue
Block a user