Skip to content

Commit

Permalink
Merge pull request Dokploy#713 from Dokploy/fix/build-i18n
Browse files Browse the repository at this point in the history
refactor(dokploy): add missing next-18next to dockerfile
  • Loading branch information
Siumauricio authored Nov 17, 2024
2 parents 5833838 + 4e929c1 commit f7fa8e7
Show file tree
Hide file tree
Showing 20 changed files with 289 additions and 267 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -116,4 +116,4 @@ workflows:
only:
- main
- canary
- pull/665
- fix/build-i18n
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.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
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.cloud
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/dokploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions apps/dokploy/pages/dashboard/settings/appearance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
3 changes: 1 addition & 2 deletions apps/dokploy/pages/dashboard/settings/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 1 addition & 2 deletions apps/dokploy/pages/dashboard/settings/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion apps/dokploy/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
70 changes: 37 additions & 33 deletions apps/dokploy/templates/activepieces/index.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
import {
type DomainSchema,
type Schema,
type Template,
generateRandomDomain,
type DomainSchema,
type Schema,
type Template,
generateRandomDomain,
} from "../utils";

export function generate(schema: Schema): Template {
const mainDomain = generateRandomDomain(schema);

const apiKey = Array.from({length: 32}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const encryptionKey = Array.from({length: 32}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const jwtSecret = Array.from({length: 32}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const postgresPassword = Array.from({length: 32}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const mainDomain = generateRandomDomain(schema);

const domains: DomainSchema[] = [
{
host: mainDomain,
port: 80,
serviceName: "activepieces",
},
];
const apiKey = Array.from({ length: 32 }, () =>
Math.floor(Math.random() * 16).toString(16),
).join("");
const encryptionKey = Array.from({ length: 32 }, () =>
Math.floor(Math.random() * 16).toString(16),
).join("");
const jwtSecret = Array.from({ length: 32 }, () =>
Math.floor(Math.random() * 16).toString(16),
).join("");
const postgresPassword = Array.from({ length: 32 }, () =>
Math.floor(Math.random() * 16).toString(16),
).join("");

const envs = [
`AP_HOST=${mainDomain}`,
`AP_API_KEY=${apiKey}`,
`AP_ENCRYPTION_KEY=${encryptionKey}`,
`AP_JWT_SECRET=${jwtSecret}`,
`AP_POSTGRES_PASSWORD=${postgresPassword}`,
];
const domains: DomainSchema[] = [
{
host: mainDomain,
port: 80,
serviceName: "activepieces",
},
];

return {
domains,
envs,
};
}
const envs = [
`AP_HOST=${mainDomain}`,
`AP_API_KEY=${apiKey}`,
`AP_ENCRYPTION_KEY=${encryptionKey}`,
`AP_JWT_SECRET=${jwtSecret}`,
`AP_POSTGRES_PASSWORD=${postgresPassword}`,
];

return {
domains,
envs,
};
}
79 changes: 40 additions & 39 deletions apps/dokploy/templates/discord-tickets/index.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
import {
type DomainSchema,
type Schema,
type Template,
generatePassword,
generateRandomDomain,
type DomainSchema,
type Schema,
type Template,
generatePassword,
generateRandomDomain,
} from "../utils";

export function generate(schema: Schema): Template {
const mainDomain = generateRandomDomain(schema);
const mysqlPassword = generatePassword();
const mysqlRootPassword = generatePassword();
const mysqlUser = "tickets";
const mysqlDatabase = "tickets";

// Generate encryption key in the format they use
const encryptionKey = Array.from({length: 48}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const mainDomain = generateRandomDomain(schema);
const mysqlPassword = generatePassword();
const mysqlRootPassword = generatePassword();
const mysqlUser = "tickets";
const mysqlDatabase = "tickets";

const domains: DomainSchema[] = [
{
host: mainDomain,
port: 8169,
serviceName: "bot",
},
];
// Generate encryption key in the format they use
const encryptionKey = Array.from({ length: 48 }, () =>
Math.floor(Math.random() * 16).toString(16),
).join("");

const envs = [
`TICKETS_HOST=${mainDomain}`,
`MYSQL_DATABASE=${mysqlDatabase}`,
`MYSQL_PASSWORD=${mysqlPassword}`,
`MYSQL_ROOT_PASSWORD=${mysqlRootPassword}`,
`MYSQL_USER=${mysqlUser}`,
`ENCRYPTION_KEY=${encryptionKey}`,
// These need to be set by the user through the UI
`# Follow the guide at: https://discordtickets.app/self-hosting/installation/docker/#creating-the-discord-application`,
`DISCORD_SECRET=`,
`DISCORD_TOKEN=`,
`SUPER_USERS=YOUR_DISCORD_USER_ID`, // Default super user
];
const domains: DomainSchema[] = [
{
host: mainDomain,
port: 8169,
serviceName: "bot",
},
];

return {
domains,
envs,
};
}
const envs = [
`TICKETS_HOST=${mainDomain}`,
`MYSQL_DATABASE=${mysqlDatabase}`,
`MYSQL_PASSWORD=${mysqlPassword}`,
`MYSQL_ROOT_PASSWORD=${mysqlRootPassword}`,
`MYSQL_USER=${mysqlUser}`,
`ENCRYPTION_KEY=${encryptionKey}`,
// These need to be set by the user through the UI
"# Follow the guide at: https://discordtickets.app/self-hosting/installation/docker/#creating-the-discord-application",
"DISCORD_SECRET=",
"DISCORD_TOKEN=",
"SUPER_USERS=YOUR_DISCORD_USER_ID", // Default super user
];

return {
domains,
envs,
};
}
54 changes: 27 additions & 27 deletions apps/dokploy/templates/invoiceshelf/index.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import {
type DomainSchema,
type Schema,
type Template,
generatePassword,
generateRandomDomain,
type DomainSchema,
type Schema,
type Template,
generatePassword,
generateRandomDomain,
} from "../utils";

export function generate(schema: Schema): Template {
const mainDomain = generateRandomDomain(schema);
const dbPassword = generatePassword();
const dbUsername = "invoiceshelf";
const dbDatabase = "invoiceshelf";
const mainDomain = generateRandomDomain(schema);
const dbPassword = generatePassword();
const dbUsername = "invoiceshelf";
const dbDatabase = "invoiceshelf";

const domains: DomainSchema[] = [
{
host: mainDomain,
port: 80,
serviceName: "invoiceshelf",
},
];
const domains: DomainSchema[] = [
{
host: mainDomain,
port: 80,
serviceName: "invoiceshelf",
},
];

const envs = [
`INVOICESHELF_HOST=${mainDomain}`,
`DB_PASSWORD=${dbPassword}`,
`DB_USERNAME=${dbUsername}`,
`DB_DATABASE=${dbDatabase}`,
];
const envs = [
`INVOICESHELF_HOST=${mainDomain}`,
`DB_PASSWORD=${dbPassword}`,
`DB_USERNAME=${dbUsername}`,
`DB_DATABASE=${dbDatabase}`,
];

return {
domains,
envs,
};
}
return {
domains,
envs,
};
}
Loading

0 comments on commit f7fa8e7

Please sign in to comment.