Split out Keycloak dev server into seperate app (#3772)

This commit is contained in:
Jon Koops 2022-11-15 16:42:38 +01:00 committed by GitHub
parent d0b224cae7
commit 3bc78de400
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 109 additions and 812 deletions

View file

@ -18,29 +18,7 @@ In order to run the Keycloak server you will also have to install the Java Devel
### Running the Keycloak server
First, ensure that all dependencies are installed locally using NPM by running:
```bash
npm install
```
After the dependencies are installed we can start the Keycloak server by running the following command:
```bash
npm run server:start
```
This will download the [Nightly version](https://github.com/keycloak/keycloak/releases/tag/nightly) of the Keycloak server and run it locally on port `8180`. If a previously downloaded version was found in the `server/` directory then that one will be used instead. If you want to download the latest Nightly version you can remove the server directory before running the command to start the server.
In order for the development version of the Admin UI to work you will have to import a custom client to the Keycloak server. This is only required during development as the development server for the Admin UI runs on a different port (more on that later).
Wait for the Keycloak server to be up and running and run the following command in a new terminal:
```bash
npm run server:import-client
```
You'll only have to run this command once, unless you remove the server directory or Keycloak server data.
See the instructions in the [Keycloak server app](../keycloak-server/README.md).
### Running the development server

View file

@ -9,9 +9,7 @@
"cy:open": "cypress open --e2e --browser chrome",
"cy:run": "cypress run --browser chrome",
"cy:check-types": "wireit",
"cy:ldap-server": "ldap-server-mock --conf=./cypress/fixtures/ldap/server.json --database=./cypress/fixtures/ldap/users.json",
"server:start": "./scripts/start-server.mjs",
"server:import-client": "wireit"
"cy:ldap-server": "ldap-server-mock --conf=./cypress/fixtures/ldap/server.json --database=./cypress/fixtures/ldap/users.json"
},
"wireit": {
"dev": {
@ -54,12 +52,6 @@
"dependencies": [
"../../libs/keycloak-admin-client:build"
]
},
"server:import-client": {
"command": "./scripts/import-client.mjs",
"dependencies": [
"../../libs/keycloak-admin-client:build"
]
}
},
"dependencies": {
@ -96,7 +88,6 @@
"@babel/preset-env": "^7.20.2",
"@cypress/webpack-batteries-included-preprocessor": "^2.2.3",
"@cypress/webpack-preprocessor": "^5.15.5",
"@octokit/rest": "^19.0.5",
"@testing-library/cypress": "^8.0.3",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.5",
@ -104,23 +95,15 @@
"@types/dagre": "^0.7.48",
"@types/file-saver": "^2.0.5",
"@types/flat": "^5.0.2",
"@types/gunzip-maybe": "^1.4.0",
"@types/lodash-es": "^4.17.6",
"@types/react": "^17.0.45",
"@types/react-dom": "^17.0.16",
"@types/react-router-dom": "^5.3.3",
"@types/tar-fs": "^2.0.1",
"@vitejs/plugin-react": "^2.2.0",
"cypress": "^11.0.1",
"decompress": "^4.2.1",
"del": "^7.0.0",
"gunzip-maybe": "^1.4.2",
"http2-proxy": "^5.0.53",
"jsdom": "^20.0.2",
"ldap-server-mock": "^6.0.1",
"node-fetch": "^3.3.0",
"progress-promise": "^0.0.6",
"tar-fs": "^2.1.1",
"ts-node": "^10.9.1",
"vite": "^3.2.3",
"vite-plugin-checker": "^0.5.1",

View file

@ -0,0 +1,29 @@
# Keycloak Server
This app allows you to run a local development version of the Keycloak server.
### Running the Keycloak server
First, ensure that all dependencies are installed locally using NPM by running:
```bash
npm install
```
After the dependencies are installed we can start the Keycloak server by running the following command:
```bash
npm run start
```
This will download the [Nightly version](https://github.com/keycloak/keycloak/releases/tag/nightly) of the Keycloak server and run it locally on port `8180`. If a previously downloaded version was found in the `server/` directory then that one will be used instead. If you want to download the latest Nightly version you can remove the server directory before running the command to start the server.
In order for the development version of the Admin UI to work you will have to import a custom client to the Keycloak server. This is only required during development as the development server for the Admin UI runs on a different port (more on that later).
Wait for the Keycloak server to be up and running and run the following command in a new terminal:
```bash
npm run import-client
```
You'll only have to run this command once, unless you remove the server directory or Keycloak server data.

View file

@ -0,0 +1,22 @@
{
"name": "keycloak-server",
"scripts": {
"start": "./scripts/start-server.mjs",
"import-client": "wireit"
},
"wireit": {
"import-client": {
"command": "./scripts/import-client.mjs",
"dependencies": [
"../../libs/keycloak-admin-client:build"
]
}
},
"dependencies": {
"@octokit/rest": "^19.0.5",
"@types/gunzip-maybe": "^1.4.0",
"@types/tar-fs": "^2.0.1",
"gunzip-maybe": "^1.4.2",
"tar-fs": "^2.1.1"
}
}

View file

@ -2,7 +2,6 @@
// @ts-check
import { Octokit } from "@octokit/rest";
import gunzip from "gunzip-maybe";
import fetch from "node-fetch";
import { spawn } from "node:child_process";
import fs from "node:fs";
import path from "node:path";

823
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,8 @@
"libs/keycloak-js",
"libs/keycloak-masthead",
"apps/account-ui",
"apps/admin-ui"
"apps/admin-ui",
"apps/keycloak-server"
],
"scripts": {
"prepare": "husky install"