Skip to content

Commit 0331d84

Browse files
authored
Adjust default env values for mit-learn (#2235)
1 parent baae86a commit 0331d84

File tree

5 files changed

+44
-29
lines changed

5 files changed

+44
-29
lines changed

README-keycloak.md

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,21 @@ the secret in the admin.
3232
## Making it Work
3333

3434
The Keycloak instance is part of the `keycloak` profile in the Composer file, so
35-
if you want to interact with it, you'll need to run
36-
`COMPOSE_PROFILES=backend,frontend,keycloak,apisix docker compose up`. (If you
35+
be sure that you have the following set in your .env file:
36+
`COMPOSE_PROFILES=backend,frontend,keycloak,apisix`. (If you
3737
start the app without the profile, you can still start Keycloak later by
3838
specifying the profile.)
3939

40-
If you want to use the Keycloak and APISIX instances, follow these steps:
41-
42-
1. Change the value of `MITOL_API_BASE_URL` to `http://api.open.odl.local:8065`
43-
in your `shared.local.env` file.
44-
2. Add `MITOL_NEW_USER_LOGIN_URL=http://open.odl.local:8062/onboarding` to your
45-
`shared.local.env` file
46-
3. Copy all the env values under the "# APISIX/Keycloak " section of
47-
`backend.local.example.env` to your `backend.local.env` file. You can leave
48-
all the values as is. Remove `DISABLE_APISIX_USER_MIDDLEWARE=False` if
49-
present in your backend.local.env file.
50-
4. Keycloak needs to create its own database, which will only happen if you
51-
first destroy your current mit-learn database container:
52-
`docker compose down db`. If you prefer not to do this, you can manually
53-
create it by running the SQL in `config/postgres/init-keycloak.sql` in a
54-
postgres shell.
55-
5. Start containers with the command
56-
`COMPOSE_PROFILES=backend,frontend,keycloak,apisix docker compose up`
57-
58-
The Keycloak and APISIX containers should start up and stay running. APISIX is
59-
on port 8065, Keycloak on port 8066. Now you should be able to log in at
40+
When you run `docker compose up`, the Keycloak and APISIX containers should start up.
41+
APISIX is on port 8065, Keycloak on port 8066. Now you should be able to log in at
6042
`https://open.odl.local:8065/login` with one of the users mentioned above, or
6143
just click "Log in" from the home page at http://open.odl.local:8062. Try
6244
logging out and back in a couple times to make sure it works.
45+
46+
Keycloak is enabled by default. If you do NOT want to use the Keycloak and APISIX instances,
47+
follow these steps:
48+
49+
1. Change the value of `MITOL_API_BASE_URL` to `http://api.open.odl.local:8063`
50+
in your `shared.local.env` file.
51+
2. Add `DISABLE_APISIX_USER_MIDDLEWARE=True` to your `backend.local.env` file
52+
3. Set `COMPOSE_PROFILES=backend,frontend` in your .env file

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The following settings must be configured before running the app:
3434

3535
- `COMPOSE_PROFILES`
3636

37-
Controls which docker containers run. To run them all, use `COMPOSE_PROFILES=backend,frontend`. See [Frontend Development](./frontends/README.md) for more.
37+
Controls which docker containers run. To run them all, use `COMPOSE_PROFILES=backend,frontend,keycloak,apisix`. See [Frontend Development](./frontends/README.md) for more.
3838
This can be set either in a top-level `.env` that `docker compose` [automatically ingests](https://docs.docker.com/compose/environment-variables/envvars/#compose_env_files) or through any other method of setting an environment variable in your shell (e.g. `direnv`).
3939

4040
- `MAILGUN_KEY` and `MAILGUN_SENDER_DOMAIN`

env/backend.env

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,28 @@ UWSGI_THREADS=35
3636

3737
TIKA_SERVER_ENDPOINT=http://tika:9998/
3838
TIKA_CLIENT_ONLY=True
39+
40+
# APISIX/Keycloak settings
41+
APISIX_LOGOUT_URL=http://api.open.odl.local:8065/logout/
42+
APISIX_SESSION_SECRET_KEY=supertopsecret1234
43+
KC_SPI_THEME_WELCOME_THEME=scim
44+
KC_SPI_REALM_RESTAPI_EXTENSION_SCIM_LICENSE_KEY=
45+
KEYCLOAK_BASE_URL=http://kc.ol.local:8066
46+
KEYCLOAK_CLIENT_ID=apisix
47+
# This is not a secret. This is for the Keycloak container, only for local use.
48+
KEYCLOAK_CLIENT_SECRET=HckCZXToXfaetbBx0Fo3xbjnC468oMi4 # pragma: allowlist-secret
49+
KEYCLOAK_DISCOVERY_URL=http://kc.ol.local:8066/realms/ol-local/.well-known/openid-configuration
50+
KEYCLOAK_REALM_NAME=ol-local
51+
KEYCLOAK_SCOPES="openid profile ol-profile"
52+
KEYCLOAK_SVC_KEYSTORE_PASSWORD=supertopsecret1234
53+
KEYCLOAK_SVC_HOSTNAME=kc.ol.local
54+
KEYCLOAK_SVC_ADMIN=admin
55+
KEYCLOAK_SVC_ADMIN_PASSWORD=admin
56+
AUTHORIZATION_URL=http://kc.ol.local:8066/realms/ol-local/protocol/openid-connect/auth
57+
ACCESS_TOKEN_URL=http://kc.ol.local:8066/realms/ol-local/protocol/openid-connect/token
58+
OIDC_ENDPOINT=http://kc.ol.local:8066/realms/ol-local
59+
SOCIAL_AUTH_OL_OIDC_OIDC_ENDPOINT=http://kc.ol.local:8066/realms/ol-local
60+
SOCIAL_AUTH_OL_OIDC_KEY=apisix
61+
# This is not a secret. This is for the Keycloak container, only for local use.
62+
SOCIAL_AUTH_OL_OIDC_SECRET=HckCZXToXfaetbBx0Fo3xbjnC468oMi4 # pragma: allowlist-secret
63+
USERINFO_URL=http://kc.ol.local:8066/realms/ol-local/protocol/openid-connect/userinfo

env/shared.env

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
MITOL_NEW_USER_LOGIN_URL=http://open.odl.local:8062/onboarding
2+
MITOL_API_LOGOUT_SUFFIX=logout
13
MITOL_APP_BASE_URL=http://open.odl.local:8062
2-
3-
# Without apisix and keycloak
4-
MITOL_API_BASE_URL=http://api.open.odl.local:8063
5-
# With apisix and keycloak
6-
#MITOL_API_BASE_URL=http://api.open.odl.local:8065
4+
# With apisix and keycloak, use port 8065
5+
MITOL_API_BASE_URL=http://api.open.odl.local:8065
76

87
MITOL_SUPPORT_EMAIL=support@localhost
98
CSRF_COOKIE_NAME=csrftoken-local

env/shared.local.example.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
# POSTHOG_PROJECT_API_KEY=
44
# POSTHOG_TIMEOUT_MS=1500
55
# EMBEDLY_KEY=
6-
MITOL_NEW_USER_LOGIN_URL=http://open.odl.local:8062/onboarding
6+
# Use port 8063 if apisix/keycloak disabled
7+
MITOL_API_BASE_URL=http://api.open.odl.local:8063

0 commit comments

Comments
 (0)