Compare commits

..

12 Commits

Author SHA1 Message Date
379da7e455 Version 1.0.5 - Editing, removing lavalink service
All checks were successful
Deployment Pipeline / deploy (push) Successful in 27s
2025-06-06 17:35:04 +02:00
3c49a65c5d Version 1.0.4-rc2 - Remove CV
All checks were successful
Deployment Pipeline / deploy (push) Successful in 34s
2025-05-22 22:31:50 +02:00
025435b48e Version 1.0.4 - Remove pipelines
All checks were successful
Deployment Pipeline / deploy (push) Successful in 26s
2025-02-16 16:46:06 +01:00
46224bdf6d Version 1.0.3-rc5 - Ajout du Workflow (Test)
All checks were successful
Deployment Pipeline / deploy (push) Successful in 28s
2025-02-16 16:26:51 +01:00
4e1736709e Version 1.0.3-rc4 - Ajout du Workflow (Test)
Some checks failed
Deployment Pipeline / deploy (push) Failing after 6s
2025-02-16 16:25:39 +01:00
cc8026f688 Version 1.0.3-rc3 - Ajout du Workflow (Test)
Some checks failed
Deployment Pipeline / deploy (push) Failing after 6s
2025-02-16 16:24:49 +01:00
1086d648de Version 1.0.3-rc2 - Ajout du Workflow 2025-02-16 16:21:50 +01:00
52e1348613 revert 0ffcafdf3f
All checks were successful
Neutral/pipeline/head This commit looks good
revert Version 1.1.0 - Ajout de la compatibilité des images
2024-12-29 14:53:37 +00:00
ee556d859e revert 6f637968bd
All checks were successful
Neutral/pipeline/head This commit looks good
revert Version 1.0.0 - Basic Web Application
2024-12-29 14:53:26 +00:00
a9414ff6ce Version 1.1.0 - Revert to stable app 2024-12-29 15:34:39 +01:00
b17ab480a4 Version 1.0.0 - Basic Web Application 2024-12-29 15:18:26 +01:00
6f637968bd Version 1.0.0 - Basic Web Application 2024-12-29 15:18:12 +01:00
18 changed files with 90 additions and 296 deletions

View File

@ -0,0 +1,30 @@
name: Deployment Pipeline
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup SSH
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan omega.raphix.fr >> ~/.ssh/known_hosts
- name: Deploy Stage
run: |
echo "[Neutral] - Deploy Stage"
ssh -o StrictHostKeyChecking=no raphix@raphix.fr sudo apt update -y
ssh -o StrictHostKeyChecking=no raphix@raphix.fr sudo apt upgrade -y
ssh -o StrictHostKeyChecking=no raphix@raphix.fr sudo -S -u gitlab-ci /home/gitlab-ci/neutral_deploy.sh

19
Jenkinsfile vendored
View File

@ -1,19 +0,0 @@
pipeline {
agent any
stages {
stage('[Neutral] - Déploiement') {
steps {
script {
echo "[Neutral-Deploy] - Deploy Stage"
sh "ssh raphix@raphix.fr sudo apt update -y"
sh "ssh raphix@raphix.fr sudo apt upgrade -y"
sh "ssh raphix@raphix.fr sudo -S -u gitlab-ci /home/gitlab-ci/neutral_deploy.sh"
}
}
}
}
}

View File

