Compare commits

..

13 Commits

20 changed files with 10647 additions and 6662 deletions

View File

@ -19,45 +19,26 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
run: | # Mainly for Windows
git config --global core.autocrlf false
git config --global core.eol lf
uses: actions/checkout@v4
- run: git config --global core.autocrlf false # Mainly for Windows
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node}}
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
run: npm install
- name: Lint
run: pnpm run lint
run: npm run lint
- name: Check Typescript
run: pnpm run check-ts
run: npm run check-ts
- name: Build
run: pnpm run build:frontend
run: npm run build:frontend
# more things can be add later like tests etc..

View File

@ -16,27 +16,5 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Close Incorrect Issue
run: node extra/close-incorrect-issue.js ${{ secrets.GITHUB_TOKEN }} ${{ github.event.issue.number }} ${{ github.event.issue.user.login }}

View File

@ -58,8 +58,7 @@ I personally do not like something that requires so many configurations before y
## Tools
- [`Node.js`](https://nodejs.org/) >= 20
- [`pnpm`](https://pnpm.io/)
- [`Node.js`](https://nodejs.org/) >= 22.14.0
- [`git`](https://git-scm.com/)
- IDE that supports [`ESLint`](https://eslint.org/) and EditorConfig (I am using [`IntelliJ IDEA`](https://www.jetbrains.com/idea/))
- A SQLite GUI tool (f.ex. [`SQLite Expert Personal`](https://www.sqliteexpert.com/download.html) or [`DBeaver Community`](https://dbeaver.io/download/))
@ -67,14 +66,14 @@ I personally do not like something that requires so many configurations before y
## Install Dependencies for Development
```bash
pnpm install
npm install
```
## Dev Server
```
pnpm run dev:frontend
pnpm run dev:backend
npm run dev:frontend
npm run dev:backend
```
## Backend Dev Server
@ -94,7 +93,7 @@ You can use Vue.js devtools Chrome extension for debugging.
### Build the frontend
```bash
pnpm run build
npm run build
```
## Database Migration
@ -117,7 +116,7 @@ Both frontend and backend share the same package.json. However, the frontend dep
Should only be done by the maintainer.
```bash
pnpm update
npm update
````
It should update the patch release version only.

View File

@ -17,6 +17,7 @@ export class DockerSocketHandler extends AgentSocketHandler {
callbackResult({
ok: true,
msg: "Deployed",
msgi18n: true,
}, callback);
stack.joinCombinedTerminal(socket);
} catch (e) {
@ -30,7 +31,8 @@ export class DockerSocketHandler extends AgentSocketHandler {
await this.saveStack(server, name, composeYAML, composeENV, isAdd);
callbackResult({
ok: true,
"msg": "Saved"
msg: "Saved",
msgi18n: true,
}, callback);
server.sendStackList();
} catch (e) {
@ -56,7 +58,8 @@ export class DockerSocketHandler extends AgentSocketHandler {
server.sendStackList();
callbackResult({
ok: true,
msg: "Deleted"
msg: "Deleted",
msgi18n: true,
}, callback);
} catch (e) {
@ -94,7 +97,8 @@ export class DockerSocketHandler extends AgentSocketHandler {
server.sendStackList();
callbackResult({
ok: true,
msg: "Updated"
msg: "Updated",
msgi18n: true,
}, callback);
} catch (e) {
callbackError(e, callback);
@ -114,7 +118,8 @@ export class DockerSocketHandler extends AgentSocketHandler {
await stack.start(socket);
callbackResult({
ok: true,
msg: "Started"
msg: "Started",
msgi18n: true,
}, callback);
server.sendStackList();
@ -138,7 +143,8 @@ export class DockerSocketHandler extends AgentSocketHandler {
await stack.stop(socket);
callbackResult({
ok: true,
msg: "Stopped"
msg: "Stopped",
msgi18n: true,
}, callback);
server.sendStackList();
} catch (e) {
@ -159,7 +165,8 @@ export class DockerSocketHandler extends AgentSocketHandler {
await stack.restart(socket);
callbackResult({
ok: true,
msg: "Restarted"
msg: "Restarted",
msgi18n: true,
}, callback);
server.sendStackList();
} catch (e) {
@ -180,7 +187,8 @@ export class DockerSocketHandler extends AgentSocketHandler {
await stack.update(socket);
callbackResult({
ok: true,
msg: "Updated"
msg: "Updated",
msgi18n: true,
}, callback);
server.sendStackList();
} catch (e) {
@ -201,7 +209,8 @@ export class DockerSocketHandler extends AgentSocketHandler {
await stack.down(socket);
callbackResult({
ok: true,
msg: "Downed"
msg: "Downed",
msgi18n: true,
}, callback);
server.sendStackList();
} catch (e) {

View File

@ -236,42 +236,63 @@ export function copyYAMLComments(doc : Document, src : Document) {
/**
* Copy yaml comments from srcItems to items
* Typescript is super annoying here, so I have to use any here
* TODO: Since comments are belong to the array index, the comments will be lost if the order of the items is changed or removed or added.
* Attempts to preserve comments by matching content rather than just array indices
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function copyYAMLCommentsItems(items : any, srcItems : any) {
function copyYAMLCommentsItems(items: any, srcItems: any) {
if (!items || !srcItems) {
return;
}
// First pass - try to match items by their content
for (let i = 0; i < items.length; i++) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const item : any = items[i];
const item: any = items[i];
// Try to find matching source item by content
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const srcItem : any = srcItems[i];
const srcIndex = srcItems.findIndex((srcItem: any) =>
JSON.stringify(srcItem.value) === JSON.stringify(item.value) &&
JSON.stringify(srcItem.key) === JSON.stringify(item.key)
);
if (!srcItem) {
continue;
}
if (srcIndex !== -1) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const srcItem: any = srcItems[srcIndex];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const nextSrcItem: any = srcItems[srcIndex + 1];
if (item.key && srcItem.key) {
item.key.comment = srcItem.key.comment;
item.key.commentBefore = srcItem.key.commentBefore;
}
if (item.key && srcItem.key) {
item.key.comment = srcItem.key.comment;
item.key.commentBefore = srcItem.key.commentBefore;
}
if (srcItem.comment) {
item.comment = srcItem.comment;
}
if (srcItem.comment) {
item.comment = srcItem.comment;
}
if (item.value && srcItem.value) {
if (typeof item.value === "object" && typeof srcItem.value === "object") {
item.value.comment = srcItem.value.comment;
item.value.commentBefore = srcItem.value.commentBefore;
// Handle comments between array items
if (nextSrcItem && nextSrcItem.commentBefore) {
if (items[i + 1]) {
items[i + 1].commentBefore = nextSrcItem.commentBefore;
}
}
if (item.value.items && srcItem.value.items) {
copyYAMLCommentsItems(item.value.items, srcItem.value.items);
// Handle trailing comments after array items
if (srcItem.value && srcItem.value.comment) {
if (item.value) {
item.value.comment = srcItem.value.comment;
}
}
if (item.value && srcItem.value) {
if (typeof item.value === "object" && typeof srcItem.value === "object") {
item.value.comment = srcItem.value.comment;
item.value.commentBefore = srcItem.value.commentBefore;
if (item.value.items && srcItem.value.items) {
copyYAMLCommentsItems(item.value.items, srcItem.value.items);
}
}
}
}

View File

@ -1,6 +1,4 @@
FROM node:22-bookworm-slim
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN apt update && apt install --yes --no-install-recommends \
curl \
ca-certificates \
@ -19,5 +17,4 @@ RUN apt update && apt install --yes --no-install-recommends \
docker-ce-cli \
docker-compose-plugin \
&& rm -rf /var/lib/apt/lists/* \
&& npm install pnpm -g \
&& pnpm install -g tsx
&& npm install -g tsx

View File

@ -9,8 +9,8 @@ FROM louislam/dockge:build-healthcheck AS build_healthcheck
FROM louislam/dockge:base AS build
WORKDIR /app
COPY --chown=node:node ./package.json ./package.json
COPY --chown=node:node ./pnpm-lock.yaml ./pnpm-lock.yaml
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
COPY --chown=node:node ./package-lock.json ./package-lock.json
RUN npm ci
############################################
# ⭐ Main Image
@ -33,10 +33,10 @@ VOLUME /app/data
EXPOSE 5001
HEALTHCHECK --interval=60s --timeout=30s --start-period=60s --retries=5 CMD extra/healthcheck
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["bash", "-c", "node ./extra/clean-tsx-tmp.js && tsx ./backend/index.ts"]
CMD ["tsx", "./backend/index.ts"]
############################################
# Mark as Nightly
############################################
FROM release AS nightly
RUN pnpm run mark-as-nightly
RUN npm run mark-as-nightly

View File

@ -1,13 +0,0 @@
/*
* This script is used to clean up the tmp directory.
* A workaround for https://github.com/louislam/dockge/issues/353
*/
import * as fs from "fs";
try {
fs.rmSync("/tmp/tsx-0", {
recursive: true,
});
} catch (e) {
}

View File

@ -4,7 +4,7 @@
<ul v-if="isArrayInited" class="list-group">
<li v-for="(value, index) in array" :key="index" class="list-group-item">
<select v-model="array[index]" class="no-bg domain-input">
<option value="">Select a network...</option>
<option value="">{{ $t(`Select a network...`) }}</option>
<option v-for="option in options" :key="option" :value="option">{{ option }}</option>
</select>

View File

@ -116,7 +116,7 @@
</label>
<div v-if="networkList.length === 0 && service.networks && service.networks.length > 0" class="text-warning mb-3">
No networks available. You need to add internal networks or enable external networks in the right side first.
{{ $t("NoNetworksAvailable") }}
</div>
<ArraySelect name="networks" :display-name="$t('network')" placeholder="Network Name" :options="networkList" />
@ -127,7 +127,7 @@
<label class="form-label">
{{ $t("dependsOn") }}
</label>
<ArrayInput name="depends_on" :display-name="$t('dependsOn')" placeholder="Container Name" />
<ArrayInput name="depends_on" :display-name="$t('dependsOn')" :placeholder="$t(`containerName`)" />
</div>
</div>
</transition>

View File

@ -3,7 +3,7 @@
<h5>{{ $t("Internal Networks") }}</h5>
<ul class="list-group">
<li v-for="(networkRow, index) in networkList" :key="index" class="list-group-item">
<input v-model="networkRow.key" type="text" class="no-bg domain-input" placeholder="Network name..." />
<input v-model="networkRow.key" type="text" class="no-bg domain-input" :placeholder="$t(`Network name...`)" />
<font-awesome-icon icon="times" class="action remove ms-2 me-3 text-danger" @click="remove(index)" />
</li>
</ul>

View File

@ -247,7 +247,6 @@ export default {
<style scoped lang="scss">
.main-terminal {
height: 100%;
overflow-x: scroll;
}
</style>

View File

@ -47,7 +47,7 @@
<input
v-model="settings.primaryHostname"
class="form-control"
placeholder="(Unset: Follow current hostname)"
:placeholder="$t(`CurrentHostname`)"
/>
<button class="btn btn-outline-primary" type="button" @click="autoGetPrimaryHostname">
{{ $t("autoGet") }}

View File

@ -95,6 +95,7 @@
"reverseProxyMsg1": "Using a Reverse Proxy?",
"reverseProxyMsg2": "Check how to config it for WebSocket",
"Cannot connect to the socket server.": "Cannot connect to the socket server.",
"Lost connection to the socket server. Reconnecting...": "Lost connection to the socket server. Reconnecting...",
"reconnecting...": "Reconnecting…",
"connecting...": "Connecting to the socket server…",
"url": "URL | URLs",
@ -112,5 +113,20 @@
"agentRemovedSuccessfully": "Agent removed successfully.",
"removeAgent": "Remove Agent",
"removeAgentMsg": "Are you sure you want to remove this agent?",
"LongSyntaxNotSupported": "Long syntax is not supported here. Please use the YAML editor."
"LongSyntaxNotSupported": "Long syntax is not supported here. Please use the YAML editor.",
"Saved": "Saved",
"Deployed": "Deployed",
"Deleted": "Deleted",
"Updated": "Updated",
"Started": "Started",
"Stopped": "Stopped",
"Restarted": "Restarted",
"Downed": "Downed",
"Switch to sh": "Switch to sh",
"terminal": "Terminal",
"CurrentHostname": "(Unset: Follow current hostname)",
"New Container Name...": "New Container Name...",
"Network name...": "Network name...",
"Select a network...": "Select a network...",
"NoNetworksAvailable": "No networks available. You need to add internal networks or enable external networks in the right side first."
}

View File

@ -203,7 +203,7 @@ export default defineComponent({
socket.on("disconnect", () => {
console.log("disconnect");
this.socketIO.connectionErrorMsg = "Lost connection to the socket server. Reconnecting...";
this.socketIO.connectionErrorMsg = `${this.$t("Lost connection to the socket server. Reconnecting...")}`;
this.socketIO.connected = false;
});

View File

@ -1,7 +1,7 @@
<template>
<transition name="slide-fade" appear>
<div>
<h1 v-if="isAdd" class="mb-3">Compose</h1>
<h1 v-if="isAdd" class="mb-3">{{$t("compose")}}</h1>
<h1 v-else class="mb-3">
<Uptime :stack="globalStack" :pill="true" /> {{ stack.name }}
<span v-if="$root.agentCount > 1" class="agent-name">
@ -112,7 +112,7 @@
<div v-if="isEditMode" class="input-group mb-3">
<input
v-model="newContainerName"
placeholder="New Container Name..."
:placeholder="$t(`New Container Name...`)"
class="form-control"
@keyup.enter="addContainer"
/>
@ -150,7 +150,7 @@
<!-- Combined Terminal Output -->
<div v-show="!isEditMode">
<h4 class="mb-3">Terminal</h4>
<h4 class="mb-3">{{$t("terminal")}}</h4>
<Terminal
ref="combinedTerminal"
class="mb-3 terminal"

View File

@ -1,10 +1,10 @@
<template>
<transition name="slide-fade" appear>
<div>
<h1 class="mb-3">Terminal - {{ serviceName }} ({{ stackName }})</h1>
<h1 class="mb-3">{{$t("terminal")}} - {{ serviceName }} ({{ stackName }})</h1>
<div class="mb-3">
<router-link :to="sh" class="btn btn-normal me-2">Switch to sh</router-link>
<router-link :to="sh" class="btn btn-normal me-2">{{ $t("Switch to sh") }}</router-link>
</div>
<Terminal class="terminal" :rows="20" mode="interactive" :name="terminalName" :stack-name="stackName" :service-name="serviceName" :shell="shell" :endpoint="endpoint"></Terminal>

10520
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,23 +3,23 @@
"version": "1.4.2",
"type": "module",
"engines": {
"node": ">= 18.0.0 && <= 18.17.1"
"node": ">= 22.14.0"
},
"scripts": {
"fmt": "eslint \"**/*.{ts,vue}\" --fix",
"lint": "eslint \"**/*.{ts,vue}\"",
"check-ts": "tsc --noEmit",
"start": "tsx ./backend/index.ts",
"dev": "concurrently -k -r \"wait-on tcp:5000 && pnpm run dev:backend \" \"pnpm run dev:frontend\"",
"dev": "concurrently -k -r \"wait-on tcp:5000 && npm run dev:backend \" \"npm run dev:frontend\"",
"dev:backend": "cross-env NODE_ENV=development tsx watch --inspect ./backend/index.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-beta": "tsx ./extra/test-docker.ts && tsx extra/update-version.ts && pnpm run build:frontend && npm run build:docker-beta",
"release-final": "tsx ./extra/test-docker.ts && tsx extra/update-version.ts && npm run build:frontend && npm run build:docker",
"release-beta": "tsx ./extra/test-docker.ts && tsx extra/update-version.ts && npm run build:frontend && npm run build:docker-beta",
"build:frontend": "vite build --config ./frontend/vite.config.ts",
"build:docker-base": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/dockge:base -f ./docker/Base.Dockerfile . --push",
"build:docker": "node ./extra/env2arg.js docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/dockge:latest -t louislam/dockge:1 -t louislam/dockge:$VERSION -t louislam/dockge:beta -t louislam/dockge:nightly --target release -f ./docker/Dockerfile . --push",
"build:docker-beta": "node ./extra/env2arg.js docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/dockge:beta -t louislam/dockge:$VERSION --target release -f ./docker/Dockerfile . --push",
"build:docker-nightly": "pnpm run build:frontend && docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/dockge:nightly --target nightly -f ./docker/Dockerfile . --push",
"build:docker-nightly": "npm run build:frontend && docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/dockge:nightly --target nightly -f ./docker/Dockerfile . --push",
"build:healthcheck": "docker buildx build -f docker/BuildHealthCheck.Dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/dockge:build-healthcheck . --push",
"start-docker": "docker run --rm -p 5001:5001 --name dockge louislam/dockge:latest",
"mark-as-nightly": "tsx ./extra/mark-as-nightly.ts",
@ -34,32 +34,32 @@
"check-password-strength": "~2.0.10",
"command-exists": "~1.2.9",
"compare-versions": "~6.1.1",
"composerize": "~1.4.1",
"composerize": "~1.7.1",
"croner": "~8.1.2",
"dayjs": "~1.11.13",
"dotenv": "~16.3.2",
"express": "~4.21.1",
"express": "~4.21.2",
"express-static-gzip": "~2.1.8",
"http-graceful-shutdown": "~3.1.13",
"http-graceful-shutdown": "~3.1.14",
"jsonwebtoken": "~9.0.2",
"jwt-decode": "~3.1.2",
"knex": "~2.5.1",
"limiter-es6-compat": "~2.1.2",
"mysql2": "~3.11.3",
"mysql2": "~3.12.0",
"promisify-child-process": "~4.1.2",
"redbean-node": "~0.3.3",
"semver": "^7.6.3",
"socket.io": "~4.8.0",
"socket.io-client": "~4.8.0",
"semver": "^7.7.1",
"socket.io": "~4.8.1",
"socket.io-client": "~4.8.1",
"timezones-list": "~3.0.3",
"ts-command-line-args": "~2.5.1",
"tsx": "~4.6.2",
"tsx": "~4.19.3",
"type-fest": "~4.3.3",
"yaml": "~2.3.4"
},
"devDependencies": {
"@actions/github": "^6.0.0",
"@fontsource/jetbrains-mono": "^5.1.1",
"@fontsource/jetbrains-mono": "^5.2.5",
"@fortawesome/fontawesome-svg-core": "6.4.2",
"@fortawesome/free-regular-svg-icons": "6.4.2",
"@fortawesome/free-solid-svg-icons": "6.4.2",
@ -68,8 +68,8 @@
"@types/bootstrap": "~5.2.10",
"@types/command-exists": "~1.2.3",
"@types/express": "~4.17.21",
"@types/jsonwebtoken": "~9.0.7",
"@types/semver": "^7.5.8",
"@types/jsonwebtoken": "~9.0.9",
"@types/semver": "^7.7.0",
"@typescript-eslint/eslint-plugin": "~6.8.0",
"@typescript-eslint/parser": "~6.8.0",
"@vitejs/plugin-vue": "~4.5.2",
@ -81,19 +81,19 @@
"cross-env": "~7.0.3",
"eslint": "~8.50.0",
"eslint-plugin-jsdoc": "~46.8.2",
"eslint-plugin-vue": "~9.17.0",
"prismjs": "~1.29.0",
"eslint-plugin-vue": "~9.32.0",
"prismjs": "~1.30.0",
"sass": "~1.68.0",
"typescript": "~5.2.2",
"unplugin-vue-components": "~0.25.2",
"vite": "~5.4.8",
"vite": "~5.4.15",
"vite-plugin-compression": "~0.5.1",
"vue": "~3.5.12",
"vue": "~3.5.13",
"vue-eslint-parser": "~9.3.2",
"vue-i18n": "~9.5.0",
"vue-i18n": "~10.0.6",
"vue-prism-editor": "2.0.0-alpha.2",
"vue-qrcode": "~2.2.2",
"vue-router": "~4.2.5",
"vue-router": "~4.5.0",
"vue-toastification": "2.0.0-rc.5",
"wait-on": "^7.2.0",
"xterm-addon-web-links": "~0.9.0"

6522
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff