Skip to content

Commit 94ac704

Browse files
committed
updated setup after Keycloak upgrade to 26.2.0
1 parent b4e052f commit 94ac704

File tree

2 files changed

+34
-49
lines changed

2 files changed

+34
-49
lines changed

quickstart.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ $ npm install
4848
$ sudo npm link
4949
```
5050

51+
In Windows Subsystem for Linux the `sudo npm` may not work, try `sudo -env "PATH=$PATH" npm` then. Also when using the docker related command `zendro dockerize` the `sudo -env "PATH=$PATH"` may be necessary, as docker requires to be run with higher permissions.
52+
5153
### Step 2: Setup a new Zendro project
5254

5355
The easiest way to set up Zendro is using the [Zendro CLI tool](https://github.com/Zendro-dev/zendro) with minimal steps and configuration.
@@ -82,6 +84,12 @@ Go inside the new project you just created named `<name>` and edit *NEXTAUTH_SEC
8284
* **GraphiQL in development mode:** ./graphiql-auth/.env.development
8385
* **GraphiQL in production mode:** ./graphiql-auth/.env.production
8486

87+
An easy way to set them in Linux is by using the following command:
88+
89+
```
90+
$ sed -i 's/^\(NEXTAUTH_SECRET\)=..$/\1=.../' graphiql-auth/.env.* single-page-app/.env.*
91+
```
92+
8593
If you want to know more about the enviroment variables, you can check [this]({% link env_vars.md %}).
8694

8795
### Step 4: Start up your Zendro instance

setup_root.md

Lines changed: 26 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ $ npm install
5050
$ sudo npm link
5151
```
5252

53+
In Windows Subsystem for Linux the `sudo npm` may not work, try `sudo -env "PATH=$PATH" npm` then. Also when using the docker related command `zendro dockerize` the `sudo -env "PATH=$PATH"` may be necessary, as docker requires to be run with higher permissions.
54+
5355
### Step 2: Setup a new Zendro project
5456