@ -37,12 +37,11 @@ module.exports.updateFile = function (file) {
module.exports.getSettings = function () { module.exports.getSettings = function () {
const file = this.getFile() const file = this.getFile()
return {"jenkins_token": file.JENKINS_TOKEN, "omega_token": file.OMEGA_KEY} return {"omega_token": file.OMEGA_KEY}
} }
module.exports.saveSettings = function (settings) { module.exports.saveSettings = function (settings) {
const file = this.getFile() const file = this.getFile()
file.JENKINS_TOKEN = settings.jenkins_token
file.OMEGA_KEY = settings.omega_token file.OMEGA_KEY = settings.omega_token
this.updateFile(file) this.updateFile(file)
} }

View File

@ -164,14 +164,7 @@ module.exports.getFile = function(root) {
try { try {
// Check if the file is an image and if it is return the base64
if(mime.lookup(root).includes("image")) {
return "data:" + mime.lookup(root) + ";base64," + fs.readFileSync(root, "base64")
} else {
return fs.readFileSync(root, "utf-8") return fs.readFileSync(root, "utf-8")
}
} catch(err) { } catch(err) {
console.log(err) console.log(err)
return "NOT_PERMITTED" return "NOT_PERMITTED"

View File

@ -1,138 +0,0 @@
const { LogType } = require("loguix")
const fs = require("fs")
const path = require("path")
const { __glob } = require("./global-variables")
const clog = new LogType("Pïpeline")
const config = require("./config")
const tokenkey = config.getFile().JENKINS_TOKEN
module.exports.getAllPipelines = function() {
return new Promise((resolve, reject) => {
fetch(`https://jenkins.raphix.fr/api/json`, {
method: "GET",
headers: {
"Accept": "application/json",
"Authorization": `Basic ${tokenkey}`
},
credentials: "include"
})
.then(res => res.json())
.then(async list => {
const pipelinesJobs = new Array()
for(const job of list.jobs) {
await fetch(`${job.url}/api/json`, {
method: "GET",
headers: {
"Accept": "application/json",
"Authorization": `Basic ${tokenkey}`
},
credentials: "include"
})
.then(res => res.json())
.then(async res => {
if(res._class == "org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject") {
await getJobMain(res).then(resJ => {
res.jobs[0] = resJ
pipelinesJobs.push(res)
})
} else {
pipelinesJobs.push(res)
}
})
}
list.jobs = pipelinesJobs
resolve(list)
})
.catch(err => {
resolve("UNAVAILABLE")
})
})
}
module.exports.startPipeline = function(pipeline) {
// If it's a freestyle job, build with params
if(pipeline.type == "org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject") {
return new Promise((resolve, reject) => {
fetch(`${pipeline.url}/job/${pipeline.jobname}/build?delay=0sec`, {
method: "POST",
headers: {
"Authorization": `Basic ${tokenkey}`
},
credentials: "include"
})
.then(res => {
resolve("OK")
})
})
} else {
return new Promise((resolve, reject) => {
const parameters = pipeline.fields
const formatedParams = new URLSearchParams()
for(const param of parameters) {
formatedParams.append(param.name, param.value)
}
fetch(`${pipeline.url}/buildWithParameters?delay=0sec`, {
method: "POST",
headers: {
"Authorization": `Basic ${tokenkey}`,
"Content-Type": "application/x-www-form-urlencoded"
},
credentials: "include",
body: formatedParams
})
.then(res => {
resolve("OK")
})
})
}
}
function getJobMain(res) {
return new Promise(async (resolve, reject) => {
await fetch(`${res.jobs[0].url}/api/json`, {
method: "GET",
headers: {
'Accept': 'application/json',
'Authorization': `Basic ${tokenkey}`
},
credentials: 'include'
}).then(res => res.json())
.then(res => {
resolve(res)
})
})
}

View File

@ -8,7 +8,6 @@ const files = require("./files.js")
const config = require("./config.js") const config = require("./config.js")
const links = require("./links.js") const links = require("./links.js")
const service = require("./services.js") const service = require("./services.js")
const pipeline = require("./pipelines.js")
const plog = new LogType("Web") const plog = new LogType("Web")
const cook = require("cookie") const cook = require("cookie")
const http = require("http") const http = require("http")
@ -166,16 +165,6 @@ module.exports.serverIO = function(server) {
}); });
} }
if(user.checkPermission("PIPELINES")) {
GetRequest("PL_GET_ALL", async () => {
GetAnswer("PL_GET_ALL", await pipeline.getAllPipelines())
})
PostRequest("PL_START", async (settings) => {
PostAnswer("PL_START", await pipeline.startPipeline(settings))
})
}
if(user.checkPermission("USERS")) { if(user.checkPermission("USERS")) {
GetRequest("US_ALL", async () => { GetRequest("US_ALL", async () => {

View File

@ -55,9 +55,6 @@ module.exports.stopService = function(service) {
} else if(service == `https://raphix.fr`) { } else if(service == `https://raphix.fr`) {
let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@alpha.raphix.fr sudo -S -u gitlab-ci 'pm2 stop "Website - Raphix"'`) let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@alpha.raphix.fr sudo -S -u gitlab-ci 'pm2 stop "Website - Raphix"'`)
resolve("OK") resolve("OK")
} else if(service == `https://cv.raphix.fr`) {
let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@alpha.raphix.fr sudo -S -u gitlab-ci 'pm2 stop "CV - Raphael"'`)
resolve("OK")
} else if(service == `http://omega.raphix.fr:2333`) { } else if(service == `http://omega.raphix.fr:2333`) {
let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@omega.raphix.fr sudo -S systemctl stop lavalink `) let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@omega.raphix.fr sudo -S systemctl stop lavalink `)
resolve("OK") resolve("OK")
@ -89,9 +86,6 @@ module.exports.startService = function(service) {
} else if(service == `https://raphix.fr`) { } else if(service == `https://raphix.fr`) {
let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@alpha.raphix.fr sudo -S -u gitlab-ci 'pm2 start /home/gitlab-ci/website.config.js'`) let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@alpha.raphix.fr sudo -S -u gitlab-ci 'pm2 start /home/gitlab-ci/website.config.js'`)
resolve("OK") resolve("OK")
} else if(service == `https://cv.raphix.fr`) {
let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@alpha.raphix.fr sudo -S -u gitlab-ci 'pm2 start /home/gitlab-ci/cv.config.js'`)
resolve("OK")
} else if(service == `http://omega.raphix.fr:2333`) { } else if(service == `http://omega.raphix.fr:2333`) {
let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@omega.raphix.fr sudo -S systemctl start lavalink `) let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@omega.raphix.fr sudo -S systemctl start lavalink `)
resolve("OK") resolve("OK")
@ -122,9 +116,6 @@ module.exports.restartService = function(service) {
} else if(service == `https://raphix.fr`) { } else if(service == `https://raphix.fr`) {
let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@alpha.raphix.fr sudo -S -u gitlab-ci 'pm2 restart "Website - Raphix"'`) let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@alpha.raphix.fr sudo -S -u gitlab-ci 'pm2 restart "Website - Raphix"'`)
resolve("OK") resolve("OK")
} else if(service == `https://cv.raphix.fr`) {
let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@alpha.raphix.fr sudo -S -u gitlab-ci 'pm2 restart "CV - Raphael"'`)
resolve("OK")
} else if(service == `http://omega.raphix.fr:2333`) { } else if(service == `http://omega.raphix.fr:2333`) {
let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@omega.raphix.fr sudo -S systemctl restart lavalink `) let req = child_process.exec(`ssh -o StrictHostKeyChecking=no raphix@omega.raphix.fr sudo -S systemctl restart lavalink `)
resolve("OK") resolve("OK")

View File

@ -17,6 +17,7 @@ var wlog = log.getInstance("Serveur")
setup() setup()

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "neutral", "name": "neutral",
"version": "0.7.0", "version": "1.0.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "neutral", "name": "neutral",
"version": "0.7.0", "version": "1.0.3",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"cookie-parser": "~1.4.4", "cookie-parser": "~1.4.4",

View File

@ -1,6 +1,6 @@
{ {
"name": "neutral", "name": "neutral",
"version": "1.1.0", "version": "1.0.4",
"description": "Panel d'administration de Raphix", "description": "Panel d'administration de Raphix",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -733,10 +733,12 @@ class Service {
} }
/**
/*
* Permet de créer un composant de vue de type "Pipeline" * Permet de créer un composant de vue de type "Pipeline"
* @param {object} properties Propriétés du composant de vue * @param {object} properties Propriétés du composant de vue
*/
class Pipeline { class Pipeline {
name; name;
@ -954,6 +956,8 @@ class Pipeline {
} }
*/
class User { class User {
constructor(properties) { constructor(properties) {
this.username = properties.username this.username = properties.username
@ -1027,10 +1031,7 @@ class User {
<input type="checkbox" id="${this.username}_perm_SERVERS"> <input type="checkbox" id="${this.username}_perm_SERVERS">
<label for="${this.username}_perm_SERVERS">Serveurs</label> <label for="${this.username}_perm_SERVERS">Serveurs</label>
</div> </div>
<div>
<input type="checkbox" id="${this.username}_perm_PIPELINES">
<label for="${this.username}_perm_PIPELINES">Pipelines</label>
</div>
<div> <div>
<input type="checkbox" id="${this.username}_perm_METRICS"> <input type="checkbox" id="${this.username}_perm_METRICS">
<label for="${this.username}_perm_METRICS">Metrics</label> <label for="${this.username}_perm_METRICS">Metrics</label>
@ -1090,7 +1091,7 @@ class User {
editPermissions.push(getID(`${this.username}_perm_SERVICES`)) editPermissions.push(getID(`${this.username}_perm_SERVICES`))
editPermissions.push(getID(`${this.username}_perm_LINKS`)) editPermissions.push(getID(`${this.username}_perm_LINKS`))
editPermissions.push(getID(`${this.username}_perm_SERVERS`)) editPermissions.push(getID(`${this.username}_perm_SERVERS`))
editPermissions.push(getID(`${this.username}_perm_PIPELINES`))
editPermissions.push(getID(`${this.username}_perm_METRICS`)) editPermissions.push(getID(`${this.username}_perm_METRICS`))
editPermissions.push(getID(`${this.username}_perm_USERS`)) editPermissions.push(getID(`${this.username}_perm_USERS`))
editPermissions.push(getID(`${this.username}_perm_SETTINGS`)) editPermissions.push(getID(`${this.username}_perm_SETTINGS`))

View File

@ -590,7 +590,6 @@ explorer.createWindow(() => {
}) })
} else { } else {
// Make Download using result // Make Download using result
const element = document.createElement('a'); const element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(result)); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(result));
element.setAttribute('download', file.name); element.setAttribute('download', file.name);
@ -598,6 +597,7 @@ explorer.createWindow(() => {
document.body.appendChild(element); document.body.appendChild(element);
element.click(); element.click();
document.body.removeChild(element); document.body.removeChild(element);
} }
}) })
}) })
@ -614,15 +614,7 @@ explorer.createWindow(() => {
function editFile() { function editFile() {
const reqFiles = post("FX_GETFILE", file.fileDirectory) const reqFiles = post("FX_GETFILE", file.fileDirectory)
//Create a popup for the loading
View.createPopup({
title: `<i class='fa-solid fa-file-pen'></i> Editeur`,
content: `<p><i class='fa-solid fa-rotate fa-spin'></i> Chargement en cours ...</p>`
})
reqFiles.then((result) => { reqFiles.then((result) => {
View.destroyPopup(`<i class='fa-solid fa-file-pen'></i> Editeur}`)
if(result == "NOT_PERMITTED") { if(result == "NOT_PERMITTED") {
View.createPopup({ View.createPopup({
title: `<i class='fa fa-warning'></i> Erreur`, title: `<i class='fa fa-warning'></i> Erreur`,
@ -632,18 +624,9 @@ explorer.createWindow(() => {
const editor = new ViewWindow({ const editor = new ViewWindow({
title: `<i class="fa-solid fa-file-pen"></i> Editeur - ${file.fileDirectory}`, title: `<i class="fa-solid fa-file-pen"></i> Editeur - ${file.fileDirectory}`,
width: "1000px", width: "1000px",
height: "650px" height: "600px"
}) })
if(file.type == "image/png" | file.type == "image/jpeg") {
editor.setContent(`
<div style='width: 100%; text-align: center;'>
<img style='width: 500px;' src='${result}'/>
</div>`)
} else {
editor.setContent(` editor.setContent(`
<div class='fx-bar'> <div class='fx-bar'>
@ -651,8 +634,10 @@ explorer.createWindow(() => {
</div> </div>
<textarea id='${editor.getViewTitle()}_editorContent' class='fx-editor-content'>${result}</textarea> <textarea id='${editor.getViewTitle()}_editorContent' class='fx-editor-content'>${result}</textarea>
`) `)
const editorSave = getID(editor.getViewTitle() + "_save") const editorSave = getID(editor.getViewTitle() + "_save")
const editorContent = getID(editor.getViewTitle() + "_editorContent") const editorContent = getID(editor.getViewTitle() + "_editorContent")
@ -688,7 +673,7 @@ explorer.createWindow(() => {
editorContent.style.resize = "none" editorContent.style.resize = "none"
}
} }

View File

@ -22,11 +22,13 @@ const explorer = new ViewComponent({
permission: "SERVERS" permission: "SERVERS"
}) })
/*
const pipelines = new ViewComponent({ const pipelines = new ViewComponent({
name: "Gestion des pipelines", name: "Gestion des pipelines",
icon: "fa-solid fa-code-merge", icon: "fa-solid fa-code-merge",
permission: "PIPELINES" permission: "PIPELINES"
}) })*/
const metrics = new ViewComponent({ const metrics = new ViewComponent({
name: "Web Metrik", name: "Web Metrik",

View File

@ -30,15 +30,6 @@ services.createWindow(async () => {
}) })
const jenkinsService = new Service({
name: "Jenkins",
description: "Gestionnaire de pipeline",
icon: "/images/services/jenkins.svg",
url: "https://jenkins.raphix.fr" ,
canAccess: true,
View: View
})
const raphixwebsite = new Service({ const raphixwebsite = new Service({
name: "Raphix.fr", name: "Raphix.fr",
@ -50,39 +41,17 @@ services.createWindow(async () => {
}) })
const cvraphix = new Service({
name: "CV Raphix",
description: "Curriculum Vitae de Raphix",
icon: "/images/services/cv.png",
url: "https://cv.raphix.fr",
canAccess: true,
View: View
})
const lavalink = new Service({
name: "Lavalink",
description: "Serveur Lavalink pour Subsonics",
icon: "/images/services/lavalink.svg",
url: "http://omega.raphix.fr:2333",
canAccess: false,
View: View
})
allServices.push(subsonicsService.generateHTML()) allServices.push(subsonicsService.generateHTML())
allServices.push(lavalink.generateHTML())
allServices.push(giteaService.generateHTML()) allServices.push(giteaService.generateHTML())
allServices.push(jenkinsService.generateHTML())
allServices.push(raphixwebsite.generateHTML()) allServices.push(raphixwebsite.generateHTML())
allServices.push(cvraphix.generateHTML())
View.setContent(`<div class='sv-list'>${allServices.join("")}</div>`) View.setContent(`<div class='sv-list'>${allServices.join("")}</div>`)
await subsonicsService.loadScript() await subsonicsService.loadScript()
await giteaService.loadScript() await giteaService.loadScript()
await jenkinsService.loadScript()
await raphixwebsite.loadScript() await raphixwebsite.loadScript()
await cvraphix.loadScript()
await lavalink.loadScript()
}) })

View File

@ -19,8 +19,6 @@ settings.createWindow(async () => {
</div> </div>
<div class="category"> <div class="category">
<p>Configuration des Tokens</p> <p>Configuration des Tokens</p>
<p class='user-line-displayname'>Jenkins</p>
<input class='field' type="text" id="jenkins_token" placeholder="Token Jenkins">
<p class='user-line-displayname'> Omega </p> <p class='user-line-displayname'> Omega </p>
<input class='field' type="text" id="omega_token" placeholder="Token Omega"> <input class='field' type="text" id="omega_token" placeholder="Token Omega">
<button id="st-save" class="btn green"><span> Sauvegarder</span></button> <button id="st-save" class="btn green"><span> Sauvegarder</span></button>
@ -93,11 +91,9 @@ settings.createWindow(async () => {
const restartButton = document.getElementById("st-restart") const restartButton = document.getElementById("st-restart")
const stopButton = document.getElementById("st-stop") const stopButton = document.getElementById("st-stop")
const saveButton = document.getElementById("st-save") const saveButton = document.getElementById("st-save")
const jenkinsToken = document.getElementById("jenkins_token")
const omegaToken = document.getElementById("omega_token") const omegaToken = document.getElementById("omega_token")
get("SETTINGS_GET").then((settings) => { get("SETTINGS_GET").then((settings) => {
jenkinsToken.value = settings.jenkins_token
omegaToken.value = settings.omega_token omegaToken.value = settings.omega_token
}) })
@ -111,12 +107,11 @@ settings.createWindow(async () => {
saveButton.addEventListener("click", () => { saveButton.addEventListener("click", () => {
post("SETTINGS_SAVE", { post("SETTINGS_SAVE", {
jenkins_token: jenkinsToken.value,
omega_token: omegaToken.value omega_token: omegaToken.value
}) })
get("SETTINGS_GET").then((settings) => { get("SETTINGS_GET").then((settings) => {
jenkinsToken.value = settings.jenkins_token
omegaToken.value = settings.omega_token omegaToken.value = settings.omega_token
}) })
}) })

View File

@ -61,10 +61,7 @@ users.createWindow(async () => {
<input type="checkbox" id="perm_SERVERS"> <input type="checkbox" id="perm_SERVERS">
<label for="perm_SERVERS">Serveurs</label> <label for="perm_SERVERS">Serveurs</label>
</div> </div>
<div>
<input type="checkbox" id="perm_PIPELINES">
<label for="perm_PIPELINES">Pipelines</label>
</div>
<div> <div>
<input type="checkbox" id="perm_METRICS"> <input type="checkbox" id="perm_METRICS">
<label for="perm_METRICS">Metrics</label> <label for="perm_METRICS">Metrics</label>

View File

@ -54,7 +54,6 @@
<script src="/javascripts/link.js"></script> <script src="/javascripts/link.js"></script>
<script src="/javascripts/service.js"></script> <script src="/javascripts/service.js"></script>
<script src="/javascripts/server.js"></script> <script src="/javascripts/server.js"></script>
<script src="/javascripts/pipeline.js"></script>
<script src="/javascripts/filexplorer.js"></script> <script src="/javascripts/filexplorer.js"></script>
<script src="/javascripts/user.js"></script> <script src="/javascripts/user.js"></script>
<script src="/javascripts/metric.js"></script> <script src="/javascripts/metric.js"></script>