mirror of
https://github.com/thedrewen/protojx-manager.git
synced 2026-03-21 09:48:56 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2aa5c56ca7 | |||
| 7b35fcf31b | |||
| a5476b26fe | |||
| c99c11c241 | |||
| df048c1352 | |||
| 290e8b982a | |||
| 8bfeb1c43c | |||
| e2a8255d5a | |||
| 85ec27cb2b | |||
| e2c896c6f1 | |||
| 3ff4278217 | |||
| 7b80aca9e1 | |||
| afd8d1f68a |
@@ -19,3 +19,9 @@ DB_LOGGING=false
|
|||||||
|
|
||||||
# Environment
|
# Environment
|
||||||
NODE_ENV=development
|
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
52
.github/workflows/deploy.yml
vendored
Normal 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
|
||||||
|
"
|
||||||
@@ -7,4 +7,6 @@ COPY . .
|
|||||||
RUN apt-get update && apt-get install -y iputils-ping
|
RUN apt-get update && apt-get install -y iputils-ping
|
||||||
RUN npm i
|
RUN npm i
|
||||||
|
|
||||||
|
# RUN npm run register
|
||||||
|
|
||||||
CMD [ "npm", "run", "start" ]
|
CMD [ "npm", "run", "start" ]
|
||||||
@@ -12,7 +12,7 @@ A status bot and other features for protojx.
|
|||||||
| Number of services down in the bot's status. | 🌐 |
|
| Number of services down in the bot's status. | 🌐 |
|
||||||
| Notification system in case of downtime. | 🌐 |
|
| Notification system in case of downtime. | 🌐 |
|
||||||
| Ability to create persistent status messages that update automatically. (/live_status) | 🌐 |
|
| Ability to create persistent status messages that update automatically. (/live_status) | 🌐 |
|
||||||
| Deployment workflow on Oracle VPS. | ➖ |
|
| Deployment workflow on Oracle VPS. | 🌐 |
|
||||||
| Filter for notifs. | 🌐 |
|
| Filter for notifs. | 🌐 |
|
||||||
|
|
||||||
- 🌐 -> In production
|
- 🌐 -> In production
|
||||||
|
|||||||
7
package-lock.json
generated
7
package-lock.json
generated
@@ -11,6 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/ping": "^0.4.4",
|
"@types/ping": "^0.4.4",
|
||||||
"cron": "^4.3.3",
|
"cron": "^4.3.3",
|
||||||
|
"dayjs": "^1.11.19",
|
||||||
"discord.js": "^14.24.2",
|
"discord.js": "^14.24.2",
|
||||||
"dotenv": "^17.2.2",
|
"dotenv": "^17.2.2",
|
||||||
"pg": "^8.16.3",
|
"pg": "^8.16.3",
|
||||||
@@ -552,9 +553,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/dayjs": {
|
"node_modules/dayjs": {
|
||||||
"version": "1.11.18",
|
"version": "1.11.19",
|
||||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.18.tgz",
|
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
|
||||||
"integrity": "sha512-zFBQ7WFRvVRhKcWoUh+ZA1g2HVgUbsZm9sbddh8EC5iv93sui8DVVz1Npvz+r6meo9VKfa8NyLWBsQK1VvIKPA==",
|
"integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/ping": "^0.4.4",
|
"@types/ping": "^0.4.4",
|
||||||
"cron": "^4.3.3",
|
"cron": "^4.3.3",
|
||||||
|
"dayjs": "^1.11.19",
|
||||||
"discord.js": "^14.24.2",
|
"discord.js": "^14.24.2",
|
||||||
"dotenv": "^17.2.2",
|
"dotenv": "^17.2.2",
|
||||||
"pg": "^8.16.3",
|
"pg": "^8.16.3",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { HostsLog } from "../entity/hostslog.entity";
|
|||||||
import { Repository } from "typeorm";
|
import { Repository } from "typeorm";
|
||||||
import { Follow } from "../entity/follow.entity";
|
import { Follow } from "../entity/follow.entity";
|
||||||
import { Guild } from "../entity/guild.entity";
|
import { Guild } from "../entity/guild.entity";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
type Nofity = {time: Date, name : string, alive : boolean, type : InfraType, host: string};
|
type Nofity = {time: Date, name : string, alive : boolean, type : InfraType, host: string};
|
||||||
|
|
||||||
@@ -14,16 +15,16 @@ export class StatusService {
|
|||||||
|
|
||||||
public hosts: Host[] = [
|
public hosts: Host[] = [
|
||||||
{
|
{
|
||||||
'host': 'https://protojx.com',
|
host: 'https://protojx.com',
|
||||||
'name': 'Protojx Website',
|
name: 'Protojx Website',
|
||||||
alive: false,
|
alive: false,
|
||||||
ping_type: 'website',
|
ping_type: 'website',
|
||||||
type: 'website',
|
type: 'website',
|
||||||
notify: false
|
notify: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'host': 'https://manager.protojx.com',
|
host: 'https://manager.protojx.com',
|
||||||
'name': 'Espace Client',
|
name: 'Espace Client',
|
||||||
alive: false,
|
alive: false,
|
||||||
ping_type: 'website',
|
ping_type: 'website',
|
||||||
type: 'website',
|
type: 'website',
|
||||||
@@ -93,6 +94,14 @@ export class StatusService {
|
|||||||
type: 'games',
|
type: 'games',
|
||||||
notify: true
|
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',
|
host: '5.178.99.63',
|
||||||
name: 'XEON-GAME 01',
|
name: 'XEON-GAME 01',
|
||||||
@@ -100,7 +109,40 @@ export class StatusService {
|
|||||||
ping_type: 'ping',
|
ping_type: 'ping',
|
||||||
type: 'games',
|
type: 'games',
|
||||||
notify: true
|
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;
|
private client: Client | null = null;
|
||||||
@@ -285,6 +327,11 @@ export class StatusService {
|
|||||||
title: 'Games',
|
title: 'Games',
|
||||||
type: 'games',
|
type: 'games',
|
||||||
thumbnail: 'https://protojx.com/assets/img/hero-img.png'
|
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.addSeparatorComponents((s) => s);
|
||||||
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.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;
|
return container;
|
||||||
}
|
}
|
||||||
|
|||||||
2
src/type.d.ts
vendored
2
src/type.d.ts
vendored
@@ -1,6 +1,6 @@
|
|||||||
import { ButtonInteraction, ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
|
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 = {
|
export type Host = {
|
||||||
host: string,
|
host: string,
|
||||||
name: string,
|
name: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user