Compare commits

...

15 Commits

Author SHA1 Message Date
499a7e348b
Merge branch 'develop' into main
All checks were successful
Build Docker / Build Master (push) Successful in 23s
Build Docker / Build Bot (push) Successful in 21s
2023-08-25 13:53:58 +10:00
ed94263050
actions: Don't run dev action when tag is pushed
All checks were successful
Build Docker / Build Master (push) Successful in 25s
Build Docker / Build Bot (push) Successful in 23s
2023-08-25 13:53:28 +10:00
4841344d63
actions: Finished adding release
All checks were successful
Build Docker / Build Master (push) Successful in 26s
Build Docker / Build Bot (push) Successful in 26s
2023-08-25 13:48:39 +10:00
51bcdda5d4
actions: Initial release job
All checks were successful
Build Docker / Build Bot (push) Successful in 21s
Build Docker / Build Master (push) Successful in 23s
Build Docker for Release / TEST (push) Successful in 5s
2023-08-25 13:44:13 +10:00
b38de6ad52
actions: Use same numbering on bot deployment
All checks were successful
Build Docker / Build Bot (push) Successful in 21s
Build Docker / Build Master (push) Successful in 23s
2023-08-25 13:39:26 +10:00
b642cf7269
actions: Try using the actions run variable
All checks were successful
Build Docker / Build Master (push) Successful in 24s
Build Docker / Build Bot (push) Successful in 22s
2023-08-25 13:37:24 +10:00
3e3c2fe61e
actions: Test 4 change numbering
All checks were successful
Build Docker / Build Bot (push) Successful in 23s
Build Docker / Build Master (push) Successful in 25s
2023-08-25 13:28:06 +10:00
04edb8b456
actions: Test 3 change numbering
Some checks failed
Build Docker / Build Master (push) Failing after 21s
Build Docker / Build Bot (push) Successful in 27s
2023-08-25 13:26:41 +10:00
45c1ea3557
actions: Test 2 change numbering
All checks were successful
Build Docker / Build Bot (push) Successful in 22s
Build Docker / Build Master (push) Successful in 25s
2023-08-25 13:25:00 +10:00
778c1b3d92
actions: Change numbering
All checks were successful
Build Docker / Build Bot (push) Successful in 28s
Build Docker / Build Master (push) Successful in 29s
2023-08-25 13:21:24 +10:00
19806b7b1b
Merge branch 'feature/send_info_on_ready' into develop
All checks were successful
Build Docker / Build Master (push) Successful in 26s
Build Docker / Build Bot (push) Successful in 26s
2023-08-25 12:59:19 +10:00
908a4e0422
bot: Check for install every 5 seconds
All checks were successful
Build Docker / Build Master (push) Successful in 22s
Build Docker / Build Bot (push) Successful in 26s
2023-08-25 12:54:31 +10:00
d217309e74
bot: Fixed check if site ready function args
All checks were successful
Build Docker / Build Master (push) Successful in 21s
Build Docker / Build Bot (push) Successful in 24s
2023-08-25 12:51:58 +10:00
ce8827ed97
worker: Install missing update repo
All checks were successful
Build Docker / Build Bot (push) Successful in 24s
Build Docker / Build Master (push) Successful in 25s
2023-08-25 12:49:29 +10:00
3b914abf7a
bot: Send a dm with the site info when the site is ready
All checks were successful
Build Docker / Build Master (push) Successful in 23s
Build Docker / Build Bot (push) Successful in 26s
2023-08-25 12:46:08 +10:00
4 changed files with 103 additions and 6 deletions

View File

@ -1,6 +1,11 @@
name: Build Docker
run-name: Build Docker Images
on: [push]
on:
push:
branches:
- '*'
tags-ignore:
- '*'
jobs:
Build Master:
@ -21,10 +26,12 @@ jobs:
run : |
cd master
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/}}"
tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
tag=${tag//\//-}
tag_num=${GITHUB_RUN_NUMBER}
echo "tag_num=$tag_num"
if [[ "$tag" == "main" ]]; then
tag="latest"
else
@ -60,10 +67,10 @@ jobs:
run : |
cd discord-bot
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/}}"
tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
tag=${tag//\//-}
tag_num=${GITHUB_RUN_NUMBER}
if [[ "$tag" == "main" ]]; then
tag="latest"
else
@ -75,4 +82,3 @@ jobs:
docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag_num
docker tag hnshosting-bot:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag
docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag

View File

@ -0,0 +1,63 @@
name: Build Docker for Release
run-name: Build Docker Images
on:
push:
tags:
- '*'
Build Master:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Docker
run : |
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce-cli -y
- name: Build Docker image
run : |
cd master
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
tag=${GITHUB_REF#refs/tags/}
docker build -t hnshosting-master:release-$tag .
docker tag hnshosting-master:release-$tag git.woodburn.au/nathanwoodburn/hnshosting-master:release-$tag
docker push git.woodburn.au/nathanwoodburn/hnshosting-master:release-$tag
docker tag hnshosting-master:release-$tag git.woodburn.au/nathanwoodburn/hnshosting-master:release
docker push git.woodburn.au/nathanwoodburn/hnshosting-master:release
Build Bot:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Docker
run : |
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce-cli -y
- name: Build Docker image
run : |
cd discord-bot
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
tag=${GITHUB_REF#refs/tags/}
docker build -t hnshosting-bot:release-$tag .
docker tag hnshosting-bot:release-$tag git.woodburn.au/nathanwoodburn/hnshosting-bot:release-$tag
docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:release-$tag
docker tag hnshosting-bot:release-$tag git.woodburn.au/nathanwoodburn/hnshosting-bot:release
docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:release

View File

@ -3,6 +3,7 @@ from dotenv import load_dotenv
import discord
from discord import app_commands
import requests
import asyncio
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
@ -69,7 +70,22 @@ async def createsite(ctx, domain: str, licence: str):
if r.status_code == 200:
json = r.json()
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:
await ctx.response.send_message(f"Error creating site\n" + json['error'])
else:
@ -88,6 +104,17 @@ async def siteinfo(ctx, domain: str):
else:
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
@client.event
async def on_ready():

View File

@ -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
# Install Docker
sudo apt update
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
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