diff --git a/app/.github/workflows/playwright.yml b/apps/app/.github/workflows/playwright.yml similarity index 100% rename from app/.github/workflows/playwright.yml rename to apps/app/.github/workflows/playwright.yml diff --git a/app/.gitignore b/apps/app/.gitignore similarity index 100% rename from app/.gitignore rename to apps/app/.gitignore diff --git a/app/.npmrc b/apps/app/.npmrc similarity index 100% rename from app/.npmrc rename to apps/app/.npmrc diff --git a/app/.prettierignore b/apps/app/.prettierignore similarity index 100% rename from app/.prettierignore rename to apps/app/.prettierignore diff --git a/app/.prettierrc b/apps/app/.prettierrc similarity index 100% rename from app/.prettierrc rename to apps/app/.prettierrc diff --git a/app/.storybook/main.ts b/apps/app/.storybook/main.ts similarity index 100% rename from app/.storybook/main.ts rename to apps/app/.storybook/main.ts diff --git a/app/.storybook/preview.ts b/apps/app/.storybook/preview.ts similarity index 100% rename from app/.storybook/preview.ts rename to apps/app/.storybook/preview.ts diff --git a/app/.vscode/settings.json b/apps/app/.vscode/settings.json similarity index 100% rename from app/.vscode/settings.json rename to apps/app/.vscode/settings.json diff --git a/app/README.md b/apps/app/README.md similarity index 100% rename from app/README.md rename to apps/app/README.md diff --git a/app/e2e/example.spec.ts b/apps/app/e2e/example.spec.ts similarity index 100% rename from app/e2e/example.spec.ts rename to apps/app/e2e/example.spec.ts diff --git a/app/env.example b/apps/app/env.example similarity index 100% rename from app/env.example rename to apps/app/env.example diff --git a/app/eslint.config.js b/apps/app/eslint.config.js similarity index 100% rename from app/eslint.config.js rename to apps/app/eslint.config.js diff --git a/app/messages/en.json b/apps/app/messages/en.json similarity index 100% rename from app/messages/en.json rename to apps/app/messages/en.json diff --git a/app/messages/hu.json b/apps/app/messages/hu.json similarity index 100% rename from app/messages/hu.json rename to apps/app/messages/hu.json diff --git a/app/package-lock.json b/apps/app/package-lock.json similarity index 100% rename from app/package-lock.json rename to apps/app/package-lock.json diff --git a/app/package.json b/apps/app/package.json similarity index 93% rename from app/package.json rename to apps/app/package.json index 643cd96..6aaf057 100644 --- a/app/package.json +++ b/apps/app/package.json @@ -16,7 +16,8 @@ "test": "npm run test:unit -- --run", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", - "deploy": "npm run build && wrangler pages deploy", + "deploy-stage": "npm run build && wrangler pages deploy --env staging", + "deploy-prod": "npm run build && wrangler pages deploy --env production", "cf-typegen": "wrangler types && move worker-configuration.d.ts src/" }, "devDependencies": { diff --git a/app/playwright.config.ts b/apps/app/playwright.config.ts similarity index 100% rename from app/playwright.config.ts rename to apps/app/playwright.config.ts diff --git a/app/postcss.config.js b/apps/app/postcss.config.js similarity index 100% rename from app/postcss.config.js rename to apps/app/postcss.config.js diff --git a/app/project.inlang/.gitignore b/apps/app/project.inlang/.gitignore similarity index 100% rename from app/project.inlang/.gitignore rename to apps/app/project.inlang/.gitignore diff --git a/app/project.inlang/project_id b/apps/app/project.inlang/project_id similarity index 100% rename from app/project.inlang/project_id rename to apps/app/project.inlang/project_id diff --git a/app/project.inlang/settings.json b/apps/app/project.inlang/settings.json similarity index 100% rename from app/project.inlang/settings.json rename to apps/app/project.inlang/settings.json diff --git a/app/src/app.css b/apps/app/src/app.css similarity index 100% rename from app/src/app.css rename to apps/app/src/app.css diff --git a/app/src/app.d.ts b/apps/app/src/app.d.ts similarity index 100% rename from app/src/app.d.ts rename to apps/app/src/app.d.ts diff --git a/app/src/app.html b/apps/app/src/app.html similarity index 100% rename from app/src/app.html rename to apps/app/src/app.html diff --git a/app/src/hooks.server.ts b/apps/app/src/hooks.server.ts similarity index 100% rename from app/src/hooks.server.ts rename to apps/app/src/hooks.server.ts diff --git a/app/src/hooks.ts b/apps/app/src/hooks.ts similarity index 100% rename from app/src/hooks.ts rename to apps/app/src/hooks.ts diff --git a/apps/app/src/lib/cookiesAlert.svelte b/apps/app/src/lib/cookiesAlert.svelte new file mode 100644 index 0000000..14677e3 --- /dev/null +++ b/apps/app/src/lib/cookiesAlert.svelte @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/app/src/lib/i18n.ts b/apps/app/src/lib/i18n.ts similarity index 100% rename from app/src/lib/i18n.ts rename to apps/app/src/lib/i18n.ts diff --git a/app/src/lib/index.ts b/apps/app/src/lib/index.ts similarity index 100% rename from app/src/lib/index.ts rename to apps/app/src/lib/index.ts diff --git a/app/src/lib/model.ts b/apps/app/src/lib/model.ts similarity index 100% rename from app/src/lib/model.ts rename to apps/app/src/lib/model.ts diff --git a/app/src/lib/server/db.ts b/apps/app/src/lib/server/db.ts similarity index 100% rename from app/src/lib/server/db.ts rename to apps/app/src/lib/server/db.ts diff --git a/app/src/lib/server/oauth.ts b/apps/app/src/lib/server/oauth.ts similarity index 100% rename from app/src/lib/server/oauth.ts rename to apps/app/src/lib/server/oauth.ts diff --git a/app/src/lib/server/queries/create_directed_relationship.cypher b/apps/app/src/lib/server/queries/create_directed_relationship.cypher similarity index 82% rename from app/src/lib/server/queries/create_directed_relationship.cypher rename to apps/app/src/lib/server/queries/create_directed_relationship.cypher index fdd8a56..4fb4939 100644 --- a/app/src/lib/server/queries/create_directed_relationship.cypher +++ b/apps/app/src/lib/server/queries/create_directed_relationship.cypher @@ -1,4 +1,4 @@ MATCH (a:Person), (b:Person) WHERE id(a) = $id1 AND id(b) = $id2 CREATE (a)-[r:Relationship $Relationship]->(b) -RETURN r as relationship \ No newline at end of file +RETURN r AS relationship \ No newline at end of file diff --git a/app/src/lib/server/queries/create_person.cypher b/apps/app/src/lib/server/queries/create_person.cypher similarity index 100% rename from app/src/lib/server/queries/create_person.cypher rename to apps/app/src/lib/server/queries/create_person.cypher diff --git a/app/src/lib/server/queries/create_relationship.cypher b/apps/app/src/lib/server/queries/create_relationship.cypher similarity index 100% rename from app/src/lib/server/queries/create_relationship.cypher rename to apps/app/src/lib/server/queries/create_relationship.cypher diff --git a/app/src/lib/server/queries/create_two_directed_relationships.cypher b/apps/app/src/lib/server/queries/create_two_directed_relationships.cypher similarity index 100% rename from app/src/lib/server/queries/create_two_directed_relationships.cypher rename to apps/app/src/lib/server/queries/create_two_directed_relationships.cypher diff --git a/app/src/lib/server/queries/get_family_tree_by_id.cypher b/apps/app/src/lib/server/queries/get_family_tree_by_id.cypher similarity index 100% rename from app/src/lib/server/queries/get_family_tree_by_id.cypher rename to apps/app/src/lib/server/queries/get_family_tree_by_id.cypher diff --git a/app/src/lib/server/queries/get_people_by_properties.cypher b/apps/app/src/lib/server/queries/get_people_by_properties.cypher similarity index 100% rename from app/src/lib/server/queries/get_people_by_properties.cypher rename to apps/app/src/lib/server/queries/get_people_by_properties.cypher diff --git a/app/src/lib/server/queries/get_person_by_google_id.cypher b/apps/app/src/lib/server/queries/get_person_by_google_id.cypher similarity index 100% rename from app/src/lib/server/queries/get_person_by_google_id.cypher rename to apps/app/src/lib/server/queries/get_person_by_google_id.cypher diff --git a/app/src/lib/server/queries/get_person_by_id.cypher b/apps/app/src/lib/server/queries/get_person_by_id.cypher similarity index 100% rename from app/src/lib/server/queries/get_person_by_id.cypher rename to apps/app/src/lib/server/queries/get_person_by_id.cypher diff --git a/app/src/lib/server/queries/get_relationship.cypher b/apps/app/src/lib/server/queries/get_relationship.cypher similarity index 100% rename from app/src/lib/server/queries/get_relationship.cypher rename to apps/app/src/lib/server/queries/get_relationship.cypher diff --git a/app/src/lib/server/queries/hard_delete_person_by_id.cypher b/apps/app/src/lib/server/queries/hard_delete_person_by_id.cypher similarity index 100% rename from app/src/lib/server/queries/hard_delete_person_by_id.cypher rename to apps/app/src/lib/server/queries/hard_delete_person_by_id.cypher diff --git a/app/src/lib/server/queries/schema.cypher b/apps/app/src/lib/server/queries/schema.cypher similarity index 100% rename from app/src/lib/server/queries/schema.cypher rename to apps/app/src/lib/server/queries/schema.cypher diff --git a/app/src/lib/server/queries/soft_delete_person_by_id.cypher b/apps/app/src/lib/server/queries/soft_delete_person_by_id.cypher similarity index 100% rename from app/src/lib/server/queries/soft_delete_person_by_id.cypher rename to apps/app/src/lib/server/queries/soft_delete_person_by_id.cypher diff --git a/app/src/lib/server/queries/update_person.cypher b/apps/app/src/lib/server/queries/update_person.cypher similarity index 100% rename from app/src/lib/server/queries/update_person.cypher rename to apps/app/src/lib/server/queries/update_person.cypher diff --git a/app/src/lib/server/session.ts b/apps/app/src/lib/server/session.ts similarity index 100% rename from app/src/lib/server/session.ts rename to apps/app/src/lib/server/session.ts diff --git a/app/src/lib/server/user.ts b/apps/app/src/lib/server/user.ts similarity index 100% rename from app/src/lib/server/user.ts rename to apps/app/src/lib/server/user.ts diff --git a/app/src/lib/switchToLanguage.test.ts b/apps/app/src/lib/switchToLanguage.test.ts similarity index 100% rename from app/src/lib/switchToLanguage.test.ts rename to apps/app/src/lib/switchToLanguage.test.ts diff --git a/app/src/lib/switchToLanguage.ts b/apps/app/src/lib/switchToLanguage.ts similarity index 100% rename from app/src/lib/switchToLanguage.ts rename to apps/app/src/lib/switchToLanguage.ts diff --git a/app/src/lib/theme-select.svelte b/apps/app/src/lib/theme-select.svelte similarity index 100% rename from app/src/lib/theme-select.svelte rename to apps/app/src/lib/theme-select.svelte diff --git a/app/src/lib/themes.ts b/apps/app/src/lib/themes.ts similarity index 100% rename from app/src/lib/themes.ts rename to apps/app/src/lib/themes.ts diff --git a/app/src/routes/+layout.svelte b/apps/app/src/routes/+layout.svelte similarity index 100% rename from app/src/routes/+layout.svelte rename to apps/app/src/routes/+layout.svelte diff --git a/app/src/routes/+page.server.ts b/apps/app/src/routes/+page.server.ts similarity index 100% rename from app/src/routes/+page.server.ts rename to apps/app/src/routes/+page.server.ts diff --git a/app/src/routes/+page.svelte b/apps/app/src/routes/+page.svelte similarity index 100% rename from app/src/routes/+page.svelte rename to apps/app/src/routes/+page.svelte diff --git a/app/src/routes/login/+page.server.ts b/apps/app/src/routes/login/+page.server.ts similarity index 100% rename from app/src/routes/login/+page.server.ts rename to apps/app/src/routes/login/+page.server.ts diff --git a/app/src/routes/login/+page.svelte b/apps/app/src/routes/login/+page.svelte similarity index 100% rename from app/src/routes/login/+page.svelte rename to apps/app/src/routes/login/+page.svelte diff --git a/app/src/routes/login/google/+server.ts b/apps/app/src/routes/login/google/+server.ts similarity index 100% rename from app/src/routes/login/google/+server.ts rename to apps/app/src/routes/login/google/+server.ts diff --git a/app/src/routes/login/google/callback/+page.server.ts b/apps/app/src/routes/login/google/callback/+page.server.ts similarity index 83% rename from app/src/routes/login/google/callback/+page.server.ts rename to apps/app/src/routes/login/google/callback/+page.server.ts index 67aedd9..2ca5eec 100644 --- a/app/src/routes/login/google/callback/+page.server.ts +++ b/apps/app/src/routes/login/google/callback/+page.server.ts @@ -2,6 +2,7 @@ import { google } from "$lib/server/oauth"; import { ObjectParser } from "@pilcrowjs/object-parser"; import { createUser, getUserFromGoogleId } from "$lib/server/user"; import { DB } from "$lib/server/db"; +import { browser } from '$app/environment'; import { Date as neoDate } from 'neo4j-driver'; import { createSession, generateSessionToken, setSessionTokenCookie } from "$lib/server/session"; import { decodeIdToken } from "arctic"; @@ -15,6 +16,11 @@ import { error, redirect, fail } from "@sveltejs/kit"; const StorageLimit = 200 * 1024 * 1024; export const load: PageServerLoad = async (event: RequestEvent) => { + //prevent loading in developer mode, due to some issues with universal load, even if this is a server only ts,it will still run on client in dev mode idk + if (browser) { + return {} + } + const storedState = event.cookies.get("google_oauth_state") ?? null; const codeVerifier = event.cookies.get("google_code_verifier") ?? null; const code = event.url.searchParams.get("code"); @@ -34,9 +40,9 @@ export const load: PageServerLoad = async (event: RequestEvent) => { return error(400, { message: "Failed to validate authorization code with " + e }); } -// if (!event.platform || !event.platform.env || !event.platform.env.GH_SESSIONS) { -// return error(500, { message: "Server configuration error. GH_SESSIONS KeyValue store missing" }); -// } + // if (!event.platform || !event.platform.env || !event.platform.env.GH_SESSIONS) { + // return error(500, { message: "Server configuration error. GH_SESSIONS KeyValue store missing" }); + // } const claims = decodeIdToken(tokens.idToken()); const claimsParser = new ObjectParser(claims); @@ -53,8 +59,8 @@ export const load: PageServerLoad = async (event: RequestEvent) => { let eUser = existingUser.records.pop(); if (eUser !== null && eUser?.get('elementId') !== undefined) { const sessionToken = generateSessionToken(); -// const session = await createSession(sessionToken, eUser.get('elementId'), event.platform.env.GH_SESSIONS); -// setSessionTokenCookie(event, sessionToken, session.expiresAt); + // const session = await createSession(sessionToken, eUser.get('elementId'), event.platform.env.GH_SESSIONS); + // setSessionTokenCookie(event, sessionToken, session.expiresAt); return redirect(302, "/"); } @@ -80,9 +86,9 @@ export const actions: Actions = { async function register(event: RequestEvent) { const data = await event.request.formData(); -// if (!event.platform || !event.platform.env || !event.platform.env.GH_SESSIONS) { -// return fail(500, { message: "Server configuration error. GH_SESSIONS KeyValue store missing" }); -// } + // if (!event.platform || !event.platform.env || !event.platform.env.GH_SESSIONS) { + // return fail(500, { message: "Server configuration error. GH_SESSIONS KeyValue store missing" }); + // } const google_id = data.get('google_id') if (google_id === null) { return fail(400, { @@ -170,8 +176,8 @@ async function register(event: RequestEvent) { dbSession.close(); const sessionToken = generateSessionToken(); -// const session = await createSession(sessionToken, user.get('elementId'), event.platform.env.GH_SESSIONS); -// setSessionTokenCookie(event, sessionToken, session.expiresAt); + // const session = await createSession(sessionToken, user.get('elementId'), event.platform.env.GH_SESSIONS); + // setSessionTokenCookie(event, sessionToken, session.expiresAt); return redirect(302, "/"); } \ No newline at end of file diff --git a/app/src/routes/login/google/callback/+page.svelte b/apps/app/src/routes/login/google/callback/+page.svelte similarity index 100% rename from app/src/routes/login/google/callback/+page.svelte rename to apps/app/src/routes/login/google/callback/+page.svelte diff --git a/app/src/routes/login/highresolution_icon_no_background_croped.png b/apps/app/src/routes/login/highresolution_icon_no_background_croped.png similarity index 100% rename from app/src/routes/login/highresolution_icon_no_background_croped.png rename to apps/app/src/routes/login/highresolution_icon_no_background_croped.png diff --git a/app/src/routes/page.stories.svelte b/apps/app/src/routes/page.stories.svelte similarity index 100% rename from app/src/routes/page.stories.svelte rename to apps/app/src/routes/page.stories.svelte diff --git a/app/src/stories/Button.stories.svelte b/apps/app/src/stories/Button.stories.svelte similarity index 100% rename from app/src/stories/Button.stories.svelte rename to apps/app/src/stories/Button.stories.svelte diff --git a/app/src/stories/Button.svelte b/apps/app/src/stories/Button.svelte similarity index 100% rename from app/src/stories/Button.svelte rename to apps/app/src/stories/Button.svelte diff --git a/app/src/stories/Configure.mdx b/apps/app/src/stories/Configure.mdx similarity index 100% rename from app/src/stories/Configure.mdx rename to apps/app/src/stories/Configure.mdx diff --git a/app/src/stories/Header.stories.svelte b/apps/app/src/stories/Header.stories.svelte similarity index 100% rename from app/src/stories/Header.stories.svelte rename to apps/app/src/stories/Header.stories.svelte diff --git a/app/src/stories/Header.svelte b/apps/app/src/stories/Header.svelte similarity index 100% rename from app/src/stories/Header.svelte rename to apps/app/src/stories/Header.svelte diff --git a/app/src/stories/Page.stories.svelte b/apps/app/src/stories/Page.stories.svelte similarity index 100% rename from app/src/stories/Page.stories.svelte rename to apps/app/src/stories/Page.stories.svelte diff --git a/app/src/stories/Page.svelte b/apps/app/src/stories/Page.svelte similarity index 100% rename from app/src/stories/Page.svelte rename to apps/app/src/stories/Page.svelte diff --git a/app/src/stories/assets/accessibility.png b/apps/app/src/stories/assets/accessibility.png similarity index 100% rename from app/src/stories/assets/accessibility.png rename to apps/app/src/stories/assets/accessibility.png diff --git a/app/src/stories/assets/accessibility.svg b/apps/app/src/stories/assets/accessibility.svg similarity index 100% rename from app/src/stories/assets/accessibility.svg rename to apps/app/src/stories/assets/accessibility.svg diff --git a/app/src/stories/assets/addon-library.png b/apps/app/src/stories/assets/addon-library.png similarity index 100% rename from app/src/stories/assets/addon-library.png rename to apps/app/src/stories/assets/addon-library.png diff --git a/app/src/stories/assets/assets.png b/apps/app/src/stories/assets/assets.png similarity index 100% rename from app/src/stories/assets/assets.png rename to apps/app/src/stories/assets/assets.png diff --git a/app/src/stories/assets/avif-test-image.avif b/apps/app/src/stories/assets/avif-test-image.avif similarity index 100% rename from app/src/stories/assets/avif-test-image.avif rename to apps/app/src/stories/assets/avif-test-image.avif diff --git a/app/src/stories/assets/context.png b/apps/app/src/stories/assets/context.png similarity index 100% rename from app/src/stories/assets/context.png rename to apps/app/src/stories/assets/context.png diff --git a/app/src/stories/assets/discord.svg b/apps/app/src/stories/assets/discord.svg similarity index 100% rename from app/src/stories/assets/discord.svg rename to apps/app/src/stories/assets/discord.svg diff --git a/app/src/stories/assets/docs.png b/apps/app/src/stories/assets/docs.png similarity index 100% rename from app/src/stories/assets/docs.png rename to apps/app/src/stories/assets/docs.png diff --git a/app/src/stories/assets/figma-plugin.png b/apps/app/src/stories/assets/figma-plugin.png similarity index 100% rename from app/src/stories/assets/figma-plugin.png rename to apps/app/src/stories/assets/figma-plugin.png diff --git a/app/src/stories/assets/github.svg b/apps/app/src/stories/assets/github.svg similarity index 100% rename from app/src/stories/assets/github.svg rename to apps/app/src/stories/assets/github.svg diff --git a/app/src/stories/assets/share.png b/apps/app/src/stories/assets/share.png similarity index 100% rename from app/src/stories/assets/share.png rename to apps/app/src/stories/assets/share.png diff --git a/app/src/stories/assets/styling.png b/apps/app/src/stories/assets/styling.png similarity index 100% rename from app/src/stories/assets/styling.png rename to apps/app/src/stories/assets/styling.png diff --git a/app/src/stories/assets/testing.png b/apps/app/src/stories/assets/testing.png similarity index 100% rename from app/src/stories/assets/testing.png rename to apps/app/src/stories/assets/testing.png diff --git a/app/src/stories/assets/theming.png b/apps/app/src/stories/assets/theming.png similarity index 100% rename from app/src/stories/assets/theming.png rename to apps/app/src/stories/assets/theming.png diff --git a/app/src/stories/assets/tutorials.svg b/apps/app/src/stories/assets/tutorials.svg similarity index 100% rename from app/src/stories/assets/tutorials.svg rename to apps/app/src/stories/assets/tutorials.svg diff --git a/app/src/stories/assets/youtube.svg b/apps/app/src/stories/assets/youtube.svg similarity index 100% rename from app/src/stories/assets/youtube.svg rename to apps/app/src/stories/assets/youtube.svg diff --git a/app/src/stories/button.css b/apps/app/src/stories/button.css similarity index 100% rename from app/src/stories/button.css rename to apps/app/src/stories/button.css diff --git a/app/src/stories/header.css b/apps/app/src/stories/header.css similarity index 100% rename from app/src/stories/header.css rename to apps/app/src/stories/header.css diff --git a/app/src/stories/page.css b/apps/app/src/stories/page.css similarity index 100% rename from app/src/stories/page.css rename to apps/app/src/stories/page.css diff --git a/app/static/favicon.ico b/apps/app/static/favicon.ico similarity index 100% rename from app/static/favicon.ico rename to apps/app/static/favicon.ico diff --git a/app/static/favicon.png b/apps/app/static/favicon.png similarity index 100% rename from app/static/favicon.png rename to apps/app/static/favicon.png diff --git a/app/static/favicon_square.png b/apps/app/static/favicon_square.png similarity index 100% rename from app/static/favicon_square.png rename to apps/app/static/favicon_square.png diff --git a/app/svelte.config.js b/apps/app/svelte.config.js similarity index 100% rename from app/svelte.config.js rename to apps/app/svelte.config.js diff --git a/app/tests-examples/demo-todo-app.spec.ts b/apps/app/tests-examples/demo-todo-app.spec.ts similarity index 100% rename from app/tests-examples/demo-todo-app.spec.ts rename to apps/app/tests-examples/demo-todo-app.spec.ts diff --git a/app/tsconfig.json b/apps/app/tsconfig.json similarity index 100% rename from app/tsconfig.json rename to apps/app/tsconfig.json diff --git a/app/vite.config.ts b/apps/app/vite.config.ts similarity index 100% rename from app/vite.config.ts rename to apps/app/vite.config.ts diff --git a/app/wrangler.jsonc b/apps/app/wrangler.jsonc similarity index 94% rename from app/wrangler.jsonc rename to apps/app/wrangler.jsonc index 46f8c7b..121fb3b 100644 --- a/app/wrangler.jsonc +++ b/apps/app/wrangler.jsonc @@ -26,6 +26,16 @@ * databases, object storage, AI inference, real-time communication and more. * https://developers.cloudflare.com/workers/runtime-apis/bindings/ */ + "kv_namespaces": [ + { + "binding": "GH_SESSIONS" + } + ], + "r2_buckets": [ + { + "binding": "GH_MEDIA" + } + ], /** * Environment Variables * https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables diff --git a/.golangci.yml b/apps/db-handler/.golangci.yml similarity index 91% rename from .golangci.yml rename to apps/db-handler/.golangci.yml index 8e911f9..3d78eb9 100644 --- a/.golangci.yml +++ b/apps/db-handler/.golangci.yml @@ -37,20 +37,6 @@ linters-settings: rewrite-rules: - pattern: 'interface{}' replacement: 'any' - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN govet: settings: printf: diff --git a/cmd/backend/dockerfile b/apps/db-handler/dockerfile similarity index 100% rename from cmd/backend/dockerfile rename to apps/db-handler/dockerfile diff --git a/go.mod b/apps/db-handler/go.mod similarity index 96% rename from go.mod rename to apps/db-handler/go.mod index e927816..89d6313 100644 --- a/go.mod +++ b/apps/db-handler/go.mod @@ -1,4 +1,4 @@ -module github.com/vcscsvcscs/GenerationsHeritage +module github.com/vcscsvcscs/GenerationsHeritage/apps/db-handler go 1.23 @@ -7,7 +7,6 @@ require ( github.com/gin-gonic/gin v1.10.0 github.com/google/uuid v1.6.0 github.com/neo4j/neo4j-go-driver/v5 v5.27.0 - github.com/zitadel/zitadel-go/v3 v3.3.2 golang.org/x/net v0.33.0 ) diff --git a/cmd/backend/handlers/createPerson.go b/apps/db-handler/internal/api/createPerson.go similarity index 100% rename from cmd/backend/handlers/createPerson.go rename to apps/db-handler/internal/api/createPerson.go diff --git a/cmd/backend/handlers/createRelationship.go b/apps/db-handler/internal/api/createRelationship.go similarity index 100% rename from cmd/backend/handlers/createRelationship.go rename to apps/db-handler/internal/api/createRelationship.go diff --git a/cmd/backend/handlers/create_relationship_and_person.go b/apps/db-handler/internal/api/create_relationship_and_person.go similarity index 100% rename from cmd/backend/handlers/create_relationship_and_person.go rename to apps/db-handler/internal/api/create_relationship_and_person.go diff --git a/cmd/backend/handlers/deletePerson.go b/apps/db-handler/internal/api/deletePerson.go similarity index 100% rename from cmd/backend/handlers/deletePerson.go rename to apps/db-handler/internal/api/deletePerson.go diff --git a/cmd/backend/handlers/deleteRelationship.go b/apps/db-handler/internal/api/deleteRelationship.go similarity index 100% rename from cmd/backend/handlers/deleteRelationship.go rename to apps/db-handler/internal/api/deleteRelationship.go diff --git a/apps/db-handler/internal/api/generate.go b/apps/db-handler/internal/api/generate.go new file mode 100644 index 0000000..66bc2f4 --- /dev/null +++ b/apps/db-handler/internal/api/generate.go @@ -0,0 +1,3 @@ +package api + +//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen -config cfg.yaml ../../../../openapi.json diff --git a/apps/db-handler/internal/api/oapi-codegen-cfg.yaml b/apps/db-handler/internal/api/oapi-codegen-cfg.yaml new file mode 100644 index 0000000..2627245 --- /dev/null +++ b/apps/db-handler/internal/api/oapi-codegen-cfg.yaml @@ -0,0 +1,6 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/oapi-codegen/oapi-codegen/HEAD/configuration-schema.json +package: api +output: api.gen.go +generate: + models: true + gin-server: true \ No newline at end of file diff --git a/cmd/backend/handlers/updatePerson.go b/apps/db-handler/internal/api/updatePerson.go similarity index 100% rename from cmd/backend/handlers/updatePerson.go rename to apps/db-handler/internal/api/updatePerson.go diff --git a/cmd/backend/handlers/verifyRelationship.go b/apps/db-handler/internal/api/verifyRelationship.go similarity index 100% rename from cmd/backend/handlers/verifyRelationship.go rename to apps/db-handler/internal/api/verifyRelationship.go diff --git a/cmd/backend/handlers/viewFamilyTree.go b/apps/db-handler/internal/api/viewFamilyTree.go similarity index 100% rename from cmd/backend/handlers/viewFamilyTree.go rename to apps/db-handler/internal/api/viewFamilyTree.go diff --git a/cmd/backend/handlers/viewPerson.go b/apps/db-handler/internal/api/viewPerson.go similarity index 100% rename from cmd/backend/handlers/viewPerson.go rename to apps/db-handler/internal/api/viewPerson.go diff --git a/cmd/backend/main.go b/apps/db-handler/main.go similarity index 100% rename from cmd/backend/main.go rename to apps/db-handler/main.go diff --git a/pkg/fileExists.go b/apps/db-handler/pkg/fileExists.go similarity index 100% rename from pkg/fileExists.go rename to apps/db-handler/pkg/fileExists.go diff --git a/pkg/fileExists_test.go b/apps/db-handler/pkg/fileExists_test.go similarity index 100% rename from pkg/fileExists_test.go rename to apps/db-handler/pkg/fileExists_test.go diff --git a/pkg/gin/healthcheck/health_check.go b/apps/db-handler/pkg/gin/healthcheck/health_check.go similarity index 100% rename from pkg/gin/healthcheck/health_check.go rename to apps/db-handler/pkg/gin/healthcheck/health_check.go diff --git a/pkg/gin/healthcheck/health_check_test.go b/apps/db-handler/pkg/gin/healthcheck/health_check_test.go similarity index 100% rename from pkg/gin/healthcheck/health_check_test.go rename to apps/db-handler/pkg/gin/healthcheck/health_check_test.go diff --git a/pkg/memgraph/create_person.go b/apps/db-handler/pkg/memgraph/create_person.go similarity index 100% rename from pkg/memgraph/create_person.go rename to apps/db-handler/pkg/memgraph/create_person.go diff --git a/pkg/memgraph/create_relationship.go b/apps/db-handler/pkg/memgraph/create_relationship.go similarity index 100% rename from pkg/memgraph/create_relationship.go rename to apps/db-handler/pkg/memgraph/create_relationship.go diff --git a/pkg/memgraph/create_relationship_and_person.go b/apps/db-handler/pkg/memgraph/create_relationship_and_person.go similarity index 100% rename from pkg/memgraph/create_relationship_and_person.go rename to apps/db-handler/pkg/memgraph/create_relationship_and_person.go diff --git a/pkg/memgraph/create_schema.go b/apps/db-handler/pkg/memgraph/create_schema.go similarity index 100% rename from pkg/memgraph/create_schema.go rename to apps/db-handler/pkg/memgraph/create_schema.go diff --git a/pkg/memgraph/cypher_verify_string.go b/apps/db-handler/pkg/memgraph/cypher_verify_string.go similarity index 100% rename from pkg/memgraph/cypher_verify_string.go rename to apps/db-handler/pkg/memgraph/cypher_verify_string.go diff --git a/pkg/memgraph/delete_person.go b/apps/db-handler/pkg/memgraph/delete_person.go similarity index 100% rename from pkg/memgraph/delete_person.go rename to apps/db-handler/pkg/memgraph/delete_person.go diff --git a/pkg/memgraph/delete_relationship.go b/apps/db-handler/pkg/memgraph/delete_relationship.go similarity index 100% rename from pkg/memgraph/delete_relationship.go rename to apps/db-handler/pkg/memgraph/delete_relationship.go diff --git a/pkg/memgraph/init_database.go b/apps/db-handler/pkg/memgraph/init_database.go similarity index 100% rename from pkg/memgraph/init_database.go rename to apps/db-handler/pkg/memgraph/init_database.go diff --git a/pkg/memgraph/model.go b/apps/db-handler/pkg/memgraph/model.go similarity index 100% rename from pkg/memgraph/model.go rename to apps/db-handler/pkg/memgraph/model.go diff --git a/pkg/memgraph/model_test.go b/apps/db-handler/pkg/memgraph/model_test.go similarity index 100% rename from pkg/memgraph/model_test.go rename to apps/db-handler/pkg/memgraph/model_test.go diff --git a/pkg/memgraph/update_person.go b/apps/db-handler/pkg/memgraph/update_person.go similarity index 100% rename from pkg/memgraph/update_person.go rename to apps/db-handler/pkg/memgraph/update_person.go diff --git a/pkg/memgraph/verify_relationship.go b/apps/db-handler/pkg/memgraph/verify_relationship.go similarity index 100% rename from pkg/memgraph/verify_relationship.go rename to apps/db-handler/pkg/memgraph/verify_relationship.go diff --git a/pkg/setup_https_server.go b/apps/db-handler/pkg/setup_https_server.go similarity index 100% rename from pkg/setup_https_server.go rename to apps/db-handler/pkg/setup_https_server.go diff --git a/pkg/setup_logger.go b/apps/db-handler/pkg/setup_logger.go similarity index 100% rename from pkg/setup_logger.go rename to apps/db-handler/pkg/setup_logger.go diff --git a/cmd/auth/auth.go b/cmd/auth/auth.go deleted file mode 100644 index 5e44d7b..0000000 --- a/cmd/auth/auth.go +++ /dev/null @@ -1,23 +0,0 @@ -package main - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/zitadel/zitadel-go/v3/pkg/authorization/oauth" - "github.com/zitadel/zitadel-go/v3/pkg/http/middleware" -) - -func auth(mw *middleware.Interceptor[*oauth.IntrospectionContext]) gin.HandlerFunc { - return func(c *gin.Context) { - mw.RequireAuthorization()(http.HandlerFunc(authHTTPHandler(mw, c))).ServeHTTP(c.Writer, c.Request) - } -} - -func authHTTPHandler(mw *middleware.Interceptor[*oauth.IntrospectionContext], c *gin.Context) func(w http.ResponseWriter, r *http.Request) { - return func(w http.ResponseWriter, r *http.Request) { - authCtx := mw.Context(r.Context()) - w.Header().Set("id", authCtx.UserID()) - c.JSON(http.StatusOK, gin.H{"id": authCtx.UserID(), "status": "ok"}) - } -} diff --git a/cmd/auth/dockerfile b/cmd/auth/dockerfile deleted file mode 100644 index 9ea655f..0000000 --- a/cmd/auth/dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM --platform=$BUILDPLATFORM golang:alpine AS build - -WORKDIR /app - -COPY . . - -RUN go get ./... - -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o auth-service - -RUN apk update && apk add ca-certificates && update-ca-certificates - -FROM --platform=$TARGETPLATFORM busybox:1.36.1 - -COPY --from=build /etc/ssl/certs /etc/ssl/certs -COPY --from=build /app/auth-service /app/ - -CMD [ "/app/auth-service" ] \ No newline at end of file diff --git a/cmd/auth/main.go b/cmd/auth/main.go deleted file mode 100644 index 9344808..0000000 --- a/cmd/auth/main.go +++ /dev/null @@ -1,84 +0,0 @@ -package main - -import ( - "context" - "flag" - "log" - "os" - "os/signal" - "syscall" - "time" - - "github.com/gin-gonic/gin" - utilities "github.com/vcscsvcscs/GenerationsHeritage/pkg" - "github.com/vcscsvcscs/GenerationsHeritage/pkg/gin/healthcheck" - "github.com/zitadel/zitadel-go/v3/pkg/authorization" - "github.com/zitadel/zitadel-go/v3/pkg/authorization/oauth" - "github.com/zitadel/zitadel-go/v3/pkg/http/middleware" - "github.com/zitadel/zitadel-go/v3/pkg/zitadel" -) - -var ( - cert = flag.String("cert", "/etc/gh-auth-service/ssl/tls.crt", "Specify the path of TLS cert") - key = flag.String("key", "/etc/gh-auth-service/ssl/tls.key", "Specify the path of TLS key") - zitadelAccessKey = flag.String("zitadel-access-key", "/etc/gh-auth-service/zitadel/api-key.json", "Specify the path of Zitadel access key") - httpsPort = flag.String("https", ":443", "Specify port for http secure hosting(example for format :443)") - httpPort = flag.String("http", ":80", "Specify port for http hosting(example for format :80)") - zitadelURI = flag.String("zitadel-uri", "zitadel.varghacsongor.hu", "Specify the Zitadel URI") - release = flag.Bool("release", false, "Set true to release build") - logToFile = flag.Bool("log-to-file", false, "Set true to log to file") - logToFileAndStd = flag.Bool("log-to-file-and-std", false, "Set true to log to file and std") - requestTimeout = time.Duration(*flag.Int("request-timeout", 20, "Set request timeout in seconds")) -) - -func main() { - flag.Parse() - if *release { - gin.SetMode(gin.ReleaseMode) - } - - utilities.SetupLogger(*logToFileAndStd, *logToFile) - - hc := healthcheck.New() - - router := gin.Default() - router.Use(gin.Recovery()) - - ctx := context.Background() - - // Initiate the authorization by providing a zitadel configuration and a verifier. - // This example will use OAuth2 Introspection for this, therefore you will also need to provide the downloaded api key.json - authZ, err := authorization.New(ctx, zitadel.New(*zitadelURI), oauth.DefaultAuthorization(*zitadelAccessKey)) - if err != nil { - log.Println("zitadel sdk could not initialize", "error", err) - os.Exit(1) - } - - // Initialize the HTTP middleware by providing the authorization - mw := middleware.New(authZ) - - router.GET("/health", hc.HealthCheckHandler()) - router.GET("/auth", auth(mw)) - - server := utilities.SetupHttpsServer(router, *cert, *key, *httpsPort, *httpPort, requestTimeout) - - // Wait for interrupt signal to gracefully shutdown the server with some time to finish requests. - quit := make(chan os.Signal, 1) - // kill (no param) default send syscall.SIGTERM - // kill -2 is syscall.SIGINT - // kill -9 is syscall.SIGKILL but can't be caught, so don't need to add it - signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM, os.Interrupt) - <-quit - log.Println("Shutting down server...") - - // The context is used to inform the server it has some seconds to finish - // the request it is currently handling - ctx, cancel := context.WithTimeout(context.Background(), requestTimeout*time.Second) - defer cancel() - - if err := server.Shutdown(ctx); err != nil { - log.Fatal("Server forced to shutdown:", err) - } - - log.Println("Server exiting") -} diff --git a/deployment/auth-service-argo.yaml b/deployment/auth-service-argo.yaml deleted file mode 100644 index 770f378..0000000 --- a/deployment/auth-service-argo.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: gh-auth-service -spec: - project: generations-heritage-vv - source: - repoURL: 'https://github.com/vcscsvcscs/GenerationsHeritage' - path: deployment/auth-service - targetRevision: main - kustomize: - namespace: generations-heritage - destination: - server: 'https://kubernetes.default.svc' - namespace: generations-heritage - syncPolicy: - automated: - selfHeal: true - syncOptions: - - CreateNamespace=true - - ServerSideApply=true - \ No newline at end of file diff --git a/deployment/auth-service/certificate.yaml b/deployment/auth-service/certificate.yaml deleted file mode 100644 index 2e4a060..0000000 --- a/deployment/auth-service/certificate.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: gh-auth-service-certificate - annotations: - argocd.argoproj.io/hook: PreSync -spec: - isCA: false - duration: 2160h # 90d - renewBefore: 360h # 15d - dnsNames: - - gh-auth-service.generations-heritage.svc.cluster.local - - gh-auth-service - - localhost - ipAddresses: - - 127.0.0.1 - subject: - organizations: - - GenerationsHeritage - secretName: gh-auth-service-tls - privateKey: - algorithm: RSA - encoding: PKCS1 - size: 2048 - issuerRef: - name: default-cluster-ca-issuer - kind: ClusterIssuer - group: cert-manager.io - \ No newline at end of file diff --git a/deployment/auth-service/deployment.yaml b/deployment/auth-service/deployment.yaml deleted file mode 100644 index c1c4903..0000000 --- a/deployment/auth-service/deployment.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app.kubernetes.io/instance: gh-auth-service - app.kubernetes.io/name: gh-auth-service - annotations: - argocd.argoproj.io/sync-wave: "1" - argocd.argoproj.io/hook: Synce - name: gh-auth-service - namespace: generations-heritage -spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/instance: gh-auth-service - app.kubernetes.io/name: gh-auth-service - template: - metadata: - labels: - app.kubernetes.io/instance: gh-auth-service - app.kubernetes.io/name: gh-auth-service - spec: - containers: - - image: vcscsvcscs/gheritage-auth-service:latest - imagePullPolicy: Always - name: gh-auth-service - ports: - - containerPort: 443 - name: gin - securityContext: - runAsUser: 0 - resources: - limits: - cpu: 250m - memory: 200Mi - requests: - cpu: 100m - memory: 50Mi - volumeMounts: - - name: gh-auth-service-certs - mountPath: /etc/gh-auth-service/ssl - - name: zitadel-service-account - mountPath: /etc/gh-auth-service/zitadel - volumes: - - name: gh-auth-service-certs - secret: - secretName: gh-auth-service-tls - - name: zitadel-service-account - secret: - secretName: zitadel-service-account diff --git a/deployment/auth-service/forwardAuth.yaml b/deployment/auth-service/forwardAuth.yaml deleted file mode 100644 index 82ee6fd..0000000 --- a/deployment/auth-service/forwardAuth.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: traefik.io/v1alpha1 -kind: Middleware -metadata: - name: auth-service -spec: - forwardAuth: - address: https://gh-auth-service/auth/ - authResponseHeaders: - - id - tls: - insecureSkipVerify: true \ No newline at end of file diff --git a/deployment/auth-service/horizontalPodAutoScaler.yaml b/deployment/auth-service/horizontalPodAutoScaler.yaml deleted file mode 100644 index 413e418..0000000 --- a/deployment/auth-service/horizontalPodAutoScaler.yaml +++ /dev/null @@ -1,26 +0,0 @@ -apiVersion: autoscaling/v2 -kind: HorizontalPodAutoscaler -metadata: - name: gh-auth-service - annotations: - argocd.argoproj.io/hook: PostSync -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: gh-auth-service - minReplicas: 1 - maxReplicas: 5 - metrics: - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: 50 - - type: Resource - resource: - name: memory - target: - type: Utilization - averageUtilization: 50 diff --git a/deployment/auth-service/kustomization.yaml b/deployment/auth-service/kustomization.yaml deleted file mode 100644 index a44c068..0000000 --- a/deployment/auth-service/kustomization.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: generations-heritage - -resources: - - ./certificate.yaml - - ./zitadel-acces-key.yaml - - ./deployment.yaml - - ./service.yaml - - ./horizontalPodAutoScaler.yaml - - ./forwardAuth.yaml diff --git a/deployment/auth-service/service.yaml b/deployment/auth-service/service.yaml deleted file mode 100644 index 8239fec..0000000 --- a/deployment/auth-service/service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - app.kubernetes.io/instance: gh-auth-service - app.kubernetes.io/name: gh-auth-service - name: gh-auth-service -spec: - ports: - - name: gin - port: 443 - protocol: TCP - targetPort: 443 - selector: - app.kubernetes.io/instance: gh-auth-service - app.kubernetes.io/name: gh-auth-service - type: ClusterIP \ No newline at end of file diff --git a/deployment/auth-service/zitadel-acces-key.yaml b/deployment/auth-service/zitadel-acces-key.yaml deleted file mode 100644 index d5ba893..0000000 --- a/deployment/auth-service/zitadel-acces-key.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: zitadel-service-account -data: - api-key.json: eyJ0eXBlIjoiYXBwbGljYXRpb24iLCJrZXlJZCI6IjI2NzQxOTk4NzY3MTUxNTM4OCIsImtleSI6Ii0tLS0tQkVHSU4gUlNBIFBSSVZBVEUgS0VZLS0tLS1cbk1JSUVwQUlCQUFLQ0FRRUF1b3hpdytnWURkMXRwTjc1VUUyejVGN2tRRTVQdzVYYmNOTDFuK3RrUEd0MnRBeDBcbkFZalhUTWVZMGRTUzF3cHhEMGpWVnkwZzJ1Z2gyUzNZL1lrL0ZSWHZMMEhIRmd4N1V4RGFnV2VFNGwvazlIUTJcbjF5Tmx0UjY4NzdoaXN5L2ViOWhVMWxvRG10RDRjZEhSWStOYXBmeG41cFN0Ulh6b2tpYTdnVVl5V0pCdW5FU1pcbkZWM0tsY1g5Nkp3c0RoTXkvdWFFNmtYd1lhUmRWODZENVNueHRvZGFFUzU1cUxYMFhmYUE0VjBleGtQalNpLzNcbnRJNy9WMWY3NnFycTZyK25lN1luZFVGOXVxaHViY3gxZXJSTzZGZm4zWnVMOHhIdVVLVURLWWh6M0xUdjdCYStcbmtMcGd1VFdKdXJ0ZyswNmhFUkw5TFFpUVRwNGNsSEdIYzU3TndRSURBUUFCQW9JQkFBeUJKb210UUJlRjFUaXNcbi9aZEZiaDZMd2M4UnNNVVNnWUFoay9kaFJ2bkoxazRoVzVGU3crUFFxVXkvYkF4Z0ZjNEplc3Q2S2U2aWlzcE5cbkNYT05SSjQ4TnlrNnhvYVMxWjF1enNiSDBwOStBQkhtekZwRmRDYmM1WnRJQjgydEVzTDZoRTFPQVZuYVVoMEhcbkRIc2VuVS90Q0dYcloyWDJCbnp0ZmJvZm8zWk9NdHBIMW91SXRvOFRoRWZWYkVSSFdKN1IrUVFoZVJwbEV6dUpcbkpIdm12cHorMFFkOWVGbjRaUWViOU1DOFRSSW5sTzNyK1d0S1VrWWk1dzlwNTVBSXZiM2RROVpKR2NSSk9RbnlcbnMwTlpRV2tkblJSN05sV0pZUUtPdVIzYVQ1MlY3eER5NDJ5Q1hSTHhEOEU3SWt5aXMvbkswVjlucWNML29DYUhcbkovUURJY0VDZ1lFQTR4TWQ0TGJhNHZjREZMUjJmUHJLUnRkYms3YktGV01BQUx4K2srbXgwY2tyZitMdUY2QVdcbkJpbU9MeFk5TnZrenpQdkVmeG5IWW1DN1NpS2IxbGhUMDBQcGsyWld2SjBESWpaMUc1cXRCQkJpODQvUHVqZ0pcbmFEbFlseUM3T1gyTmlNL25STVN0SnYxamZuZk8rOWZqYnlZNXhSRXMya1U3b24yM091TzgxMGtDZ1lFQTBrKzFcbjZTNTZaQ3BFSkorUWZzaDdvSkFOZkpaMnRyS0diaXVGRlNpdFRLT081am5Dd0pacjVDNW44dUhaT3REUUNkMVFcbmgwWTlEOHUyTlE0NU50ZElzOWNmRGVEVFV6QUF0aVk1Uk9TMzc3MG1MMVNZNWVpQkQ5c081ekZ6enI2aVJBa2hcbjRFZGZlYVNlakFmMHdYVnBMWk9CekRyTXlIaWJzWjJPbjVmcmFya0NnWUVBcVN1ZjBiOUkyVmgvY2hoMFFlNHhcbmJvK1pDVFpmM1lrUkFudHJyZFNvQm92aUhYZTZPOTJuS3RZZ3VKSFA3em0vVHRLdTlLWUc5aExzMVhGdE9rWTVcbnhTWk9TT013Y1hwa1VFUFVBVW05NWs0eStoUEZCWTRqN0FMMUxqcFRZYVJaSW5rSmFpRkFndEM2SkFrc0tsSVBcbmZjb3p0YzV5NVBZNVZIaG1YcmcyQXdrQ2dZRUF1SWJUMTNxK1RIQ0JSWmp6VVNwYXZuQm1SUEJIek5rcTlqTWRcbkc0bUxOSGsxZ204Zm41YmJwMlBJTk9WUWtqaHdzSmNNZHdSN3d3WThJcVVPTWo0R1BqVDd2Rk9OVjZvQWxkRkhcbjRsakR3b2UxbjBXY3VleWNnT3IxVW9palViMFY1cGdVcnhJd2hTeVpKOGc3U2hyWVkvTE9xZ0RWZVBmSnM3ZklcblVlTWIzWkVDZ1lBcGpuZ2ZHckFQbmpzV3hxMXRxQ2RjVThUYmtsMHh2c3ZZVndWR0wrUlJXZlZKQkdFOXpwUVhcbmM2S01mdzR6VXMwUVc5NlJMYXZyQVR3b3JON1p0a05sZXZZNU9HYmpvTWRGN2praUhlTWFzeUh4c25iK0ZPUEtcbkgyZ0FVT0grbGV2WUpiQ3ZqbkM2R3RTR3d2ZVAvRWR2Mng0NTVRVFQ1WTZwck1ZOGdxVWw0QT09XG4tLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLVxuIiwiYXBwSWQiOiIyNjczNjUwMzYyMTU3NjMxOTUiLCJjbGllbnRJZCI6IjI2NzM2NTAzNjIxNTgyODczMUBnZW5lcmF0aW9uc2hlcml0YWdlIn0= diff --git a/deployment/backend-argo.yaml b/deployment/backend-argo.yaml deleted file mode 100644 index b35db2f..0000000 --- a/deployment/backend-argo.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: gh-backend -spec: - project: generations-heritage-vv - source: - repoURL: 'https://github.com/vcscsvcscs/GenerationsHeritage' - path: deployment/backend - targetRevision: main - kustomize: - namespace: generations-heritage - destination: - server: 'https://kubernetes.default.svc' - namespace: generations-heritage - syncPolicy: - automated: - selfHeal: true - syncOptions: - - CreateNamespace=true - - ServerSideApply=true - \ No newline at end of file diff --git a/deployment/backend/certificate.yaml b/deployment/backend/certificate.yaml deleted file mode 100644 index 8d288d2..0000000 --- a/deployment/backend/certificate.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: gh-backend-certificate - annotations: - argocd.argoproj.io/hook: PreSync -spec: - isCA: false - duration: 2160h # 90d - renewBefore: 360h # 15d - dnsNames: - - gh-backend.generations-heritage.svc.cluster.local - - gh-backend - - localhost - ipAddresses: - - 127.0.0.1 - subject: - organizations: - - GenerationsHeritage - secretName: gh-backend-tls - privateKey: - algorithm: RSA - encoding: PKCS1 - size: 2048 - issuerRef: - name: default-cluster-ca-issuer - kind: ClusterIssuer - group: cert-manager.io - \ No newline at end of file diff --git a/deployment/backend/deployment.yaml b/deployment/backend/deployment.yaml deleted file mode 100644 index 6fb31dc..0000000 --- a/deployment/backend/deployment.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app.kubernetes.io/instance: gh-backend - app.kubernetes.io/name: gh-backend - annotations: - argocd.argoproj.io/sync-wave: "1" - argocd.argoproj.io/hook: Synce - name: gh-backend -spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/instance: gh-backend - app.kubernetes.io/name: gh-backend - template: - metadata: - labels: - app.kubernetes.io/instance: gh-backend - app.kubernetes.io/name: gh-backend - spec: - containers: - - image: vcscsvcscs/gheritage-backend-service:latest - imagePullPolicy: Always - name: gh-backend - ports: - - containerPort: 443 - name: gin - securityContext: - runAsUser: 0 - resources: - limits: - cpu: 500m - memory: 500Mi - requests: - cpu: 100m - memory: 100Mi - volumeMounts: - - name: gh-backend-certs - mountPath: /etc/gh-backend/ssl - - name: zitadel-service-account - mountPath: /etc/gh-backend/zitadel - volumes: - - name: gh-backend-certs - secret: - secretName: gh-backend-tls - - name: zitadel-service-account - secret: - secretName: zitadel-service-account - \ No newline at end of file diff --git a/deployment/backend/horizontalPodAutoScaler.yaml b/deployment/backend/horizontalPodAutoScaler.yaml deleted file mode 100644 index ef131b6..0000000 --- a/deployment/backend/horizontalPodAutoScaler.yaml +++ /dev/null @@ -1,26 +0,0 @@ -apiVersion: autoscaling/v2 -kind: HorizontalPodAutoscaler -metadata: - name: gh-backend - annotations: - argocd.argoproj.io/hook: PostSync -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: gh-backend - minReplicas: 1 - maxReplicas: 5 - metrics: - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: 50 - - type: Resource - resource: - name: memory - target: - type: Utilization - averageUtilization: 50 diff --git a/deployment/backend/ingressRoute.yaml b/deployment/backend/ingressRoute.yaml deleted file mode 100644 index 87ee565..0000000 --- a/deployment/backend/ingressRoute.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: gh-backend - annotations: - argocd.argoproj.io/hook: PostSync -spec: - entryPoints: - - websecure - routes: - - kind: Rule - match: Host(`heritagebackend.varghacsongor.hu`) - services: - - name: gh-backend - port: 443 - scheme: https - serversTransport: gh-backend - tls: {} ---- -apiVersion: traefik.containo.us/v1alpha1 -kind: ServersTransport -metadata: - name: gh-backend - annotations: - argocd.argoproj.io/hook: PostSync -spec: - insecureSkipVerify: true - rootCAsSecrets: - - gh-backend-tls \ No newline at end of file diff --git a/deployment/backend/kustomization.yaml b/deployment/backend/kustomization.yaml deleted file mode 100644 index e9f8c72..0000000 --- a/deployment/backend/kustomization.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: generations-heritage - -resources: - - ./certificate.yaml - - ./deployment.yaml - - ./service.yaml - - ./ingressRoute.yaml - - ./horizontalPodAutoScaler.yaml diff --git a/deployment/backend/service.yaml b/deployment/backend/service.yaml deleted file mode 100644 index 23d3ff6..0000000 --- a/deployment/backend/service.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - app.kubernetes.io/instance: gh-backend - app.kubernetes.io/name: gh-backend - name: gh-backend - annotations: - argocd.argoproj.io/sync-wave: "2" - argocd.argoproj.io/hook: Synce -spec: - ports: - - name: gin - port: 443 - protocol: TCP - targetPort: 443 - selector: - app.kubernetes.io/instance: gh-backend - app.kubernetes.io/name: gh-backend - type: ClusterIP diff --git a/deployment/cert-issuer.yaml b/deployment/cert-issuer.yaml deleted file mode 100644 index 23cab2e..0000000 --- a/deployment/cert-issuer.yaml +++ /dev/null @@ -1,45 +0,0 @@ -apiVersion: cert-manager.io/v1 -kind: ClusterIssuer -metadata: - name: trust-manager-selfsigned-issuer -spec: - selfSigned: {} ---- -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: cluster-root-certificate - namespace: cert-manager -spec: - isCA: true - commonName: cluster-root-certificate-ca - secretName: cluster-root-certificate-ca-secret - privateKey: - algorithm: ECDSA - size: 256 - issuerRef: - name: trust-manager-selfsigned-issuer - kind: ClusterIssuer - group: cert-manager.io ---- -apiVersion: cert-manager.io/v1 -kind: ClusterIssuer -metadata: - name: default-cluster-ca-issuer -spec: - ca: - secretName: cluster-root-certificate-ca-secret ---- -apiVersion: trust.cert-manager.io/v1alpha1 -kind: Bundle -metadata: - name: in-cluster-trust-bundle -spec: - sources: - - useDefaultCAs: true - - secret: - name: "cluster-root-certificate-ca-secret" - key: "tls.crt" - target: - configMap: - key: "trust-bundle.pem" \ No newline at end of file diff --git a/deployment/memgraph-argo.yaml b/deployment/memgraph-argo.yaml deleted file mode 100644 index 4849779..0000000 --- a/deployment/memgraph-argo.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: memgraph -spec: - project: generations-heritage-vv - source: - repoURL: 'https://github.com/vcscsvcscs/GenerationsHeritage' - path: deployment/memgraph - targetRevision: main - kustomize: - namespace: generations-heritage - destination: - server: 'https://kubernetes.default.svc' - namespace: generations-heritage - syncPolicy: - automated: - selfHeal: true - syncOptions: - - CreateNamespace=true - - ServerSideApply=true - \ No newline at end of file diff --git a/deployment/memgraph/certificates.yaml b/deployment/memgraph/certificates.yaml deleted file mode 100644 index c6dafa6..0000000 --- a/deployment/memgraph/certificates.yaml +++ /dev/null @@ -1,30 +0,0 @@ -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: memraph-certificate - annotations: - argocd.argoproj.io/hook: PreSync -spec: - isCA: false - duration: 2160h # 90d - renewBefore: 360h # 15d - dnsNames: - - memgraph.generations-heritage.svc.cluster.local - - memgraph - - localhost - ipAddresses: - - 127.0.0.1 - subject: - organizations: - - Memgraph - - GenerationsHeritage - secretName: memgraph-tls - privateKey: - algorithm: RSA - encoding: PKCS1 - size: 2048 - issuerRef: - name: default-cluster-ca-issuer - kind: ClusterIssuer - group: cert-manager.io - \ No newline at end of file diff --git a/deployment/memgraph/kustomization.yaml b/deployment/memgraph/kustomization.yaml deleted file mode 100644 index 051d667..0000000 --- a/deployment/memgraph/kustomization.yaml +++ /dev/null @@ -1,33 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: generations-heritage - -resources: - - ./certificates.yaml - -helmCharts: - - name: memgraph - repo: https://memgraph.github.io/helm-charts - releaseName: memgraph - namespace: generations-heritage - version: 0.1.1 - valuesFile: ./values.yaml - -patches: - - target: - kind: StatefulSet - name: memgraph - patch: |- - - op: add - path: /spec/template/spec/containers/0/volumeMounts/- - value: - name: memgraph-certs - mountPath: /etc/memgraph/ssl - - op: add - path: /spec/template/spec/volumes/- - value: - name: memgraph-certs - secret: - secretName: memgraph-tls - - \ No newline at end of file diff --git a/deployment/memgraph/values.yaml b/deployment/memgraph/values.yaml deleted file mode 100644 index 2d39dba..0000000 --- a/deployment/memgraph/values.yaml +++ /dev/null @@ -1,52 +0,0 @@ -image: - repository: memgraph/memgraph - # Overrides the image tag whose default is v{{ .Chart.AppVersion }} - tag: "" - pullPolicy: IfNotPresent - -replicaCount: 1 - -service: - type: ClusterIP - port: 7687 - targetPort: 7687 - protocol: TCP - annotations: {} - -persistentVolumeClaim: - storagePVC: true - storagePVCSize: 2Gi - logPVC: true - logPVCSize: 256Mi - -memgraphConfig: - - "--also-log-to-stderr=true" - - "--bolt-cert-file=/etc/memgraph/ssl/tls.crt" - - "--bolt-key-file=/etc/memgraph/ssl/tls.key" - -# Annotations to add to the statefulSet -statefulSetAnnotations: {} -# Annotations to add to the Pod -podAnnotations: {} - -resources: - {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -serviceAccount: - # Specifies whether a service account should be created - create: true - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" \ No newline at end of file diff --git a/deployment/project-argo.yaml b/deployment/project-argo.yaml deleted file mode 100644 index 487eb52..0000000 --- a/deployment/project-argo.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: AppProject -metadata: - name: generations-heritage-vv -spec: - description: Generations heritages is a project that aims to preserve the heritage of families based on bloodlines. - sourceRepos: - - '*' # Allow all repositories - destinations: - - namespace: 'generations-heritage' - server: '*' - clusterResourceWhitelist: - - group: '*' - kind: '*' # Allow all kinds \ No newline at end of file diff --git a/deployment/zitadel-argo.yaml b/deployment/zitadel-argo.yaml deleted file mode 100644 index a44b713..0000000 --- a/deployment/zitadel-argo.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: zitadel -spec: - project: generations-heritage-vv - source: - repoURL: 'https://github.com/vcscsvcscs/GenerationsHeritage' - path: deployment/zitadel - targetRevision: main - kustomize: - namespace: generations-heritage - destination: - server: 'https://kubernetes.default.svc' - namespace: generations-heritage - syncPolicy: - automated: - selfHeal: true - syncOptions: - - CreateNamespace=true - - ServerSideApply=true - \ No newline at end of file diff --git a/deployment/zitadel/cert-job.yaml b/deployment/zitadel/cert-job.yaml deleted file mode 100644 index 7fe8f61..0000000 --- a/deployment/zitadel/cert-job.yaml +++ /dev/null @@ -1,113 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: zitadel-cert-creator - annotations: - argocd.argoproj.io/hook: Sync - argocd.argoproj.io/sync-wave: "2" ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: secret-creator -rules: - - apiGroups: [ "" ] - resources: [ "secrets" ] - verbs: [ "create" ] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: zitadel-cert-creator - annotations: - argocd.argoproj.io/hook: Sync - argocd.argoproj.io/sync-wave: "2" -subjects: - - kind: ServiceAccount - name: zitadel-cert-creator -roleRef: - kind: Role - name: secret-creator - apiGroup: rbac.authorization.k8s.io ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: create-zitadel-cert - annotations: - argocd.argoproj.io/hook: Sync - argocd.argoproj.io/sync-wave: "2" -spec: - template: - spec: - restartPolicy: OnFailure - serviceAccountName: zitadel-cert-creator - containers: - - command: - - /bin/bash - - -ecx - - | - cockroach cert create-client \ - --certs-dir /cockroach/cockroach-certs \ - --ca-key /cockroach/cockroach-certs/ca.key \ - --lifetime 8760h \ - zitadel - export SECRET=$(cat <