mirror of
https://github.com/louislam/dockge.git
synced 2025-08-14 11:19:17 +02:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
491059cebf |
@ -103,10 +103,6 @@ class Logger {
|
|||||||
* @param level Log level. One of INFO, WARN, ERROR, DEBUG or can be customized.
|
* @param level Log level. One of INFO, WARN, ERROR, DEBUG or can be customized.
|
||||||
*/
|
*/
|
||||||
log(module: string, msg: unknown, level: string) {
|
log(module: string, msg: unknown, level: string) {
|
||||||
if (level === "DEBUG" && !isDev) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hideLog[level] && this.hideLog[level].includes(module.toLowerCase())) {
|
if (this.hideLog[level] && this.hideLog[level].includes(module.toLowerCase())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ export class DockerSocketHandler extends SocketHandler {
|
|||||||
throw new ValidationError("Stack name must be a string");
|
throw new ValidationError("Stack name must be a string");
|
||||||
}
|
}
|
||||||
|
|
||||||
const stack = Stack.getStack(server, stackName, true);
|
const stack = Stack.getStack(server, stackName);
|
||||||
const serviceStatusList = Object.fromEntries(await stack.getServiceStatusList());
|
const serviceStatusList = Object.fromEntries(await stack.getServiceStatusList());
|
||||||
callback({
|
callback({
|
||||||
ok: true,
|
ok: true,
|
||||||
|
@ -31,19 +31,17 @@ export class Stack {
|
|||||||
|
|
||||||
protected static managedStackList: Map<string, Stack> = new Map();
|
protected static managedStackList: Map<string, Stack> = new Map();
|
||||||
|
|
||||||
constructor(server : DockgeServer, name : string, composeYAML? : string, skipFSOperations = false) {
|
constructor(server : DockgeServer, name : string, composeYAML? : string) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.server = server;
|
this.server = server;
|
||||||
this._composeYAML = composeYAML;
|
this._composeYAML = composeYAML;
|
||||||
|
|
||||||
if (!skipFSOperations) {
|
// Check if compose file name is different from compose.yaml
|
||||||
// Check if compose file name is different from compose.yaml
|
const supportedFileNames = [ "compose.yaml", "compose.yml", "docker-compose.yml", "docker-compose.yaml" ];
|
||||||
const supportedFileNames = [ "compose.yaml", "compose.yml", "docker-compose.yml", "docker-compose.yaml" ];
|
for (const filename of supportedFileNames) {
|
||||||
for (const filename of supportedFileNames) {
|
if (fs.existsSync(path.join(this.path, filename))) {
|
||||||
if (fs.existsSync(path.join(this.path, filename))) {
|
this._composeFileName = filename;
|
||||||
this._composeFileName = filename;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,34 +281,23 @@ export class Stack {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static getStack(server: DockgeServer, stackName: string, skipFSOperations = false) : Stack {
|
static getStack(server: DockgeServer, stackName: string) : Stack {
|
||||||
let dir = path.join(server.stacksDir, stackName);
|
let dir = path.join(server.stacksDir, stackName);
|
||||||
|
|
||||||
if (!skipFSOperations) {
|
if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) {
|
||||||
if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) {
|
// Maybe it is a stack managed by docker compose directly
|
||||||
// Maybe it is a stack managed by docker compose directly
|
let stackList = this.getStackList(server);
|
||||||
let stackList = this.getStackList(server, true);
|
let stack = stackList.get(stackName);
|
||||||
let stack = stackList.get(stackName);
|
|
||||||
|
|
||||||
if (stack) {
|
if (stack) {
|
||||||
return stack;
|
return stack;
|
||||||
} else {
|
} else {
|
||||||
// Really not found
|
// Really not found
|
||||||
throw new ValidationError("Stack not found");
|
throw new ValidationError("Stack not found");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
log.debug("getStack", "Skip FS operations");
|
|
||||||
}
|
|
||||||
|
|
||||||
let stack : Stack;
|
|
||||||
|
|
||||||
if (!skipFSOperations) {
|
|
||||||
stack = new Stack(server, stackName);
|
|
||||||
} else {
|
|
||||||
stack = new Stack(server, stackName, undefined, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let stack = new Stack(server, stackName);
|
||||||
stack._status = UNKNOWN;
|
stack._status = UNKNOWN;
|
||||||
stack._configFilePath = path.resolve(dir);
|
stack._configFilePath = path.resolve(dir);
|
||||||
return stack;
|
return stack;
|
||||||
@ -399,11 +386,11 @@ export class Stack {
|
|||||||
async getServiceStatusList() {
|
async getServiceStatusList() {
|
||||||
let statusList = new Map<string, number>();
|
let statusList = new Map<string, number>();
|
||||||
|
|
||||||
let res = childProcess.spawnSync("docker", [ "compose", "ps", "--format", "json" ], {
|
let res = childProcess.execSync("docker compose ps --format json", {
|
||||||
cwd: this.path,
|
cwd: this.path,
|
||||||
});
|
});
|
||||||
|
|
||||||
let lines = res.stdout.toString().split("\n");
|
let lines = res.toString().split("\n");
|
||||||
|
|
||||||
for (let line of lines) {
|
for (let line of lines) {
|
||||||
try {
|
try {
|
||||||
|
@ -80,53 +80,37 @@ export class Terminal {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
this._ptyProcess = pty.spawn(this.file, this.args, {
|
||||||
this._ptyProcess = pty.spawn(this.file, this.args, {
|
name: this.name,
|
||||||
name: this.name,
|
cwd: this.cwd,
|
||||||
cwd: this.cwd,
|
cols: TERMINAL_COLS,
|
||||||
cols: TERMINAL_COLS,
|
rows: this.rows,
|
||||||
rows: this.rows,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// On Data
|
// On Data
|
||||||
this._ptyProcess.onData((data) => {
|
this._ptyProcess.onData((data) => {
|
||||||
this.buffer.pushItem(data);
|
this.buffer.pushItem(data);
|
||||||
if (this.server.io) {
|
if (this.server.io) {
|
||||||
this.server.io.to(this.name).emit("terminalWrite", this.name, data);
|
this.server.io.to(this.name).emit("terminalWrite", this.name, data);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// On Exit
|
|
||||||
this._ptyProcess.onExit(this.exit);
|
|
||||||
} catch (error) {
|
|
||||||
if (error instanceof Error) {
|
|
||||||
log.error("Terminal", "Failed to start terminal: " + error.message);
|
|
||||||
const exitCode = Number(error.message.split(" ").pop());
|
|
||||||
this.exit({
|
|
||||||
exitCode,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
// On Exit
|
||||||
|
this._ptyProcess.onExit((res) => {
|
||||||
|
this.server.io.to(this.name).emit("terminalExit", this.name, res.exitCode);
|
||||||
|
|
||||||
|
// Remove room
|
||||||
|
this.server.io.in(this.name).socketsLeave(this.name);
|
||||||
|
|
||||||
|
Terminal.terminalMap.delete(this.name);
|
||||||
|
log.debug("Terminal", "Terminal " + this.name + " exited with code " + res.exitCode);
|
||||||
|
|
||||||
|
if (this.callback) {
|
||||||
|
this.callback(res.exitCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Exit event handler
|
|
||||||
* @param res
|
|
||||||
*/
|
|
||||||
protected exit = (res : {exitCode: number, signal?: number | undefined}) => {
|
|
||||||
this.server.io.to(this.name).emit("terminalExit", this.name, res.exitCode);
|
|
||||||
|
|
||||||
// Remove room
|
|
||||||
this.server.io.in(this.name).socketsLeave(this.name);
|
|
||||||
|
|
||||||
Terminal.terminalMap.delete(this.name);
|
|
||||||
log.debug("Terminal", "Terminal " + this.name + " exited with code " + res.exitCode);
|
|
||||||
|
|
||||||
if (this.callback) {
|
|
||||||
this.callback(res.exitCode);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public onExit(callback : (exitCode : number) => void) {
|
public onExit(callback : (exitCode : number) => void) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,11 @@ const languageList = {
|
|||||||
"de": "Deutsch",
|
"de": "Deutsch",
|
||||||
"fr": "Français",
|
"fr": "Français",
|
||||||
"pt": "Português",
|
"pt": "Português",
|
||||||
"sl": "Slovenščina",
|
|
||||||
"tr": "Türkçe",
|
"tr": "Türkçe",
|
||||||
"zh-CN": "简体中文",
|
"zh-CN": "简体中文",
|
||||||
"ur": "Urdu",
|
"ur": "Urdu",
|
||||||
"ko-KR": "한국어",
|
"ko-KR": "한국어",
|
||||||
"ru": "Русский"
|
"ru": "Русский",
|
||||||
};
|
};
|
||||||
|
|
||||||
let messages = {
|
let messages = {
|
||||||
|
@ -1,94 +0,0 @@
|
|||||||
{
|
|
||||||
"languageName": "Slovenščina",
|
|
||||||
"Create your admin account": "Ustvarite svoj skrbniški račun",
|
|
||||||
"authIncorrectCreds": "Napačno uporabniško ime ali geslo.",
|
|
||||||
"PasswordsDoNotMatch": "Gesli se ne ujemata.",
|
|
||||||
"Repeat Password": "Ponovi geslo",
|
|
||||||
"Create": "Ustvari",
|
|
||||||
"signedInDisp": "Prijavljeni kot {0}",
|
|
||||||
"signedInDispDisabled": "Preverjanje pristnosti onemogočeno.",
|
|
||||||
"home": "Domov",
|
|
||||||
"console": "Konzola",
|
|
||||||
"registry": "Register",
|
|
||||||
"compose": "Compose",
|
|
||||||
"addFirstStackMsg": "Ustvarite svoj prvi Stack!",
|
|
||||||
"stackName": "Ime Stack-a",
|
|
||||||
"deployStack": "Razporedi",
|
|
||||||
"deleteStack": "Izbriši",
|
|
||||||
"stopStack": "Ustavi",
|
|
||||||
"restartStack": "Ponovni zagon",
|
|
||||||
"updateStack": "Posodobi",
|
|
||||||
"startStack": "Zaženi",
|
|
||||||
"editStack": "Uredi",
|
|
||||||
"discardStack": "Zavrzi",
|
|
||||||
"saveStackDraft": "Shrani",
|
|
||||||
"notAvailableShort": "Ni na voljo",
|
|
||||||
"deleteStackMsg": "Ste prepričani, da želite izbrisati ta Stack?",
|
|
||||||
"stackNotManagedByDockgeMsg": "Ta Stack ni upravljan s strani Dockge.",
|
|
||||||
"primaryHostname": "Osnovno gostiteljsko ime",
|
|
||||||
"general": "Splošno",
|
|
||||||
"container": "Kontejner | Kontejnerji",
|
|
||||||
"scanFolder": "Preglej Stack mapo",
|
|
||||||
"dockerImage": "Slika",
|
|
||||||
"restartPolicyUnlessStopped": "Razen ko je zaustavljeno",
|
|
||||||
"restartPolicyAlways": "Vedno",
|
|
||||||
"restartPolicyOnFailure": "Ob napaki",
|
|
||||||
"restartPolicyNo": "Ne",
|
|
||||||
"environmentVariable": "Okoljska spremenljivka | Okoljske spremenljivke",
|
|
||||||
"restartPolicy": "Politika ponovnega zagona",
|
|
||||||
"containerName": "Ime kontejnerja",
|
|
||||||
"port": "Vrata | Vrata",
|
|
||||||
"volume": "Zvezek | Zvezki",
|
|
||||||
"network": "Omrežje | Omrežja",
|
|
||||||
"dependsOn": "Odvisnost kontejnerja | Odvisnosti kontejnerjev",
|
|
||||||
"addListItem": "Dodaj {0}",
|
|
||||||
"deleteContainer": "Izbriši",
|
|
||||||
"addContainer": "Dodaj kontejner",
|
|
||||||
"addNetwork": "Dodaj omrežje",
|
|
||||||
"disableauth.message1": "Ste prepričani, da želite <strong>onemogočiti overjanje</strong>?",
|
|
||||||
"disableauth.message2": "Namerno je zasnovano za scenarije, <strong>kjer nameravate izvajati avtentikacijo tretjih oseb</strong> pred Dockge, kot so Cloudflare Access, Authelia ali druge avtentikacijske mehanizme.",
|
|
||||||
"passwordNotMatchMsg": "Ponovljeno geslo se ne ujema.",
|
|
||||||
"autoGet": "Samodejno pridobi",
|
|
||||||
"add": "Dodaj",
|
|
||||||
"Edit": "Uredi",
|
|
||||||
"applyToYAML": "Uporabi za YAML",
|
|
||||||
"createExternalNetwork": "Ustvari",
|
|
||||||
"addInternalNetwork": "Dodaj",
|
|
||||||
"Save": "Shrani",
|
|
||||||
"Language": "Jezik",
|
|
||||||
"Current User": "Trenutni uporabnik",
|
|
||||||
"Change Password": "Spremeni geslo",
|
|
||||||
"Current Password": "Trenutno geslo",
|
|
||||||
"New Password": "Novo geslo",
|
|
||||||
"Repeat New Password": "Ponovi novo geslo",
|
|
||||||
"Update Password": "Posodobi geslo",
|
|
||||||
"Advanced": "Napredno",
|
|
||||||
"Please use this option carefully!": "Prosimo, uporabite to možnost previdno!",
|
|
||||||
"Enable Auth": "Omogoči overjanje",
|
|
||||||
"Disable Auth": "Onemogoči overjanje",
|
|
||||||
"I understand, please disable": "Razumem, prosim onemogočite",
|
|
||||||
"Leave": "Zapusti",
|
|
||||||
"Frontend Version": "Različica vmesnika",
|
|
||||||
"Check Update On GitHub": "Preveri posodobitve na GitHubu",
|
|
||||||
"Show update if available": "Prikaži posodobitve, če so na voljo",
|
|
||||||
"Also check beta release": "Preveri tudi beta izdaje",
|
|
||||||
"Remember me": "Zapomni si me",
|
|
||||||
"Login": "Prijava",
|
|
||||||
"Username": "Uporabniško ime",
|
|
||||||
"Password": "Geslo",
|
|
||||||
"Settings": "Nastavitve",
|
|
||||||
"Logout": "Odjava",
|
|
||||||
"Lowercase only": "Samo male črke",
|
|
||||||
"Convert to Compose": "Pretvori v Compose",
|
|
||||||
"Docker Run": "Zagon Dockerja",
|
|
||||||
"active": "aktivno",
|
|
||||||
"exited": "izklopljeno",
|
|
||||||
"inactive": "neaktivno",
|
|
||||||
"Appearance": "Videz",
|
|
||||||
"Security": "Varnost",
|
|
||||||
"About": "O nas",
|
|
||||||
"Allowed commands:": "Dovoljeni ukazi:",
|
|
||||||
"Internal Networks": "Notranja omrežja",
|
|
||||||
"External Networks": "Zunanja omrežja",
|
|
||||||
"No External Networks": "Ni zunanjih omrežij"
|
|
||||||
}
|
|
@ -1,10 +1,7 @@
|
|||||||
{
|
{
|
||||||
"languageName": "Türkçe",
|
"languageName": "Türkçe",
|
||||||
"Create your admin account": "Yönetici hesabınızı oluşturun",
|
|
||||||
"authIncorrectCreds": "Yanlış kullanıcı adı veya parola.",
|
"authIncorrectCreds": "Yanlış kullanıcı adı veya parola.",
|
||||||
"PasswordsDoNotMatch": "Parolalar eşleşmiyor.",
|
"PasswordsDoNotMatch": "Parolalar eşleşmiyor.",
|
||||||
"Repeat Password": "Parolayı Tekrarla",
|
|
||||||
"Create": "Oluştur",
|
|
||||||
"signedInDisp": "{0} olarak oturum açıldı",
|
"signedInDisp": "{0} olarak oturum açıldı",
|
||||||
"signedInDispDisabled": "Yetkilendirme Devre Dışı.",
|
"signedInDispDisabled": "Yetkilendirme Devre Dışı.",
|
||||||
"home": "Anasayfa",
|
"home": "Anasayfa",
|
||||||
@ -50,45 +47,7 @@
|
|||||||
"passwordNotMatchMsg": "Tekrarlanan parola eşleşmiyor.",
|
"passwordNotMatchMsg": "Tekrarlanan parola eşleşmiyor.",
|
||||||
"autoGet": "Otomatik Al",
|
"autoGet": "Otomatik Al",
|
||||||
"add": "Ekle",
|
"add": "Ekle",
|
||||||
"Edit": "Düzenle",
|
|
||||||
"applyToYAML": "YAML'ye uygulayın",
|
"applyToYAML": "YAML'ye uygulayın",
|
||||||
"createExternalNetwork": "Oluştur",
|
"createExternalNetwork": "Oluştur",
|
||||||
"addInternalNetwork": "Ekle",
|
"addInternalNetwork": "Ekle"
|
||||||
"Save": "Kaydet",
|
|
||||||
"Language": "Dil",
|
|
||||||
"Current User": "Mevcut Kullanıcı",
|
|
||||||
"Change Password": "Mevcut Parola",
|
|
||||||
"Current Password": "Mevcut Parola",
|
|
||||||
"New Password": "Yeni Parola",
|
|
||||||
"Repeat New Password": "Yeni Parolayı Tekrarla",
|
|
||||||
"Update Password": "Parolayı Güncelle",
|
|
||||||
"Advanced": "Gelişmiş",
|
|
||||||
"Please use this option carefully!": "Lütfen bu seçeneği dikkatli kullanın!",
|
|
||||||
"Enable Auth": "Kimlik Doğrulamayı Etkinleştir",
|
|
||||||
"Disable Auth": "Kimlik Doğrulamayı Devre Dışı Bırak",
|
|
||||||
"I understand, please disable": "Anlıyorum, lütfen devre dışı bırakın",
|
|
||||||
"Leave": "Ayrıl",
|
|
||||||
"Frontend Version": "Frontend Versiyon",
|
|
||||||
"Check Update On GitHub": "GitHub'da Güncellemeyi Kontrol Edin",
|
|
||||||
"Show update if available": "Varsa güncellemeyi göster",
|
|
||||||
"Also check beta release": "Ayrıca beta sürümünü kontrol edin",
|
|
||||||
"Remember me": "Beni Hatırla",
|
|
||||||
"Login": "Oturum Aç",
|
|
||||||
"Username": "Kullanıcı Adı",
|
|
||||||
"Password": "Parola",
|
|
||||||
"Settings": "Ayarlar",
|
|
||||||
"Logout": "Oturumu Kapat",
|
|
||||||
"Lowercase only": "Yalnızca küçük harf",
|
|
||||||
"Convert to Compose": "Compose'a Dönüştür",
|
|
||||||
"Docker Run": "Docker Run",
|
|
||||||
"active": "aktif",
|
|
||||||
"exited": "çıkış yaptı",
|
|
||||||
"inactive": "aktif değil",
|
|
||||||
"Appearance": "Görünüm",
|
|
||||||
"Security": "Güvenlik",
|
|
||||||
"About": "Hakkında",
|
|
||||||
"Allowed commands:": "İzin verilen komutlar:",
|
|
||||||
"Internal Networks": "İç Ağlar",
|
|
||||||
"External Networks": "Dış Ağlar",
|
|
||||||
"No External Networks": "Dış Ağ Yok"
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "dockge",
|
"name": "dockge",
|
||||||
"version": "1.1.1",
|
"version": "1.1.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"fmt": "eslint \"**/*.{ts,vue}\" --fix",
|
"fmt": "eslint \"**/*.{ts,vue}\" --fix",
|
||||||
"lint": "eslint \"**/*.{ts,vue}\"",
|
"lint": "eslint \"**/*.{ts,vue}\"",
|
||||||
"check-ts": "tsc --noEmit",
|
"check-ts": "tsc --noEmit",
|
||||||
"start": "tsx ./backend/index.ts",
|
"start": "tsx ./backend/index.ts",
|
||||||
"dev:backend": "cross-env NODE_ENV=development tsx watch --inspect ./backend/index.ts",
|
"dev:backend": "cross-env NODE_ENV=development tsx watch ./backend/index.ts",
|
||||||
"dev:frontend": "cross-env NODE_ENV=development vite --host --config ./frontend/vite.config.ts",
|
"dev:frontend": "cross-env NODE_ENV=development vite --host --config ./frontend/vite.config.ts",
|
||||||
"release-final": "tsx ./extra/test-docker.ts && tsx extra/update-version.ts && pnpm run build:frontend && npm run build:docker",
|
"release-final": "tsx ./extra/test-docker.ts && tsx extra/update-version.ts && pnpm run build:frontend && npm run build:docker",
|
||||||
"build:frontend": "vite build --config ./frontend/vite.config.ts",
|
"build:frontend": "vite build --config ./frontend/vite.config.ts",
|
||||||
|
Reference in New Issue
Block a user