Keycloak
111 строк · 3.0 Кб
1<#import "/templates/guide.adoc" as tmpl>
2
3<@tmpl.guide
4title="OpenShift"
5summary="Get started with {project_name} on OpenShift">
6
7:links-admin-console: {project_name} Admin Console
8:links-account-console: {project_name} Account Console
9
10== Before you start
11
12. Install https://code-ready.github.io/crc/[Red Hat Code Ready Containers] and follow the steps in the documentation to install a
13local OpenShift cluster.
14
15. Make sure the cluster is functional by entering the following command:
16+
17[source,bash,subs="attributes+"]
18----
19crc status
20----
21
22. Look for output similar to the following to confirm the cluster is working.
23+
24[source,subs="attributes+"]
25----
26CRC VM: Running
27OpenShift: Running
28...
29----
30
31. Log in as the user `developer`:
32+
33[source,bash,subs="attributes+"]
34----
35oc login -u developer -p developer
36----
37
38. Create a project called `keycloak` by entering the following command:
39+
40[source,bash,subs="attributes+"]
41----
42oc new-project keycloak
43----
44
45== Start {project_name}
46
47. To start a {project_name} server in your project, enter the following command:
48+
49[source,bash,subs="attributes+"]
50----
51oc process -f https://raw.githubusercontent.com/keycloak/keycloak-quickstarts/latest/openshift/keycloak.yaml \
52-p KEYCLOAK_ADMIN=admin \
53-p KEYCLOAK_ADMIN_PASSWORD=admin \
54-p NAMESPACE=keycloak \
55| oc create -f -
56----
57+
58In this example, the user name and password are `admin`.
59
60. Once the command above completes, look for a message similar to this:
61+
62[source,bash,subs="attributes+"]
63----
64service/keycloak created
65route.route.openshift.io/keycloak created
66deploymentconfig.apps.openshift.io/keycloak created.
67----
68+
69At this point, OpenShift will provision a {project_name} pod and related resources. As part of the process, OpenShift will
70try to pull the {project_name} server image. This operation might take some time depending on your network connection.
71
72. To make sure {project_name} is provisioned, execute the following command:
73+
74[source,bash,subs="attributes+"]
75----
76oc get pods
77----
78
79. After a while, look for a message similar to the following; it indicates the pod is ready:
80+
81[source,bash,subs="attributes+"]
82----
83NAME READY STATUS RESTARTS AGE
84keycloak-1-deploy 0/1 Completed 0 1h
85keycloak-1-l9kdx 1/1 Running 0 1h
86----
87
88. Once the server is provisioned, enter the following command to find out the {project_name} URLs:
89+
90[source,bash,subs="attributes+"]
91----
92KEYCLOAK_URL=https://$(oc get route keycloak --template='{{ .spec.host }}') &&
93echo "" &&
94echo "{project_name}: $KEYCLOAK_URL" &&
95echo "{project_name} Admin Console: $KEYCLOAK_URL/admin" &&
96echo "{project_name} Account Console: $KEYCLOAK_URL/realms/myrealm/account" &&
97echo ""
98----
99
100Remember these URLs as you will need them throughout this {section}. The URL for the account console won't work
101right now as you will need to create the realm first.
102
103include::templates/realm-config.adoc[]
104
105include::templates/login-to-account.adoc[]
106
107include::templates/first-app.adoc[]
108
109include::templates/next.adoc[]
110
111</@tmpl.guide>
112