From 1e7d9fc3aa3dd425468c1f2910a34103038f6364 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 17 Nov 2024 10:22:47 -0600 Subject: [PATCH 1/6] refactor(dokploy): add missing next-18next to dockerfile --- Dockerfile | 1 + apps/dokploy/package.json | 2 +- apps/dokploy/server/server.ts | 2 +- apps/dokploy/templates/templates.ts | 4 ++-- pnpm-lock.yaml | 26 +++++++++++++------------- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 74b70db0e..a35e8a42e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,6 +35,7 @@ RUN apt-get update && apt-get install -y curl unzip apache2-utils && rm -rf /var COPY --from=build /prod/dokploy/.next ./.next COPY --from=build /prod/dokploy/dist ./dist COPY --from=build /prod/dokploy/next.config.mjs ./next.config.mjs +COPY --from=build /prod/dokploy/next-i18next.config.js ./next-i18next.config.js COPY --from=build /prod/dokploy/public ./public COPY --from=build /prod/dokploy/package.json ./package.json COPY --from=build /prod/dokploy/drizzle ./drizzle diff --git a/apps/dokploy/package.json b/apps/dokploy/package.json index 8bba5e4a3..fc695598a 100644 --- a/apps/dokploy/package.json +++ b/apps/dokploy/package.json @@ -11,7 +11,7 @@ "build-next": "next build", "setup": "tsx -r dotenv/config setup.ts && sleep 5 && pnpm run migration:run", "reset-password": "node -r dotenv/config dist/reset-password.mjs", - "dev": "tsx -r dotenv/config ./server/server.ts --project tsconfig.server.json ", + "dev": "TURBOPACK=1 tsx -r dotenv/config ./server/server.ts --project tsconfig.server.json ", "studio": "drizzle-kit studio --config ./server/db/drizzle.config.ts", "migration:generate": "drizzle-kit generate --config ./server/db/drizzle.config.ts", "migration:run": "tsx -r dotenv/config migration.ts", diff --git a/apps/dokploy/server/server.ts b/apps/dokploy/server/server.ts index bf1112333..b65446f8b 100644 --- a/apps/dokploy/server/server.ts +++ b/apps/dokploy/server/server.ts @@ -24,7 +24,7 @@ import { setupTerminalWebSocketServer } from "./wss/terminal"; config({ path: ".env" }); const PORT = Number.parseInt(process.env.PORT || "3000", 10); const dev = process.env.NODE_ENV !== "production"; -const app = next({ dev }); +const app = next({ dev, turbopack: dev }); const handle = app.getRequestHandler(); void app.prepare().then(async () => { try { diff --git a/apps/dokploy/templates/templates.ts b/apps/dokploy/templates/templates.ts index 322eb8e20..686d4ca65 100644 --- a/apps/dokploy/templates/templates.ts +++ b/apps/dokploy/templates/templates.ts @@ -716,8 +716,8 @@ export const templates: TemplateData[] = [ }, tags: ["file", "sync"], load: () => import("./nextcloud-aio/index").then((m) => m.generate), - }, - { + }, + { id: "blender", name: "Blender", version: "latest", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9dd089aa9..8e6ae0500 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -249,7 +249,7 @@ importers: version: 0.5.1(drizzle-orm@0.30.10(@types/react@18.3.5)(postgres@3.4.4)(react@18.2.0))(zod@3.23.8) i18next: specifier: ^23.16.4 - version: 23.16.4 + version: 23.16.5 input-otp: specifier: ^1.2.4 version: 1.2.4(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -276,7 +276,7 @@ importers: version: 15.0.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next-i18next: specifier: ^15.3.1 - version: 15.3.1(i18next@23.16.4)(next@15.0.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-i18next@15.1.0(i18next@23.16.4)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react@18.2.0) + version: 15.3.1(i18next@23.16.5)(next@15.0.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-i18next@15.1.1(i18next@23.16.5)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react@18.2.0) next-themes: specifier: ^0.2.1 version: 0.2.1(next@15.0.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -306,7 +306,7 @@ importers: version: 7.52.1(react@18.2.0) react-i18next: specifier: ^15.1.0 - version: 15.1.0(i18next@23.16.4)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + version: 15.1.1(i18next@23.16.5)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) recharts: specifier: ^2.12.7 version: 2.12.7(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -4734,8 +4734,8 @@ packages: i18next-fs-backend@2.3.2: resolution: {integrity: sha512-LIwUlkqDZnUI8lnUxBnEj8K/FrHQTT/Sc+1rvDm9E8YvvY5YxzoEAASNx+W5M9DfD5s77lI5vSAFWeTp26B/3Q==} - i18next@23.16.4: - resolution: {integrity: sha512-9NIYBVy9cs4wIqzurf7nLXPyf3R78xYbxExVqHLK9od3038rjpyOEzW+XB130kZ1N4PZ9inTtJ471CRJ4Ituyg==} + i18next@23.16.5: + resolution: {integrity: sha512-KTlhE3EP9x6pPTAW7dy0WKIhoCpfOGhRQlO+jttQLgzVaoOjWwBWramu7Pp0i+8wDNduuzXfe3kkVbzrKyrbTA==} iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} @@ -5771,8 +5771,8 @@ packages: peerDependencies: react: ^16.8.0 || ^17 || ^18 || ^19 - react-i18next@15.1.0: - resolution: {integrity: sha512-zj3nJynMnZsy2gPZiOTC7XctCY5eQGqT3tcKMmfJWC9FMvgd+960w/adq61j8iPzpwmsXejqID9qC3Mqu1Xu2Q==} + react-i18next@15.1.1: + resolution: {integrity: sha512-R/Vg9wIli2P3FfeI8o1eNJUJue5LWpFsQePCHdQDmX0Co3zkr6kdT8gAseb/yGeWbNz1Txc4bKDQuZYsC0kQfw==} peerDependencies: i18next: '>= 23.2.3' react: '>= 16.8.0' @@ -10946,7 +10946,7 @@ snapshots: i18next-fs-backend@2.3.2: {} - i18next@23.16.4: + i18next@23.16.5: dependencies: '@babel/runtime': 7.25.0 @@ -11450,17 +11450,17 @@ snapshots: neotraverse@0.6.18: {} - next-i18next@15.3.1(i18next@23.16.4)(next@15.0.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-i18next@15.1.0(i18next@23.16.4)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react@18.2.0): + next-i18next@15.3.1(i18next@23.16.5)(next@15.0.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-i18next@15.1.1(i18next@23.16.5)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react@18.2.0): dependencies: '@babel/runtime': 7.25.0 '@types/hoist-non-react-statics': 3.3.5 core-js: 3.39.0 hoist-non-react-statics: 3.3.2 - i18next: 23.16.4 + i18next: 23.16.5 i18next-fs-backend: 2.3.2 next: 15.0.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 - react-i18next: 15.1.0(i18next@23.16.4)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + react-i18next: 15.1.1(i18next@23.16.5)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next-themes@0.2.1(next@15.0.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: @@ -11951,11 +11951,11 @@ snapshots: dependencies: react: 18.2.0 - react-i18next@15.1.0(i18next@23.16.4)(react-dom@18.2.0(react@18.2.0))(react@18.2.0): + react-i18next@15.1.1(i18next@23.16.5)(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: '@babel/runtime': 7.25.0 html-parse-stringify: 3.0.1 - i18next: 23.16.4 + i18next: 23.16.5 react: 18.2.0 optionalDependencies: react-dom: 18.2.0(react@18.2.0) From 9efd2e3d5c8ba0d940b35db5cc5a6dfcd08e9901 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 17 Nov 2024 10:26:22 -0600 Subject: [PATCH 2/6] chore: change build i18N --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f47a561a5..c5e57a973 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -99,14 +99,14 @@ workflows: only: - main - canary - - pull/665 + - fix/build-i18n - build-arm64: filters: branches: only: - main - canary - - pull/665 + - fix/build-i18n - combine-manifests: requires: - build-amd64 @@ -116,4 +116,4 @@ workflows: only: - main - canary - - pull/665 + - fix/build-i18n From d3304052b0482c19105d9153d35351a2da11a626 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 17 Nov 2024 10:40:34 -0600 Subject: [PATCH 3/6] chore: update dockerfile --- Dockerfile | 1 + apps/dokploy/next-i18next.config.cjs | 10 ++++++++++ apps/dokploy/next-i18next.config.js | 12 ++---------- 3 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 apps/dokploy/next-i18next.config.cjs diff --git a/Dockerfile b/Dockerfile index a35e8a42e..ac8ff7ac7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,6 +36,7 @@ COPY --from=build /prod/dokploy/.next ./.next COPY --from=build /prod/dokploy/dist ./dist COPY --from=build /prod/dokploy/next.config.mjs ./next.config.mjs COPY --from=build /prod/dokploy/next-i18next.config.js ./next-i18next.config.js +COPY --from=build /prod/dokploy/next-i18next.config.mjs ./next-i18next.config.mjs COPY --from=build /prod/dokploy/public ./public COPY --from=build /prod/dokploy/package.json ./package.json COPY --from=build /prod/dokploy/drizzle ./drizzle diff --git a/apps/dokploy/next-i18next.config.cjs b/apps/dokploy/next-i18next.config.cjs new file mode 100644 index 000000000..5c20bbea8 --- /dev/null +++ b/apps/dokploy/next-i18next.config.cjs @@ -0,0 +1,10 @@ +/** @type {import('next-i18next').UserConfig} */ +module.exports = { + i18n: { + defaultLocale: "en", + locales: ["en", "zh-Hans"], + localeDetection: false, + }, + fallbackLng: "en", + keySeparator: false, +}; diff --git a/apps/dokploy/next-i18next.config.js b/apps/dokploy/next-i18next.config.js index 5c20bbea8..10977f3e5 100644 --- a/apps/dokploy/next-i18next.config.js +++ b/apps/dokploy/next-i18next.config.js @@ -1,10 +1,2 @@ -/** @type {import('next-i18next').UserConfig} */ -module.exports = { - i18n: { - defaultLocale: "en", - locales: ["en", "zh-Hans"], - localeDetection: false, - }, - fallbackLng: "en", - keySeparator: false, -}; +import config from "./next-i18next.config.cjs"; +export default config; From 036313e3c352dbc3b4000b09feb5a3f45e39d201 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 17 Nov 2024 10:45:05 -0600 Subject: [PATCH 4/6] chore: update dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ac8ff7ac7..0c7250d2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ COPY --from=build /prod/dokploy/.next ./.next COPY --from=build /prod/dokploy/dist ./dist COPY --from=build /prod/dokploy/next.config.mjs ./next.config.mjs COPY --from=build /prod/dokploy/next-i18next.config.js ./next-i18next.config.js -COPY --from=build /prod/dokploy/next-i18next.config.mjs ./next-i18next.config.mjs +COPY --from=build /prod/dokploy/next-i18next.config.cjs ./next-i18next.config.cjs COPY --from=build /prod/dokploy/public ./public COPY --from=build /prod/dokploy/package.json ./package.json COPY --from=build /prod/dokploy/drizzle ./drizzle From 56ea356723ac4f837dc5730faf23f563dd264683 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 17 Nov 2024 11:04:15 -0600 Subject: [PATCH 5/6] refactor(dokploy): update i18next build --- Dockerfile | 1 - apps/dokploy/next-i18next.config.js | 2 -- apps/dokploy/pages/dashboard/settings/appearance.tsx | 4 ++-- apps/dokploy/pages/dashboard/settings/profile.tsx | 3 +-- apps/dokploy/pages/dashboard/settings/server.tsx | 3 +-- apps/dokploy/utils/i18n.ts | 9 +++++++++ 6 files changed, 13 insertions(+), 9 deletions(-) delete mode 100644 apps/dokploy/next-i18next.config.js diff --git a/Dockerfile b/Dockerfile index 0c7250d2d..838fbe4f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,6 @@ RUN apt-get update && apt-get install -y curl unzip apache2-utils && rm -rf /var COPY --from=build /prod/dokploy/.next ./.next COPY --from=build /prod/dokploy/dist ./dist COPY --from=build /prod/dokploy/next.config.mjs ./next.config.mjs -COPY --from=build /prod/dokploy/next-i18next.config.js ./next-i18next.config.js COPY --from=build /prod/dokploy/next-i18next.config.cjs ./next-i18next.config.cjs COPY --from=build /prod/dokploy/public ./public COPY --from=build /prod/dokploy/package.json ./package.json diff --git a/apps/dokploy/next-i18next.config.js b/apps/dokploy/next-i18next.config.js deleted file mode 100644 index 10977f3e5..000000000 --- a/apps/dokploy/next-i18next.config.js +++ /dev/null @@ -1,2 +0,0 @@ -import config from "./next-i18next.config.cjs"; -export default config; diff --git a/apps/dokploy/pages/dashboard/settings/appearance.tsx b/apps/dokploy/pages/dashboard/settings/appearance.tsx index f074f2898..209d938c6 100644 --- a/apps/dokploy/pages/dashboard/settings/appearance.tsx +++ b/apps/dokploy/pages/dashboard/settings/appearance.tsx @@ -2,13 +2,13 @@ import { AppearanceForm } from "@/components/dashboard/settings/appearance-form" import { DashboardLayout } from "@/components/layouts/dashboard-layout"; import { SettingsLayout } from "@/components/layouts/settings-layout"; import { appRouter } from "@/server/api/root"; -import { getLocale } from "@/utils/i18n"; +import { getLocale, serverSideTranslations } from "@/utils/i18n"; import { validateRequest } from "@dokploy/server"; import { createServerSideHelpers } from "@trpc/react-query/server"; import type { GetServerSidePropsContext } from "next"; -import { serverSideTranslations } from "next-i18next/serverSideTranslations"; import React, { type ReactElement } from "react"; import superjson from "superjson"; +import nextI18NextConfig from "../../../next-i18next.config.cjs"; const Page = () => { return ( diff --git a/apps/dokploy/pages/dashboard/settings/profile.tsx b/apps/dokploy/pages/dashboard/settings/profile.tsx index 9303354f1..a645a4af3 100644 --- a/apps/dokploy/pages/dashboard/settings/profile.tsx +++ b/apps/dokploy/pages/dashboard/settings/profile.tsx @@ -4,11 +4,10 @@ import { DashboardLayout } from "@/components/layouts/dashboard-layout"; import { SettingsLayout } from "@/components/layouts/settings-layout"; import { appRouter } from "@/server/api/root"; import { api } from "@/utils/api"; -import { getLocale } from "@/utils/i18n"; +import { getLocale, serverSideTranslations } from "@/utils/i18n"; import { validateRequest } from "@dokploy/server"; import { createServerSideHelpers } from "@trpc/react-query/server"; import type { GetServerSidePropsContext } from "next"; -import { serverSideTranslations } from "next-i18next/serverSideTranslations"; import React, { type ReactElement } from "react"; import superjson from "superjson"; diff --git a/apps/dokploy/pages/dashboard/settings/server.tsx b/apps/dokploy/pages/dashboard/settings/server.tsx index c714acd83..c1d3d5480 100644 --- a/apps/dokploy/pages/dashboard/settings/server.tsx +++ b/apps/dokploy/pages/dashboard/settings/server.tsx @@ -3,11 +3,10 @@ import { WebServer } from "@/components/dashboard/settings/web-server"; import { DashboardLayout } from "@/components/layouts/dashboard-layout"; import { SettingsLayout } from "@/components/layouts/settings-layout"; import { appRouter } from "@/server/api/root"; -import { getLocale } from "@/utils/i18n"; +import { getLocale, serverSideTranslations } from "@/utils/i18n"; import { IS_CLOUD, validateRequest } from "@dokploy/server"; import { createServerSideHelpers } from "@trpc/react-query/server"; import type { GetServerSidePropsContext } from "next"; -import { serverSideTranslations } from "next-i18next/serverSideTranslations"; import React, { type ReactElement } from "react"; import superjson from "superjson"; diff --git a/apps/dokploy/utils/i18n.ts b/apps/dokploy/utils/i18n.ts index 0c165c4ef..4790f1a70 100644 --- a/apps/dokploy/utils/i18n.ts +++ b/apps/dokploy/utils/i18n.ts @@ -4,3 +4,12 @@ export function getLocale(cookies: NextApiRequestCookies) { const locale = cookies.DOKPLOY_LOCALE ?? "en"; return locale; } + +// libs/i18n.js +import { serverSideTranslations as originalServerSideTranslations } from "next-i18next/serverSideTranslations"; +import nextI18NextConfig from "../next-i18next.config.cjs"; + +export const serverSideTranslations = ( + locale: string, + namespaces = ["common"], +) => originalServerSideTranslations(locale, namespaces, nextI18NextConfig); From 4e929c12f219a3e41125caf7534dc0229ee54a95 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 17 Nov 2024 11:13:55 -0600 Subject: [PATCH 6/6] chore: add missing next config to dockerfile --- Dockerfile.cloud | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.cloud b/Dockerfile.cloud index 020ea3d69..0f8427d46 100644 --- a/Dockerfile.cloud +++ b/Dockerfile.cloud @@ -44,6 +44,7 @@ RUN apt-get update && apt-get install -y curl unzip apache2-utils && rm -rf /var COPY --from=build /prod/dokploy/.next ./.next COPY --from=build /prod/dokploy/dist ./dist COPY --from=build /prod/dokploy/next.config.mjs ./next.config.mjs +COPY --from=build /prod/dokploy/next-i18next.config.cjs ./next-i18next.config.cjs COPY --from=build /prod/dokploy/public ./public COPY --from=build /prod/dokploy/package.json ./package.json COPY --from=build /prod/dokploy/drizzle ./drizzle