13 Commits

Author SHA1 Message Date
2aa5c56ca7 fix(status): update router title to include demonstration data notice 2025-11-09 08:32:06 +01:00
7b35fcf31b fix(status): update host configuration for ROUTER-DE 04 2025-11-07 11:01:57 +01:00
a5476b26fe feat(status): add router configurations and update InfraType to include routers 2025-11-07 10:49:56 +01:00
c99c11c241 feat(status): add new game server notification for RYZEN-GAME 02 2025-11-07 10:32:17 +01:00
df048c1352 fix(status): remove unnecessary quotes from host and name properties 2025-11-04 18:13:17 +01:00
290e8b982a feat(status): enhance website status message with globe icon and separator 2025-11-03 18:32:35 +01:00
8bfeb1c43c fix(status): update status message to include website link in notifications 2025-11-03 18:27:35 +01:00
e2a8255d5a fix(docker): comment out npm run register command in Dockerfile 2025-11-03 18:17:58 +01:00
85ec27cb2b fix(docker): correct npm command to run register in Dockerfile 2025-11-03 18:09:38 +01:00
e2c896c6f1 fix(readme): update deployment workflow status to in production 2025-11-03 18:06:00 +01:00
3ff4278217 feat(deploy): add GitHub Actions workflow for deployment to VPS 2025-11-03 18:05:47 +01:00
7b80aca9e1 fix(status): update timestamp format in notifications to include full date and time 2025-11-03 14:36:24 +01:00
afd8d1f68a fix(status): integrate dayjs for formatted timestamps in notifications 2025-11-03 14:35:06 +01:00
8 changed files with 127 additions and 17 deletions

View File

@@ -19,3 +19,9 @@ DB_LOGGING=false
# Environment
NODE_ENV=development
# Protected IPS
PROTOJX_ROUTER_1=
PROTOJX_ROUTER_2=
PROTOJX_ROUTER_3=
PROTOJX_ROUTER_4=

52
.github/workflows/deploy.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
# This is a basic workflow to help you get started with Actions
name: Deploy
# Controls when the workflow will run
on:
push:
tags:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Setup SSH Agent
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add VPS to known_hosts
run: |
ssh-keyscan -p ${{ secrets.VPS_PORT }} -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts
- name: Deploy to VPS
run: |
ssh -p ${{ secrets.VPS_PORT }} ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "
cd /home/${{ secrets.VPS_USER }}/protojx/protojx-manager &&
git pull &&
# Stop and remove old container if exists
docker stop protojx_manager 2>/dev/null || true &&
docker rm protojx_manager 2>/dev/null || true &&
# Build new image
docker buildx build -t protojx_manager . &&
# Run new container
docker run -d \
--name protojx_manager \
--restart unless-stopped \
--network shared \
protojx_manager
"

View File

@@ -7,4 +7,6 @@ COPY . .
RUN apt-get update && apt-get install -y iputils-ping
RUN npm i
# RUN npm run register
CMD [ "npm", "run", "start" ]

View File

@@ -12,7 +12,7 @@ A status bot and other features for protojx.
| Number of services down in the bot's status. | 🌐 |
| Notification system in case of downtime. | 🌐 |
| Ability to create persistent status messages that update automatically. (/live_status) | 🌐 |
| Deployment workflow on Oracle VPS. | |
| Deployment workflow on Oracle VPS. | 🌐 |
| Filter for notifs. | 🌐 |
- 🌐 -> In production

7
package-lock.json generated
View File

