diff --git a/README.md b/README.md index 3e05159..e0a2973 100644 --- a/README.md +++ b/README.md @@ -1,103 +1,128 @@ -Karauth -======= +Karso +===== -This repository manage 3 elements: - - The SSO backend: jersey REST server - - The SSO front-end: Angular login interface (KARSO) - - The adminitrator of the SSO: Angular adminitration interface of the SSO (KARSO) +**K**angaroo **A**nd **R**abbit (S)SO is a simple SSO interface that manage multiple application authentication. -To build the docker image: --------------------------- + +Run in local: +============= + +Start tools +----------- + +Start the server basic interfaces: (DB(mySQL), Adminer) ```{.bash} -gitea.atria-soft.org/kangaroo-and-rabbit/karso:latest +# start the Bdd interface (no big data > 50Mo) +docker compose -f env_dev/docker-compose.yaml up -d ``` -MySql manage multiple users: ----------------------------- +Start the Back-end: +------------------- -It is better to not use root user and mange user for each service. +backend is developed in JAVA -Add a new user -```sql -CREATE USER 'karso'@'%' IDENTIFIED BY 'base_db_password'; -GRANT ALL PRIVILEGES ON `karso`.* TO 'karso'@'%'; -FLUSH PRIVILEGES; +The first step is configuring your JAVA version (or select the JVM with the OS) +```bash +export PATH=$(ls -d --color=never /usr/lib/jvm/java-2*-openjdk)/bin:$PATH ``` -> **_Note_** the `base_db_password` with the production password. this one is for development environment +Install the dependency: +```bash +mvn install +``` -To start the service +Run the test +```bash +mvn test +``` + +Install it for external use +```bash +mvn install +``` + +Execute the local server: +```bash +mvn exec:java@dev-mode +``` + +Start the Front-end: -------------------- -```{.bash} -docker-compose up -d +backend is developed in JAVA +```bash +cd front +pnpm install +pnpm dev ``` -**Note:** you can manage a single Docker interface to manage all the KAR engine +Display the result: +------------------- -docker login gitea.atria-soft.org - -docker pull archlinux:base-devel -docker pull bellsoft/liberica-openjdk-alpine:latest - -docker build -t gitea.atria-soft.org/kangaroo-and-rabbit/karso:latest . - -docker push gitea.atria-soft.org/kangaroo-and-rabbit/karso:latest - - - - - - - npx playwright test - Runs the end-to-end tests. - - npx playwright test --project=firefox - Runs the tests only on Desktop Chrome. - - npx playwright test example - Runs the tests in a specific file. - - npx playwright test --debug - Runs the tests in debug mode. - - npx playwright codegen - Auto generate tests with Codegen. - -We suggest that you begin by typing: - - npx playwright test - - - -Action a faire d'urgence: - - Mettre un jenkins en place - - dev sur develop et non master - - concevoir un système de migration et d'initialisation. - - ajouter une interface a sqlWrapper pour supporter sqlite ==> plus facile pour les tests - - mettre des test unitaire sur les API REST: - - securité des interfaces - - viole des token - - Fin de validité d'un tocken - - Addaque d-DOS - - Publier toutes les semaine une version a jour - - faire de la documentation pour l'aide - - revoir l'interface des paramètre pour la ganérisé - - Mettre en place une meilleur page d'acceuil - - mettre en config le nom du site - - faire un tool qui permet de savoir si le serveur est UP et si ce n'est pas le cas, bloquer l'affichage - - mettre en place les coors pour les pages d'administration ==> ca vas ètre coton... - - améliorer la gestion et l'affichages des erreur - - mettre en place des pop-up de détection d'erreur - - mise en place d'envoie d'email pour faire une autentification plus sérieuse. - - mettre un place un back-end LDAP +[show the webpage: http://localhost:4200](http://localhost:4200) +Some other dev tools: +===================== +Format code: +------------ ```bash export PATH=$(ls -d --color=never /usr/lib/jvm/java-2*-openjdk)/bin:$PATH mvn formatter:format mvn test -``` \ No newline at end of file +``` + +Tools in production mode +======================== + +Changing the Log Level +---------------------- + +In a production environment, you can adjust the log level to help diagnose bugs more effectively. + +The available log levels are: +| **Log Level Tag** | **org.kar.karso** | **org.kar.archidata** | **other** | +| ----------------- | ------------------- | --------------------- | --------- | +| `prod` | INFO | INFO | INFO | +| `prod-debug` | DEBUG | INFO | INFO | +| `prod-trace` | TRACE | DEBUG | INFO | +| `prod-trace-full` | TRACE | TRACE | INFO | +| `dev` | TRACE | DEBUG | INFO | + + +Manual set in production: +========================= + +Connect on the registry +------------------------ + +To log-in and log-out from the registry: +```bash +export REGISTRY_ADDRESS=gitea.atria-soft.org +docker login -u <> ${REGISTRY_ADDRESS} +docker logout ${REGISTRY_ADDRESS} +``` + +pull the root image of dockers +------------------------------ + +```bash +docker pull archlinux:base-devel +docker pull bellsoft/liberica-openjdk-alpine:latest +``` + +Create the version +------------------ + +Execute in the local folder: (use ```dev``` for development and ```latest``` for production release) + +```bash +export TAG_DOCKER=latest +export REGISTRY_ADDRESS=gitea.atria-soft.org +docker build -t ${REGISTRY_ADDRESS}/kangaroo-and-rabbit/karso:${TAG_DOCKER} . +docker push ${REGISTRY_ADDRESS}/kangaroo-and-rabbit/karso:${TAG_DOCKER} +``` + diff --git a/env_dev/docker-compose.yaml b/env_dev/docker-compose.yaml new file mode 100644 index 0000000..c09d871 --- /dev/null +++ b/env_dev/docker-compose.yaml @@ -0,0 +1,56 @@ +services: + kar_db_service: + image: mysql:latest + restart: always + environment: + - MYSQL_ROOT_PASSWORD=base_db_password + volumes: + - ./data:/var/lib/mysql + mem_limit: 300m + ports: + - 3906:3306 + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] + timeout: 10s + retries: 5 + # perform a 1 minute grace to let the DB to perform the initialization + start_period: 1m + start_interval: 1m + + kar_mongodb_service: + image: mongo:latest + restart: always + environment: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: base_db_password + ports: + - 27017:27017 + volumes: + - ./dataMongo:/data/db + + kar_adminer_service: + image: adminer:latest + restart: always + depends_on: + kar_db_service: + condition: service_healthy + links: + - kar_db_service:db + - kar_mongodb_service:dbm + ports: + - 4079:8080 + mem_limit: 50m + + mongo_express_service: + image: mongo-express + restart: always + ports: + - 4077:8081 + links: + - kar_mongodb_service:db + environment: + ME_CONFIG_MONGODB_ADMINUSERNAME: root + ME_CONFIG_MONGODB_ADMINPASSWORD: base_db_password + ME_CONFIG_MONGODB_URL: mongodb://root:base_db_password@db:27017/ + ME_CONFIG_BASICAUTH: false + diff --git a/front/.storybook/preview.tsx b/front/.storybook/preview.tsx index 9f3feba..5e92235 100644 --- a/front/.storybook/preview.tsx +++ b/front/.storybook/preview.tsx @@ -4,23 +4,11 @@ import { Box } from '@chakra-ui/react'; import { ChakraProvider } from '@chakra-ui/react'; import { MemoryRouter } from 'react-router-dom'; -import theme from '../src/theme'; - -// .storybook/preview.js -export const parameters = { - options: { - storySort: { - order: ['StyleGuide', 'Components', 'Fields', 'App Layout'], - }, - }, - actions: {}, - layout: 'fullscreen', - backgrounds: { disable: true, grid: { disable: true } }, - chakra: { - theme, - }, -}; +import { ColorModeProvider } from '../src/components/ui/color-mode'; +import { Toaster } from '../src/components/ui/toaster'; +import { systemTheme } from '../src/theme/theme'; +// . const DocumentationWrapper = ({ children }) => { return ( @@ -31,13 +19,16 @@ const DocumentationWrapper = ({ children }) => { export const decorators = [ (Story, context) => ( - - {/* Using MemoryRouter to avoid route clashing with Storybook */} - - - - - - + + + {/* Using MemoryRouter to avoid route clashing with Storybook */} + + + + + + + + ), ]; diff --git a/front/build.js b/front/build.js deleted file mode 100644 index e69de29..0000000 diff --git a/front/knip.ts b/front/knip.ts index 48f7f68..5730c49 100644 --- a/front/knip.ts +++ b/front/knip.ts @@ -3,11 +3,7 @@ import type { KnipConfig } from 'knip'; const config: KnipConfig = { // Ignoring mostly shell binaries ignoreBinaries: ['export', 'sleep'], - ignore: [ - // Related to tests - 'tests/**', - '**.conf.js', - ], + ignore: [], }; export default config; diff --git a/front/src/components/Layout/PageLayoutInfoCenter.tsx b/front/src/components/Layout/PageLayoutInfoCenter.tsx index cf040a2..f69f2b5 100644 --- a/front/src/components/Layout/PageLayoutInfoCenter.tsx +++ b/front/src/components/Layout/PageLayoutInfoCenter.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode, useEffect } from 'react'; +import { ReactNode, useEffect } from 'react'; import { Flex, FlexProps } from '@chakra-ui/react'; import { useLocation } from 'react-router-dom'; diff --git a/front/src/components/TopBar/TopBar.tsx b/front/src/components/TopBar/TopBar.tsx index 49cfb85..c2b68a6 100644 --- a/front/src/components/TopBar/TopBar.tsx +++ b/front/src/components/TopBar/TopBar.tsx @@ -113,18 +113,6 @@ export const TopBar = ({ title, children }: TopBarProps) => { drawerDisclose.onOpen(); }; const navigate = useNavigate(); - // const onSignIn = (): void => { - // clearToken(); - // requestSignIn(); - // }; - // const onSignUp = (): void => { - // clearToken(); - // requestSignUp(); - // }; - // const onSignOut = (): void => { - // clearToken(); - // requestSignOut(); - // }; return ( { diff --git a/front/src/components/contextMenu/ContextMenu.tsx b/front/src/components/contextMenu/ContextMenu.tsx index 5bd5107..7f88b0b 100644 --- a/front/src/components/contextMenu/ContextMenu.tsx +++ b/front/src/components/contextMenu/ContextMenu.tsx @@ -1,4 +1,4 @@ -import { ReactNode, useState } from 'react'; +import { ReactNode } from 'react'; import { LuMenu } from 'react-icons/lu'; diff --git a/front/src/components/select/SelectMultiple.tsx b/front/src/components/select/SelectMultiple.tsx index 88cd6f8..b247a23 100644 --- a/front/src/components/select/SelectMultiple.tsx +++ b/front/src/components/select/SelectMultiple.tsx @@ -1,14 +1,6 @@ import { RefObject, useEffect, useMemo, useRef, useState } from 'react'; -import { - Button, - Flex, - HStack, - Input, - Spinner, - Tag, - TagLabel, -} from '@chakra-ui/react'; +import { Button, Flex, HStack, Input, Spinner, Tag } from '@chakra-ui/react'; import { MdEdit, MdKeyboardArrowDown, MdKeyboardArrowUp } from 'react-icons/md'; import { SelectList, SelectListModel } from '@/components/select/SelectList'; diff --git a/front/src/components/ui/index.ts b/front/src/components/ui/index.ts deleted file mode 100644 index e69de29..0000000 diff --git a/front/src/environment.ts b/front/src/environment.ts index c1d6a39..5e8e1ba 100644 --- a/front/src/environment.ts +++ b/front/src/environment.ts @@ -9,7 +9,7 @@ export interface Environment { replaceDataToRealServer?: boolean; } -const serverSSOAddress = 'http://atria-soft.org'; +const serverSSOAddress = 'https://atria-soft.org'; const environment_back_prod: Environment = { production: false, diff --git a/front/src/errors/ErrorBoundary.tsx b/front/src/errors/ErrorBoundary.tsx index 230b8ec..b3a7411 100644 --- a/front/src/errors/ErrorBoundary.tsx +++ b/front/src/errors/ErrorBoundary.tsx @@ -31,5 +31,9 @@ const ErrorFallback = ({ error }: FallbackProps) => { }; export const ErrorBoundary = ({ children }: { children: ReactNode }) => { - return ; + return ( + + {children} + + ); }; diff --git a/front/src/scene/AppRoutes.tsx b/front/src/scene/AppRoutes.tsx index 351550b..a7d42df 100644 --- a/front/src/scene/AppRoutes.tsx +++ b/front/src/scene/AppRoutes.tsx @@ -1,6 +1,7 @@ import { createBrowserHistory } from 'history'; import { unstable_HistoryRouter as HistoryRouter, + Navigate, Route, Routes, } from 'react-router-dom'; @@ -27,7 +28,8 @@ export const AppRoutes = () => { {isReadable ? ( <> - } /> + } /> + } /> {/* Connection page after SSO */}