5557
The easiest way to set up Zendro is using the [Zendro CLI tool](https://github.com/Zendro-dev/zendro). With minimal steps and configuration a Zendro warehouse taylored to your data needs can be deployed.
@@ -77,21 +79,12 @@ $ zendro new <my-project-name>
7779

7880
### Step 3: Edit environment variables
7981

80-
Go inside the new project and modify the selected enviroment variables in the following files. These files have a default configuration, please remember to add your expected secret word in the *NEXTAUTH_SECRET* variable.
82+
Go inside the new project and modify the selected enviroment variables in the following files. These files have a default configuration, please remember to add your expected secret word in the *NEXTAUTH_SECRET* variable. An easy way to do so in Linux is by using the following command:
8183

82-
* **Without docker setup:** You should modify this file according to your database connection. If you wish to use the default database, please replace the content of the file `./graphql-server/config/data_models_storage_config.json` for:
8384
```
84-
{
85-
"default-sql": {
86-
"storageType": "sql",
87-
"dialect": "sqlite",
88-
"storage": "data.db"
89-
}
90-
}
85+
$ sed -i 's/^\(NEXTAUTH_SECRET\)=..$/\1=.../' graphiql-auth/.env.* single-page-app/.env.*
9186
```
9287

93-
* **With docker setup:** ./config/data_models_storage_config.json
94-
9588
**With or without docker:**
9689

9790
*Remember that dotfiles are usually treated as hidden files, so make sure you can view hidden files.*
@@ -114,6 +107,21 @@ If you want to learn more about how to define data models with Zendro, please ch
114107

115108
Note: by default, indices would be generated for *internalId*. And it is recommended to add indices for attributes which are foreign keys. See the [json specs]({% link setup_data_scheme.md %}#json-specs) for more information.
116109

110+
You should also configure the storage types you used, like credentials or port of a database.
111+
112+
* **Without docker setup:** If you wish to use the default database, please replace the content of the file `./graphql-server/config/data_models_storage_config.json` for:
113+
```
114+
{
115+
"default-sql": {
116+
"storageType": "sql",
117+
"dialect": "sqlite",
118+
"storage": "data.db"
119+
}
120+
}
121+
```
122+
123+
* **With docker setup:** ./config/data_models_storage_config.json
124+
117125
### Step 5: Generate code and migrations
118126

119127
After setting up your data models use the next command to generate the model-specific code and fill your Zendro skeleton project with life.
@@ -231,13 +239,13 @@ If you prefer to use local setup with Keycloak, there are a few things to do aft
231239
***Requirements***
232240

233241
* Install [Java](https://www.java.com/en/) (from Java 11 forward).
234-
* Install [keycloak](https://www.keycloak.org). We recommend Keycloak 18+.
242+
* Install [Keycloak](https://www.keycloak.org). Zendro works with [Keycloak 26.2.0](https://github.com/keycloak/keycloak/releases/tag/26.2.0). It is highly recommended to try the latest version and use 26.2.0 in case of breaking changes.
235243
* Go to https://www.keycloak.org/downloads and download *Distribution powered by Quarkus*.
236244
* After unzip, copy the keycloak configuration file from `zendro/test/env/keycloak.conf` to `keycloak/conf/keycloak.conf`.
237245
* Two enviroment variables should be configured through command line. In terminal inside keycloak folder execute:
238246
```
239-
$ export KEYCLOAK_ADMIN=admin
240-
$ export KEYCLOAK_ADMIN_PASSWORD=admin
247+
$ export KC_BOOTSTRAP_ADMIN_USERNAME=admin
248+
$ export KC_BOOTSTRAP_ADMIN_PASSWORD=admin
241249
```
242250
*Important: If you are working on Windows and the command `export` is not working, ignore this step. Keycloak is going to ask you for the admin credentials when it starts in the web interface.*
243251
@@ -248,30 +256,6 @@ If you prefer to use local setup with Keycloak, there are a few things to do aft
248256
249257
250258
* Zendro realm configuration will be done when the migration file is executed after zendro starts.
251-
<br/><br/>
252-
253-
254-
* In order to get zendro and keycloak running, you have to do some modifications in your zendro new project `.env` files. Remember that dotfiles are usually treated as hidden files, so make sure you can view hidden files.
255-
256-
* ./single-page-app/.env.production and ./single-page-app/.env.development
257-
```
258-
NEXT_PUBLIC_ZENDRO_ROLES_URL="http://localhost:3000/getRolesForOAuth2Token"
259-
OAUTH2_ISSUER="http://localhost:8081/realms/zendro"
260-
OAUTH2_TOKEN_URI="http://localhost:8081/realms/zendro/protocol/openid-connect/token"
261-
OAUTH2_LOGOUT_URL="http://localhost:8081/realms/zendro/protocol/openid-connect/logout"
262-
```
263-
* ./graphiql-auth/.env.development and ./graphiql-auth/.env.production
264-
```
265-
OAUTH2_ISSUER="http://localhost:8081/realms/zendro"
266-
OAUTH2_TOKEN_URI="http://localhost:8081/realms/zendro/protocol/openid-connect/token"
267-
OAUTH2_AUTH_URI="http://localhost:8081/realms/zendro/protocol/openid-connect/auth"
268-
OAUTH2_LOGOUT_URL="http://localhost:8081/realms/zendro/protocol/openid-connect/logout"
269-
```
270-
271-
* ./graphql-server/.env
272-
```
273-
OAUTH2_TOKEN_URI="http://localhost:8081/realms/zendro/protocol/openid-connect/token"
274-
```
275259
276260
* Start zendro
277261
@@ -288,20 +272,13 @@ If you prefer to use local setup with Keycloak, there are a few things to do aft
288272
* Single Page App (SPA) - http://localhost:8080
289273
* Keycloak - http://localhost:8081/
290274
291-
*If you are having problems starting zendro in development mode due to "mandatory OAuth2 variables are not being set" error in SPA or GraphiQL, please run `zendro stop` to stop the services and then `zendro start` to start services again. This happens because graphql-server should write the OAuth2 variables in .env files before SPA and GraphiQL load, but SPA and GraphiQL are loading faster than graphql-server.*
275+
*If you are having problems starting zendro in development mode due to "mandatory OAuth2 variables are not being set" error in SPA or GraphiQL, please run `zendro stop` to stop the services and then `zendro start` to start services again. This happens because graphql-server should write the OAuth2 variables in .env files before SPA and GraphiQL load, but SPA and GraphiQL may load faster than graphql-server.*
292276
293277
**Production mode**
294278
295-
*Remember that dotfiles are usually treated as hidden files, so make sure you can view hidden files.*
296-
297-
* Copy the content of `./graphiql-auth/.env.development` to `./graphiql-auth/.env.production`
298-
* Copy the content of `./single-page-app/.env.development` to `./single-page-app/.env.production`
299-
* Modify the `OAUTH2_TOKEN_URI` env var in `./graphql-server/.env`:
300-
`OAUTH2_TOKEN_URI="http://localhost:8081/realms/zendro/protocol/openid-connect/token"`
301-
* Start
302-
```
303-
$ zendro start -p
304-
```
279+
```
280+
$ zendro start -p
281+
```
305282
> ***Please wait until logs indicate the app is running on XXXX port to access Zendro services.***
306283
307284
In default config, zendro services will be on ports:

0 commit comments

Comments
 (0)