@@ -11,6 +11,7 @@
"dependencies": {
"@types/ping": "^0.4.4",
"cron": "^4.3.3",
"dayjs": "^1.11.19",
"discord.js": "^14.24.2",
"dotenv": "^17.2.2",
"pg": "^8.16.3",
@@ -552,9 +553,9 @@
}
},
"node_modules/dayjs": {
"version": "1.11.18",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.18.tgz",
"integrity": "sha512-zFBQ7WFRvVRhKcWoUh+ZA1g2HVgUbsZm9sbddh8EC5iv93sui8DVVz1Npvz+r6meo9VKfa8NyLWBsQK1VvIKPA==",
"version": "1.11.19",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
"integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==",
"license": "MIT"
},
"node_modules/debug": {

View File

@@ -30,6 +30,7 @@
"dependencies": {
"@types/ping": "^0.4.4",
"cron": "^4.3.3",
"dayjs": "^1.11.19",
"discord.js": "^14.24.2",
"dotenv": "^17.2.2",
"pg": "^8.16.3",

View File

@@ -7,6 +7,7 @@ import { HostsLog } from "../entity/hostslog.entity";
import { Repository } from "typeorm";
import { Follow } from "../entity/follow.entity";
import { Guild } from "../entity/guild.entity";
import dayjs from "dayjs";
type Nofity = {time: Date, name : string, alive : boolean, type : InfraType, host: string};
@@ -14,16 +15,16 @@ export class StatusService {
public hosts: Host[] = [
{
'host': 'https://protojx.com',
'name': 'Protojx Website',
host: 'https://protojx.com',
name: 'Protojx Website',
alive: false,
ping_type: 'website',
type: 'website',
notify: false
},
{
'host': 'https://manager.protojx.com',
'name': 'Espace Client',
host: 'https://manager.protojx.com',
name: 'Espace Client',
alive: false,
ping_type: 'website',
type: 'website',
@@ -93,6 +94,14 @@ export class StatusService {
type: 'games',
notify: true
},
{
host: '5.178.99.17',
name: 'RYZEN-GAME 02',
alive: false,
ping_type: 'ping',
type: 'games',
notify: true
},
{
host: '5.178.99.63',
name: 'XEON-GAME 01',
@@ -100,7 +109,40 @@ export class StatusService {
ping_type: 'ping',
type: 'games',
notify: true
}
},
// Routers
{
host: process.env.PROTOJX_ROUTER_1 as string,
name: 'ROUTER-FR 01',
alive: false,
ping_type: 'ping',
type: 'router',
notify: false
},
{
host: process.env.PROTOJX_ROUTER_2 as string,
name: 'ROUTER-FR 02',
alive: false,
ping_type: 'ping',
type: 'router',
notify: false
},
{
host: process.env.PROTOJX_ROUTER_3 as string,
name: 'ROUTER-DE 03',
alive: false,
ping_type: 'ping',
type: 'router',
notify: false
},
{
host: process.env.PROTOJX_ROUTER_4 as string,
name: 'ROUTER-DE 04',
alive: false,
ping_type: 'ping',
type: 'router',
notify: false
},
];
private client: Client | null = null;
@@ -285,6 +327,11 @@ export class StatusService {
title: 'Games',
type: 'games',
thumbnail: 'https://protojx.com/assets/img/hero-img.png'
},
{
title: 'Routers\n-# *The data displayed here is not real data but demonstration data. (Beta)*',
type: 'router',
thumbnail: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRMnCmtQRkLlcD1Cb6vKXz6NOxAu79vzmq2pRqpNYxpTJa5JQEsouhqnVn7cyl6ivYSyzY&usqp=CAU'
}
]
@@ -303,8 +350,9 @@ export class StatusService {
)
});
const now = new Date();
container.addTextDisplayComponents((text) => text.setContent(`${live ? 'Last update : ' : ''}${now.getDate()}-${now.getMonth() + 1}-${now.getFullYear()} ${(now.getHours() + '').padStart(2, "0")}:${(now.getMinutes() + '').padStart(2, "0")} - Receive automatic notifications when there is an outage with /follow !`));
container.addSeparatorComponents((s) => s);
container.addTextDisplayComponents((text) => text.setContent(`:globe_with_meridians: Website Status : https://statut.protojx.com/\n${live ? 'Last update : ' : ''}<t:${dayjs().unix()}:f> - Receive automatic notifications when there is an outage with /follow !`));
return container;
}

2
src/type.d.ts vendored
View File

@@ -1,6 +1,6 @@
import { ButtonInteraction, ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
export type InfraType = 'website' | 'ryzen' | 'xeon' | 'games';
export type InfraType = 'website' | 'ryzen' | 'xeon' | 'games' | 'router';
export type Host = {
host: string,
name: string,