You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+66-34Lines changed: 66 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ All APIs are protected by an OIDC JWT Token with the following claims:
18
18
| -------- | ----------- | ------- |
19
19
|`PORT`| Port |`2000`|
20
20
|`LOG_LEVEL`| Log level for the application |`INFO`|
21
-
|`ENVIRONMENT`| Indicates what environment config to use |`production`|
21
+
|`ENVIRONMENT`| Indicates what environment config to use (development|test|production) |`production`|
22
22
|`CONFIG_PATH`| Location of the config |`/tmp/production.json`|
23
23
| `OIDC_BASE_URL` | Base url used for OIDC Discovery for getting the `jwks_uri` for the list of supported keys. | `https://keycloak.domain/auth/realms/abc`
24
24
| `TOKEN_MATCH_AUD` | The `audience` that the token must match. | `gwa`
@@ -31,6 +31,9 @@ All APIs are protected by an OIDC JWT Token with the following claims:
31
31
| `KC_USER_REALM` | Keycloak access for administrative rights to manage groups for namespaces | `master`
32
32
| `KC_USERNAME` | Keycloak access for administrative rights to manage groups for namespaces | `kcadmin`
33
33
| `KC_PASSWORD` | Keycloak access for administrative rights to manage groups for namespaces | `xxx`
34
+
| `HOST_TRANSFORM_ENABLED` | For Dev and Test a way to transform the host for working in these environments | `false`
35
+
|`HOST_TRANSFORM_BASE_URL`| For Dev and Test a way to transform the host for working in these environments |
36
+
34
37
35
38
## Gateway API
36
39
@@ -59,7 +62,7 @@ access: read, write
59
62
60
63
A `namespace` represents a collections of Kong Services and Routes that are managed independently.
61
64
62
-
To create a new namespace, go to the <ahref="https://gwa-qwzrwc-dev.pathfinder.gov.bc.ca/int"target="_blank">API Services Portal</a>.
65
+
To create a new namespace, go to the <ahref="https://gwa-qwzrwc-test.pathfinder.gov.bc.ca/int"target="_blank">API Services Portal</a>.
63
66
64
67
After login and selection of an existing namespace, go to the `New Namespace` tab and click the `Create Namespace` button.
65
68
@@ -72,31 +75,23 @@ Logout by clicking your username at the top right of the page. When you login a
72
75
Go to the `Service Accounts` tab and click the `Create Service Account`. A new credential will be created - make a note of the `ID` and `Secret`.
73
76
74
77
With scopes:
75
-
* admin:gateway
76
-
* admin:acl
77
-
* admin:catalog
78
-
79
-
## 3. Prepare and apply gateway configuration
80
-
81
-
The Swagger console for the `gwa-api` can be used to publish Kong Gateway configuration, or the `gwa-cli` can be used.
82
-
83
-
### Swagger Console
78
+
*`admin:gateway` : Permission to publish gateway configuration to Kong
79
+
*`admin:acl` : Permission to update the Access Control List for controlling access to viewing metrics, service configuration and service account management
80
+
*`admin:catalog` : Permission to update BC Data Catalog datasets for describing APIs available for consumption
84
81
85
-
Go to <ahref="https://gwa-api-qwzrwc-dev.pathfinder.gov.bc.ca/api/doc"target="_blank">gwa-api Swagger Console</a>.
82
+
## 3. Prepare configuration
86
83
87
-
Select the `PUT``/namespaces/{namespace}/gateway` API.
84
+
The gateway configuration can be hand-crafted or you can use the `gwa``new` command to walk you through the creation of the config.
88
85
89
-
The Service Account uses the OAuth2 Client Credentials Grant Flow. Click the `lock` link on the right and enter in the Service Account credentials that were generated in step #2.
90
-
91
-
For the `Parameter namespace`, enter the namespace that you created in step #1.
86
+
To view a list of available plugins, you can run: `gwa plugins`.
92
87
93
-
Select `dryRun` to `true`.
88
+
To view examples go [here](/docs/samples/service-plugins).
94
89
95
-
Select a `configFile` file. An example of a very minimal config is:
90
+
**Simple Example**
96
91
97
92
```
98
93
export NS="my_namespace"
99
-
export NAME="some-service-name-$NS"
94
+
export NAME="a-service-for-$NS"
100
95
echo "
101
96
services:
102
97
- name: $NAME
@@ -109,16 +104,39 @@ services:
109
104
- name: $NAME-route
110
105
tags: [ ns.$NS ]
111
106
hosts:
112
-
- $NAME.api.333223.xyz
107
+
- $NAME.api.189768.xyz
113
108
paths:
114
109
- /
115
110
strip_path: false
116
111
https_redirect_status_code: 426
117
112
path_handling: v0
118
113
" > sample.yaml
119
-
120
114
```
121
115
116
+
**gwa CLI Example**
117
+
118
+
Run: `gwa new` and follow the prompts.
119
+
120
+
## 4. Apply gateway configuration
121
+
122
+
The Swagger console for the `gwa-api` can be used to publish Kong Gateway configuration, or the `gwa-cli` can be used.
123
+
124
+
### Swagger Console
125
+
126
+
Go to <ahref="https://gwa-api-qwzrwc-test.pathfinder.gov.bc.ca/api/doc"target="_blank">gwa-api Swagger Console</a>.
127
+
128
+
Select the `PUT``/namespaces/{namespace}/gateway` API.
129
+
130
+
The Service Account uses the OAuth2 Client Credentials Grant Flow. Click the `lock` link on the right and enter in the Service Account credentials that were generated in step #2.
131
+
132
+
For the `Parameter namespace`, enter the namespace that you created in step #1.
133
+
134
+
Select `dryRun` to `true`.
135
+
136
+
Select a `configFile` file.
137
+
138
+
Send the request.
139
+
122
140
### Command Line
123
141
124
142
**Install**
@@ -131,42 +149,56 @@ npm run build
131
149
npm link
132
150
```
133
151
152
+
**Configure**
153
+
134
154
Create a `.env` file and update the CLIENT_ID and CLIENT_SECRET with the new credentials that were generated in step #2:
gwa init -T --namespace=$NS --client-id=<YOUR SERVICE ACCOUNT ID> --client-secret=<YOUR SERVICE ACCOUNT SECRET>
167
+
143
168
```
144
169
170
+
**Publish**
171
+
145
172
```
146
-
gwa pg --namespace $NS sample.yaml
173
+
gwa pg sample.yaml
147
174
```
148
175
149
-
## 4. Verify routes
176
+
## 5. Verify routes
150
177
151
178
```
152
-
curl https://$NAME.api.333223.xyz/headers
179
+
curl https://$NAME.api.189768.xyz/headers
180
+
181
+
ab -n 20 -c 2 https://$NAME.api.189768.xyz/headers
182
+
153
183
```
154
184
155
-
## 5. View metrics
185
+
## 6. View metrics
156
186
157
-
Go to <ahref="https://grafana-qwzrwc-dev.pathfinder.gov.bc.ca/"target="_blank">Grafana</a> to view metrics for your configured services.
187
+
Go to <ahref="https://grafana-qwzrwc-test.pathfinder.gov.bc.ca/"target="_blank">Grafana</a> to view metrics for your configured services.
158
188
159
189
160
-
## 6. Grant access to others
190
+
## 7. Grant access to others
161
191
162
192
The `acl` command is an all-inclusive membership list, so the `--users` should have the full list of members. Any user that is a member but not in the `--users` list will be removed from the namespace.
163
193
194
+
For administrative privileges (such as managing Service Accounts), add the usernames to the `--managers` argument.
0 commit comments