diff --git a/blog_tags.json b/blog_tags.json index 7f07f1495..d0e47ec5c 100644 --- a/blog_tags.json +++ b/blog_tags.json @@ -2,7 +2,8 @@ "blog_tags": [ { "name": "announcements", - "posts": ["liberty-developer-essentials-badge", "24.0.0.8-beta", + "posts": ["liberty-developer-essentials-badge", + "24.0.0.8", "24.0.0.8-beta", "24.0.0.7", "24.0.0.7-beta", "24.0.0.6", "24.0.0.6-beta", "24.0.0.5", "24.0.0.5-beta", @@ -81,7 +82,8 @@ "featured": "true" },{ "name": "microprofile", - "posts": ["liberty-developer-essentials-badge", + "posts": ["liberty-on-amazon-ecs", + "24.0.0.8", "liberty-developer-essentials-badge", "24.0.0.8-beta", "24.0.0.7", "24.0.0.7-beta", "24.0.0.6-beta", "24.0.0.4", "open-liberty-with-langchain4j-example", @@ -164,7 +166,7 @@ }, { "name": "release", - "posts": ["24.0.0.8-beta", + "posts": ["24.0.0.8", "24.0.0.8-beta", "24.0.0.7", "24.0.0.7-beta", "24.0.0.6", "24.0.0.6-beta", "24.0.0.5", "24.0.0.5-beta", @@ -256,7 +258,8 @@ }, { "name": "maven", - "posts": ["liberty-developer-essentials-badge", "liberty-user-feature-tutorial", + "posts": ["liberty-on-amazon-ecs", + "liberty-developer-essentials-badge", "liberty-user-feature-tutorial", "liberty-project-starter-guide-IntelliJ", "23.0.0.12", "liberty-ide-tools-maven-gradle-plugins-for-java-developers", "23.0.0.6", "liberty-tools-eclipse-deep-dive", @@ -310,7 +313,7 @@ }, { "name": "docker", - "posts": ["spring-boot-3", + "posts": ["liberty-on-amazon-ecs","spring-boot-3", "testcontainers-guide", "23.0.0.6", "23.0.0.4", "23.0.0.2-beta", "using-liberty-buildpack-on-azure-and-google-cloud", "22.0.0.11-beta", @@ -358,7 +361,7 @@ }, { "name": "jakarta-ee", - "posts": ["liberty-developer-essentials-badge", + "posts": ["24.0.0.8", "liberty-developer-essentials-badge", "24.0.0.8-beta", "24.0.0.7-beta", "24.0.0.6-beta", "simplifying-nosql-database-integration-with-jakarta-nosql", "jakarta-nosql-in-action-meet-jnopo-game", @@ -461,7 +464,8 @@ }, { "name": "developer-experience", - "posts": ["liberty-developer-essentials-badge", "24.0.0.8-beta", + "posts": ["liberty-on-amazon-ecs","24.0.0.8", + "liberty-developer-essentials-badge", "24.0.0.8-beta", "24.0.0.7", "liberty-user-feature-tutorial", "liberty-project-starter-guide-IntelliJ", "simplifying-nosql-database-integration-with-jakarta-nosql", "jakarta-nosql-in-action-meet-jnopo-game", "jakarta-nosql-challenge-switching-nosql-easily", @@ -523,7 +527,7 @@ }, { "name": "monitoring", - "posts": ["24.0.0.8-beta", + "posts": ["24.0.0.8", "24.0.0.8-beta", "24.0.0.7-beta", "24.0.0.3", "Primeur", "23.0.0.3", "tracing-with-microprofile-telemetry", "separate-stack-trace-22008", @@ -543,7 +547,7 @@ }, { "name": "performance-enhancements", - "posts": ["virtual-threads-case-study", + "posts": ["liberty-on-amazon-ecs","virtual-threads-case-study", "24.0.0.6", "24.0.0.3", "Java21-Images", "24.0.0.1", "23.0.0.10-beta", "23.0.0.6", @@ -590,7 +594,7 @@ }, { "name": "java-ee", - "posts": ["24.0.0.8-beta", + "posts": ["24.0.0.8", "24.0.0.8-beta", "history-maker-projects", "space-sentry-challenge", "jakarta-ee-9.1-210012", "KevinSutter_MeetTheTeam", "jakarta-ee-9-1-compatibility", "testing-jakarta-Arquillian-redirect", diff --git a/img/blog/amazon-ec2-target-group-creation.png b/img/blog/amazon-ec2-target-group-creation.png new file mode 100644 index 000000000..af8eadcb7 Binary files /dev/null and b/img/blog/amazon-ec2-target-group-creation.png differ diff --git a/img/blog/amazon-ecs-openliberty-task-definition-environment.png b/img/blog/amazon-ecs-openliberty-task-definition-environment.png new file mode 100644 index 000000000..5be67ec3d Binary files /dev/null and b/img/blog/amazon-ecs-openliberty-task-definition-environment.png differ diff --git a/img/blog/amazon-ecs-openliberty-task-definition.png b/img/blog/amazon-ecs-openliberty-task-definition.png new file mode 100644 index 000000000..e9e456888 Binary files /dev/null and b/img/blog/amazon-ecs-openliberty-task-definition.png differ diff --git a/img/blog/amazon_ecs_hosted_page.png b/img/blog/amazon_ecs_hosted_page.png new file mode 100644 index 000000000..f994c9f9c Binary files /dev/null and b/img/blog/amazon_ecs_hosted_page.png differ diff --git a/img/blog/amazon_ecs_scaled_instances.png b/img/blog/amazon_ecs_scaled_instances.png new file mode 100644 index 000000000..b9208f2f4 Binary files /dev/null and b/img/blog/amazon_ecs_scaled_instances.png differ diff --git a/img/blog/amazon_ecs_scaling_policy.png b/img/blog/amazon_ecs_scaling_policy.png new file mode 100644 index 000000000..1af81cd45 Binary files /dev/null and b/img/blog/amazon_ecs_scaling_policy.png differ diff --git a/img/blog/amazon_ecs_service_health.png b/img/blog/amazon_ecs_service_health.png new file mode 100644 index 000000000..30e45441a Binary files /dev/null and b/img/blog/amazon_ecs_service_health.png differ diff --git a/posts/2024-06-18-24.0.0.6.adoc b/posts/2024-06-18-24.0.0.6.adoc index 8df05a043..155ef7643 100644 --- a/posts/2024-06-18-24.0.0.6.adoc +++ b/posts/2024-06-18-24.0.0.6.adoc @@ -10,6 +10,9 @@ seo-description: The 24.0.0.6 release introduces the Coordinated Restore at Chec blog_description: The 24.0.0.6 release introduces the Coordinated Restore at Checkpoint feature, which improves startup times for Spring Boot 3.x applications with Liberty InstantOn. This release also includes InstantOn support for applications that use distributed HTTP session caching and IBM MQ messaging. open-graph-image: https://openliberty.io/img/twitter_card.jpg open-graph-image-alt: Open Liberty Logo +blog-available-in-languages: +- lang: ja + path: /ja/blog/2024/06/18/24.0.0.6.html --- = Faster startup for Spring Boot 3.x applications and more in 24.0.0.6 David Mueller diff --git a/posts/2024-08-13-24.0.0.8.adoc b/posts/2024-08-13-24.0.0.8.adoc new file mode 100644 index 000000000..2e23b53e0 --- /dev/null +++ b/posts/2024-08-13-24.0.0.8.adoc @@ -0,0 +1,193 @@ +--- +layout: post +title: "Simplify your configuration with versionless features in 24.0.0.8" +# Do NOT change the categories section +categories: blog +author_picture: https://avatars3.githubusercontent.com/dmuelle +author_github: https://github.com/dmuelle +seo-title: Simplify your configuration with versionless features in 24.0.0.8 - OpenLiberty.io +seo-description: This release introduces versionless features for the Jakarta EE, Java EE, and MicroProfile platforms. It also includes updates to eliminate unnecessary audit records. +blog_description: This release introduces versionless features for the Jakarta EE, Java EE, and MicroProfile platforms. It also includes updates to eliminate unnecessary audit records. +open-graph-image: https://openliberty.io/img/twitter_card.jpg +open-graph-image-alt: Open Liberty Logo +--- += Simplify your configuration with versionless features in 24.0.0.8 +David Mueller +:imagesdir: / +:url-prefix: +:url-about: / +//Blank line here is necessary before starting the body of the post. + +This release introduces versionless features for the Jakarta EE, Java EE, and MicroProfile platforms. It also includes updates to eliminate unnecessary audit records. + + +In link:{url-about}[Open Liberty] 24.0.0.8: + +* <> +* <> + + + +// // // // // // // // +// If there were updates to guides since last release, keep the following, otherwise remove section. +// // // // // // // // +Along with the new features and functions added to the runtime, we’ve also <>. + +// // // // // // // // +// In the preceding section: +// Replace the TAG_X with a short label for the feature in lower-case, eg: mp3 +// Replace the FEATURE_1_HEADING with heading the feature section, eg: MicroProfile 3.3 +// Where the updates are grouped as sub-headings under a single heading +// (eg all the features in a MicroProfile release), provide sub-entries in the list; +// eg replace SUB_TAG_1 with mpr, and SUB_FEATURE_1_HEADING with +// Easily determine HTTP headers on outgoing requests (MicroProfile Rest Client 1.4) +// // // // // // // // + +View the list of fixed bugs in link:https://github.com/OpenLiberty/open-liberty/issues?q=label%3Arelease%3A24008+label%3A%22release+bug%22[24.0.0.8]. + +Check out link:{url-prefix}/blog/?search=release&search!=beta[previous Open Liberty GA release blog posts]. + + +[#run] + +// // // // // // // // +// LINKS +// +// OpenLiberty.io site links: +// link:{url-prefix}/guides/maven-intro.html[Maven] +// +// Off-site links: +//link:https://openapi-generator.tech/docs/installation#jar[Download Instructions] +// +// IMAGES +// +// Place images in ./img/blog/ +// Use the syntax: +// image::/img/blog/log4j-rhocp-diagrams/current-problem.png[Logging problem diagram,width=70%,align="center"] +// // // // // // // // + +== Develop and run your apps using 24.0.0.8 + +If you're using link:{url-prefix}/guides/maven-intro.html[Maven], include the following in your `pom.xml` file: + +[source,xml] +---- + + io.openliberty.tools + liberty-maven-plugin + 3.10.3 + +---- + +Or for link:{url-prefix}/guides/gradle-intro.html[Gradle], include the following in your `build.gradle` file: + +[source,gradle] +---- +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'io.openliberty.tools:liberty-gradle-plugin:3.8.3' + } +} +apply plugin: 'liberty' +---- +// // // // // // // // +// In the preceding section: +// Replace the Maven `3.8.2` with the latest version of the plugin: https://search.maven.org/artifact/io.openliberty.tools/liberty-maven-plugin +// Replace the Gradle `3.6.2` with the latest version of the plugin: https://search.maven.org/artifact/io.openliberty.tools/liberty-gradle-plugin +// TODO: Update GHA to automatically do the above. If the maven.org is problematic, then could fallback to using the GH Releases for the plugins +// // // // // // // // + +Or if you're using link:{url-prefix}/docs/latest/container-images.html[container images]: + +[source] +---- +FROM icr.io/appcafe/open-liberty +---- + +Or take a look at our link:{url-prefix}/start/[Downloads page]. + +If you're using link:https://plugins.jetbrains.com/plugin/14856-liberty-tools[IntelliJ IDEA], link:https://marketplace.visualstudio.com/items?itemName=Open-Liberty.liberty-dev-vscode-ext[Visual Studio Code] or link:https://marketplace.eclipse.org/content/liberty-tools[Eclipse IDE], you can also take advantage of our open source link:https://openliberty.io/docs/latest/develop-liberty-tools.html[Liberty developer tools] to enable effective development, testing, debugging and application management all from within your IDE. + +[link=https://stackoverflow.com/tags/open-liberty] +image::img/blog/blog_btn_stack.svg[Ask a question on Stack Overflow, align="center"] + + + +[#versionless] +== Streamline feature selection with versionless Jakarta EE, Java EE, and MicroProfile features + +With Open Liberty, you configure only the features at the specific versions that your application needs. This composable design pattern minimizes runtime resource requirements and accelerates application startup times. However, you might not always know which version of a feature is compatible with the rest of your application configuration. In previous releases, determining the correct version typically required a mix of experimentation, guesswork, and digging deep into feature documentation. In 24.0.0.8 and later, versionless features automate version selection, enabling you to focus on application development without worrying about compatibility issues. + +For example, instead of specifying `servlet-6.0` in your `server.xml` file and having to figure out which other feature versions are compatible with Servlet 6.0, you can specify a platform version and `servlet`. The platform that you specify resolves all versionless features to a compatible version. + +The following `server.xml` file configuration uses a Java EE platform of `javaee-8.0` with associated versionless features that are defined for `servlet`, `jpa`, and `jaxrs`: + +[source,xml] +---- + + + javaee-8.0 + servlet + jpa + jaxrs + +---- + +This example enables versionless MicroProfile features with `microProfile-5.0` specified as the platform element: + +[source,xml] +---- + + + microProfile-5.0 + mpHealth + mpMetrics + +---- + +Learn more and check out the full collection of available platforms and versionless features in the link:{url-prefix}/docs/latest/reference/feature/versionless-features.html[Open Liberty docs]. Stay tuned for more versionless features and platforms in future releases. + +// // // // DO NOT MODIFY THIS COMMENT BLOCK // // // // +// Blog issue: https://github.com/OpenLiberty/open-liberty/issues/29211 +// Contact/Reviewer: wrodrig +// // // // // // // // + +[#audit] +== Use the Audit 2.0 feature to avoid generating unnecessary REST Handler records + +The 24.0.0.8 release introduces the link:{url-prefix}/docs/latest/reference/feature/audit-2.0.html[Audit 2.0 feature] (`audit-2.0`). The feature is designed for users who are not using REST Handler applications. +It provides the same audit records as the Audit 1.0 feature (`audit-1.0`) but it does not generate records for REST Handler applications. + +If you need to keep audit records for REST Handler applications, you can continue to use the Audit 1.0 feature. + +To enable the Audit 2.0 feature in your application, add the following code to your `server.xml` file: + +[source,xml] +---- + + audit-2.0 + +---- + + +// DO NOT MODIFY THIS LINE. + +// // // // DO NOT MODIFY THIS COMMENT BLOCK // // // // +// Blog issue: https://github.com/OpenLiberty/open-liberty/issues/29185 +// Contact/Reviewer: gkwan-ibm +// // // // // // // / + +[#guides] +== New guide: Externalizing environment-specific microservice configuration for CI/CD + +A new guide is available under the link:https://openliberty.io/guides/#configuration[Configuration] category: link:https://openliberty.io/guides/microprofile-config-profile.html[Externalizing environment-specific microservice configuration for CI/CD]. You'll learn how to use MicroProfile Config's configuration profiles to externalize configurations for different phases of the CI/CD lifecycle. + +// DO NOT MODIFY THIS LINE. + + +== Get Open Liberty 24.0.0.8 now + +Available through <>. diff --git a/posts/2024-08-14-liberty-on-amazon-ecs.adoc b/posts/2024-08-14-liberty-on-amazon-ecs.adoc new file mode 100644 index 000000000..b9aac82fe --- /dev/null +++ b/posts/2024-08-14-liberty-on-amazon-ecs.adoc @@ -0,0 +1,212 @@ +--- +layout: post +title: "Running Open Liberty on Amazon Elastic Container Service with AWS Fargate" +# Do NOT change the categories section +categories: blog +author_picture: https://avatars3.githubusercontent.com/abutch3r +author_github: https://github.com/abutch3r +seo-title: Running Open Liberty on Amazon Elastic Container Service with AWS Fargate - OpenLiberty.io +seo-description: How to run Open Liberty in Amazon Elastic Container Service with AWS Fargate +blog_description: "How to run Open Liberty in Amazon Elastic Container Service with AWS Fargate" +open-graph-image: https://openliberty.io/img/twitter_card.jpg +open-graph-image-alt: Open Liberty Logo +additional_authors: +- name: Grace Jansen + github: https://github.com/GraceJansen + image: https://avatars0.githubusercontent.com/GraceJansen +--- += Running Open Liberty on Amazon Elastic Container Service with AWS Fargate +Alex Butcher +:imagesdir: / +:url-prefix: +:url-about: / + +Pay-as you-go serverless applications can rapidly scale according to workload with minimal resource costs. link:https://aws.amazon.com/ecs/[Amazon Elastic Container Service (Amazon ECS)] with link:https://aws.amazon.com/fargate/[AWS Fargate], a link:https://www.ibm.com/topics/containers-as-a-service[Container as a Service (CaaS)] offering, provides a fully-managed container orchestration service to help you easily deploy, manage, and scale containerized applications in a serverless manner. This post describes how to run serverless MicroProfile applications in Amazon ECS in just 10 steps: + +* <> +* <> +* <> +* <> +* <> +* <> +* <> +* <> +* <> +* <> + +== Deploying an Open Liberty Container to Amazon ECS + +=== Step 1: Ensure you have the correct pre-requisites +To run a MicroProfile application on Amazon ECS, we need to be able to create AWS resources and have an application to run. Ensure you have the following prerequisites: + +* An link:https://aws.amazon.com/[AWS] Administrator account +* link:https://www.docker.com/[Docker] +* link:https://git-scm.com/book/en/v2/Getting-Started-The-Command-Line[Git CLI] +* link:https://maven.apache.org/[Maven] +* An externally accessible container registry that can host your images, such as link:https://aws.amazon.com/ecr/[Amazon Elastic Container Registry (Amazon ECR)] or link:https://docs.docker.com/docker-hub/[Dockerhub]. + +=== Step 2: Ensure you have a suitable containerized application +If you don't already have a MicroProfile application, you can use the application provided in the `finish` directory of the Open Liberty link:https://github.com/OpenLiberty/guide-getting-started/tree/prod/finish[Getting Started guide]. A publicly accessible copy of the containerized application is available from: `icr.io/appcafe/open-liberty/samples/getting-started`. + +=== Step 3: Upload the container to a registry +Upload the `guide-getting-started` image (or your own containerized application) to an internet accessible container registry. Amazon ECS supports a range of container registries outlined in their https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definition_image[Image Registry requirements]. As this blog requires an AWS account, you most likely already have access to link:https://aws.amazon.com/ecr/[Amazon ECR] to act as your registry. To upload the image, use the https://docs.aws.amazon.com/AmazonECR/latest/userguide/getting-started-console.html[Get Started] instructions for Amazon ECR. + +=== Step 4: Create your Amazon ECS Cluster +To create your Amazon ECS cluster, follow step 1 in https://docs.aws.amazon.com/AmazonECS/latest/developerguide/getting-started-fargate.html[Getting started with the console using Linux containers on AWS Fargate]. + +=== Step 5: Create your Task Definition using JSON +Amazon ECS runs services or jobs, using https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html[task definitions] to define the runtime configuration for the task. Task definitions define the following properties: + +* container image URL +* CPU & memory +* port mappings +* environment variables +* compatibilities. + +The values of these properties cannot be overridden by the service or job definition that executes said task definition. For example, if the same task definition is used in development and production deployments, then they use the same amount of CPU. As such, it is recommended that you define separate task definitions for each environment. + +You can create a task definition using the UI or by uploading a JSON file. For this post, the JSON is provided in the following example. To apply this example, create a new task definition follow Step 2 in https://docs.aws.amazon.com/AmazonECS/latest/developerguide/getting-started-fargate.html[Getting started with the console using Linux containers on AWS Fargate]. Before applying, ensure that the `logConfiguration.options.awslogs-region` setting matches the region you are planning on deploying into. + +[source] +---- +{ + "family": "ol-getting-started-blog", + "containerDefinitions": [ + { + "name": "open-liberty-getting-started", + "image": "icr.io/appcafe/open-liberty/samples/getting-started", + "cpu": 512, + "memory": 1024, + "portMappings": [ + { + "name": "liberty-getting-started-80-tcp", + "containerPort": 80, + "hostPort": 80, + "protocol": "tcp", + "appProtocol": "http" + }, + { + "name": "liberty-getting-started-443-tcp", + "containerPort": 443, + "hostPort": 443, + "protocol": "tcp", + "appProtocol": "http" + } + ], + "essential": true, + "environment": [ + { + "name": "default.http.port", + "value": "80" + }, + { + "name": "default.https.port", + "value": "443" + } + ], + "environmentFiles": [], + "mountPoints": [], + "volumesFrom": [], + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-create-group": "true", + "awslogs-group": "/ecs/ol-getting-started-demo", + "awslogs-region": "us-east-1", + "awslogs-stream-prefix": "ecs" + } + } + } + ], + "executionRoleArn": "", + "networkMode": "awsvpc", + "requiresCompatibilities": [ + "FARGATE" + ], + "cpu": "512", + "memory": "1024", + "runtimePlatform": { + "cpuArchitecture": "X86_64", + "operatingSystemFamily": "LINUX" + } +} +---- + +The provided JSON helps to highlight key aspects that are important when defining task definitions. By default, Open Liberty exposes ports 9080 and 9443 for HTTP and HTTPS traffic respectively. The `server.xml` exposes two variables that allow the overriding of the default port values: `default.http.port` and `default.https.port`. By setting the environment variables to 80 and 443 respectively, the service is exposed on those ports instead. + +Now that we have a task definition set up, the next step is to create a service that uses this definition. + +=== Step 6: Create the service +For the purposes of this blog you'll create a service that uses HTTP. + +.To Create the service +. In the Amazon ECS Service, under **Clusters**, select the cluster you created earlier. +. Under the **Services** tab for this cluster, click **Create**. +. Under **Environment**, update **Compute Options** from `Capacity provider strategy` to `Launch Type` and ensure **Launch Type** is `Fargate`. +. Under **Deployment Configuration**, set the value for **Family** to the task definition created earlier, provide the service a name (e.g. `ol-getting-started-service-1`) and set the desired count to `0`. This setting prevents the immediate starting of the service until you are ready. +. Under **Networking**, leave VPC and subnets as is. Select **Create a new security group** and within this set the type to `HTTP` and set the source to `Anywhere`. +. Under **Load Balancing**: + .. Set **Load balancer type** to `Application Load Balancer`. + .. Select **Create a new load balancer**. + .. Provide a name and check that the mapping corresponds to the HTTP port for the task definition. + .. Select **Create a new listener** and within this set the **Listener** to port 80. + .. Select **Create a new target group** and update the **Health check path**` to use `/health`. The `/health` endpoint is provided by MicroProfile Health and is ideal for reporting health in containerized deployments. +. Click **Create**. + +=== Step 7: Start the service +Now that the service is created with its required assets and the security group is updated so that we can communicate with it, we can start it. To start the service, we need to update it by changing the value of **Desired tasks** to `1`. Remember to click **Save** when you change this setting. This starts an instance of our container in ECS. Once it has reported as running and healthy, we can look at how to access it. + +=== Step 8: Access the service +With the service now running, we can start to make requests against it. The first step = is to get the DNS name for the Load Balancer, which we can get either from the load balancer itself or from the target service. In this post, to keep things simple, we're going to go back to our service to get the DNS name. + +To obtain the DNS name of your Load Balancer from the service, navigate back to your cluster and select your service. Click the **Networking** tab and either copy or click **open address**. + +__Note: If you have exposed the service on the non-protocol port, you must add the port to the URL.__ + +image::/img/blog/amazon_ecs_hosted_page.png[,width=90%,align="center"] + +=== Step 9: Monitor the service + +With the service started, we can start to monitor it using the Amazon ECS tooling and link:https://aws.amazon.com/cloudwatch/[Amazon CloudWatch]. This monitoring data can help enable effective autoscaling that is such a critical component of serverless applications, enabling more efficient resource usage and lower costs. + +For CPU and memory usage, we can access the service definition to see this usage. + +image::/img/blog/amazon_ecs_service_health.png[Amazon ECS Service health ,width=90%,align="center"] + +=== Step 10: Scale the application via auto-scaling policies + +To enable autoscaling, set up scaling policies that can use various metrics to determine whether to scale applications in or out, including metrics collected through monitoring, as we covered previously. A common metric that is used to scale HTTP serverless applications is the number of requests that a service receives over a period of time. This metric is referred to as Application Load Balancer (ALB) requests, and this is what we'll be using for our example application. + +To create an ALB request scaling policy, you can edit the instances scaling policy. Revisit your cluster and select your service. Then select **Update service** and set the **Desired tasks** to `1`. Expand **Service auto scaling** and you'll be presented with a form like the one in the following diagram . + +In this form: + +. Set the minimum number of tasks to `1` and the maximum to `2`. +. Click **+ Add scaling policy**. +. Give your policy a name, e.g. `mp-sp`. +. Set the **ECS service metric** to `ALBRequestCountPerTarget`. +. Set the **Target value** to `2`. +. Set both the **Scale out cooldown** period` and **Scale in cooldown period** to `30`. +. Click **Update**. + +The target value is set to a very low value so that it is easier to cause an alarm to trigger and create new instances. Ensure this value is scoped to the requirements of the application and also that the amount of other resources provided are capable of handling that type of workload. + +image::../img/blog/amazon_ecs_scaling_policy.png[Amazon ECS scaling policy, width=70%,align="center"] + +Having created our policy, we can now test it by attempting to trigger the alarm and cause our service to increase the number of instances available. As our alarm is focused on requests against the ALB, to test it we should invoke our application URL to generate some traffic. Given our alarm requires 3 datapoints above our target threshold in a given period, we just need to invoke it 3 times in the period being measured. After the trigger has been activated, you will see the number of instances scale out, showing that autoscaling is working as expected. + +image::/img/blog/amazon_ecs_scaled_instances.png[Amazon ECS scaled out service,width=90%,align="center"] + +You have now run and scaled your own MicroProfile Application on Amazon ECS with AWS Fargate! + +== Summary: + +Through this post, you've gained an understanding of the steps to take a MicroProfile application running with Open Liberty and effectively scale it with Amazon ECS with AWS Fargate. Continue your learning by checking out some of the following resources. + +== Additional Resources + +* https://aws.amazon.com/ecs/[Amazon Elastic Container Service] +* https://aws.amazon.com/fargate/[AWS Fargate] +* https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html[Amazon ECS Task Definitions] +* https://docs.aws.amazon.com/AmazonECS/latest/bestpracticesguide/intro.html[Amazon ECS Best Practices] +* https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-autoscaling-targettracking.html?icmpid=docs_ecs_hp-deploy-failure-detection[Scale your Amazon ECS service using a target metric value]. diff --git a/posts/ja/2024-06-18-24.0.0.6.adoc b/posts/ja/2024-06-18-24.0.0.6.adoc new file mode 100755 index 000000000..5de04e1f5 --- /dev/null +++ b/posts/ja/2024-06-18-24.0.0.6.adoc @@ -0,0 +1,270 @@ +--- +layout: post +title: "24.0.0.6 での Spring Boot 3.x の起動高速化" +# Do NOT change the categories section +categories: blog +author_picture: https://avatars3.githubusercontent.com/dmuelle +author_github: https://github.com/dmuelle +seo-title: 24.0.0.6 での Spring Boot 3.x の起動高速化 - OpenLiberty.io +seo-description: 24.0.0.6 では Liberty InstantOn を用いた Spring Boot 3.x アプリケーションの起動時間を改善する、Coordinated Restore at Checkpoint が導入されました。また、このリリースでは分散 HTTP セッション・キャッシュと IBM MQ メッセージングを使用するアプリケーションでの InstantOn のサポートも追加されました。 +blog_description: 24.0.0.6 では Liberty InstantOn を用いた Spring Boot 3.x アプリケーションの起動時間を改善する、Coordinated Restore at Checkpoint が導入されました。また、このリリースでは分散 HTTP セッション・キャッシュと IBM MQ メッセージングを使用するアプリケーションでの InstantOn のサポートも追加されました。 +open-graph-image: https://openliberty.io/img/twitter_card.jpg +open-graph-image-alt: Open Liberty Logo +additional_authors: +- name: (翻訳) 馬場 剛 + github: https://github.com/babatch + image: https://avatars.githubusercontent.com/u/29302643 +--- + += 24.0.0.6 での Spring Boot 3.x の起動高速化 +David Mueller +:imagesdir: / +:url-prefix: +:url-about: / +//Blank line here is necessary before starting the body of the post. + +24.0.0.6 では Liberty InstantOn を用いた Spring Boot 3.x アプリケーションの起動時間を改善する、Coordinated Restore at Checkpoint が導入されました。また、このリリースでは分散 HTTP セッション・キャッシュと IBM MQ メッセージングを使用するアプリケーションでの InstantOn のサポートも追加されました。 + +link:{url-about}[Open Liberty] 24.0.0.6 では以下が導入されました。 + +* <> +* <> +* <> +* <> + + +24.0.0.6 で修正されたバグの一覧は link:https://github.com/OpenLiberty/open-liberty/issues?q=label%3Arelease%3A24006+label%3A%22release+bug%22[こちら] です。 + +link:{url-prefix}/blog/?search=release&search!=beta[以前の Open Liberty GA (General Availability) リリース ブログ投稿] もチェックして下さい。 + +[#run] + +== 24.0.0.6 でアプリケーションを開発して実行する +もし link:{url-prefix}/guides/maven-intro.html[Maven] を使用しているなら、以下を pom.xml に追記します。 + +[source,xml] +---- + + io.openliberty.tools + liberty-maven-plugin + 3.10.3 + +---- + +link:{url-prefix}/guides/gradle-intro.html[Gradle] の場合は、以下を build.gradle に追記します。 + +[source,gradle] +---- +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'io.openliberty.tools:liberty-gradle-plugin:3.8.3' + } +} +apply plugin: 'liberty' +---- + +link:{url-prefix}/docs/latest/container-images.html[コンテナイメージ] の場合は、以下を Container (Docker) ファイルに記載します。 + +[source] +---- +FROM icr.io/appcafe/open-liberty +---- + +link:{url-prefix}/start/[ダウンロードページ] も参照して下さい。 + +link:https://plugins.jetbrains.com/plugin/14856-liberty-tools[IntelliJ IDEA], link:https://marketplace.visualstudio.com/items?itemName=Open-Liberty.liberty-dev-vscode-ext[Visual Studio Code] または link:https://marketplace.eclipse.org/content/liberty-tools[Eclipse IDE] を使用している場合、 オープンソースの link:https://openliberty.io/docs/latest/develop-liberty-tools.html[Liberty tools] を使用することで効率的な開発、テスト、デバッグ、アプリケーション管理を IDE 上で実施することができます。 + +[link=https://stackoverflow.com/tags/open-liberty] +image::img/blog/blog_btn_stack_ja.svg[Stack Overflow で質問する, align="center"] + +[#sbcrac] +== Spring Boot アプリケーションの起動高速化 (Spring Boot 3.0 InstantOn with CRaC) + +Open Liberty InstantOn は MicroProfile と Jakarta EE アプリケーションの高速起動を実現します。link:{url-prefix}/blog/2023/06/29/rapid-startup-instanton.html[InstantOn] を使用することで、スループット、メモリ、開発環境と実働環境の同一性、Java 言語機能に影響を与えることなく、アプリケーションを数ミリ秒で起動することができます。InstantOn は後でリストアする JVM のチェックポイントを取得するために、Linux カーネルの ユーザースペース チェックポイント/リストア (link:https://criu.org/[CRIU]) 機能を使用します。 + +Spring フレームワーク (バージョン 6.1 以上) は link:https://docs.spring.io/spring-framework/reference/6.1/integration/checkpoint-restore.html[Coordinated Restore at Checkpoint (CRaC) サポート] を含み、Java アプリケーションに対するチェックポイントとリストアを提供する CRIU も使用します。Spring Boot バージョン 3.2 以上では Spring フレームワーク バージョン 6.1 以上を使用し、Spring Boot アプリケーションが CRaC も使用して高速起動を実現できるようにします。 + +link:docs/latest/reference/feature/springBoot-3.0.html[Open Liberty springBoot-3.0 フィーチャー] は Spring Boot 3.x ベースのアプリケーションを Open Liberty にデプロイすることを可能にします。そしてこれからは、Open Liberty の新フィーチャー link:docs/latest/reference/feature/crac-1.4.html[Coordinated Restore at Checkpoint (CRaC)] (`crac-1.4`) により、Spring Boot 3.2 以上のアプリケーションが Liberty InstantOn と共にデプロイされ、高速起動を実現できるようになります。 + +CRaC 1.4 を `springBot-3.0` フィーチャーと共に使用するには、Java 17 以上を実行し、`server.xml` ファイル内で `crac-1.4` フィーチャーを有効にする必要があります。さらに、アプリケーションがサーブレットを使用しているなら、`servlet-6.0` フィーチャーも必要です。これらのフィーチャーを `server.xml` ファイルで、以下の例のようにして構成します。 + +[source,xml] +---- + + springBoot-3.0 + servlet-6.0 + crac-1.4 + +---- + +これらのフィーチャーを有効化し、link:{url-prefix}/docs/latest/instanton.html[Liberty InstantOn ドキュメンテーション] にある Liberty InstantOn サポートと、link:{url-prefix}/guides/spring-boot.html[Liberty Spring Boot ガイド] にある Spring Boot アプリケーションのコンテナ化に際しての Liberty 推奨事項に従うことで、Spring Boot 3.2 以上のアプリケーションをコンテナ化することができます。 + +より詳しい情報や Liberty InstantOn `crac-1.4` フィーチャーを使用した Spring Boot アプリケーションの例は、link:/blog/2023/09/26/spring-boot-3-instant-on.html[Spring Boot アプリケーションを高速起動対応のコンテナ化する方法] ブログ記事をご覧下さい。 + +`crac-1.4` フィーチャーは他の、例えば Jakarta EE や MicroProfile アプリケーションでも使用することができます。それらのアプリケーションはチェックポイントとリストアの通知を受け取るために、CRaC にリソースを登録することができます。これらの通知はアプリケーションがチェックポイントの準備をすることや、リストアされる際に必要な動作の実行を助けます。`org.crac` API の詳しい情報は、link:https://javadoc.io/doc/org.crac/crac/latest/index.html[org.crac] Javadoc を参照して下さい。 + +// // // // DO NOT MODIFY THIS COMMENT BLOCK // // // // +// Blog issue: https://github.com/OpenLiberty/blogs/issues/3877 +// Contact/Reviewer: +// // // // // // // // +[#mq] +== IBM® MQ での Jakarta Messaging のための InstantOn サポート + +24.0.0.6 リリースでは link:{url-prefix}/docs/latest/reference/feature/messaging-3.0.html[Jakarta Messaging], link:{url-prefix}/docs/latest/reference/feature/connectors-2.1.html[Jakarta Connectors], そして link:{url-prefix}/docs/latest/reference/feature/mdb-4.0.html[Jakarta Enterprise Beans Message-Driven Beans (MDB)] フィーチャーに対する InstantOn サポートが導入されました。InstantOn は現在、IBM® MQ のような外部のメッセージング・システムにアクセスするための Jakarta Messaging API を使用するアプリケーションを含む外部 EIS リソースに対するアクセスのためのリソース・アダプターを使用するアプリケーションに対する超速起動時間を提供します。これらのメッセージング・クライアント・アプリケーションはまた、MDB リスナーにより、エンドポイントへのメッセージの配信を管理することが可能です。 + +MDB エンドポイントを提供し、IBM® MQ が提供するメッセージング・リソースへアクセスする Jakarta EE 10 メッセージング・アプリケーションでは、`messaging-3.1` と `mdb-4.0` フィーチャーを有効にし、パスを link:https://repo1.maven.org/maven2/com/ibm/mq/wmq.jakarta.jmsra/9.3.5.0/wmq.jakarta.jmsra-9.3.5.0.rar[IBM® MQ リソース・アダプター] に設定します。フィーチャー構成は `resourceAdapter` 構成要素をサポートする `connectors-2.1` フィーチャーを自動的に有効化します。 + +[source,xml] +---- + + messaging-3.1 + mdb-4.0 + servlet-6.0 + + + +---- + +[sidebar] +.Developer tip +-- +以下のリソースを提供する link:https://developer.ibm.com/tutorials/mq-connect-app-queue-manager-containers/[MQ in Container image] IBM® MQ サーバーを使用することができます。 + +* ポート 1414 を Listen するキューマネージャー `QM1` +* キュー `DEV.QUEUE.1` +* チャネル `DEV.APP.SVRCONN` + +これらのリソースは単純な point-to-point メッセージング・シナリオをサボートし、下の例に示されるように、メッセージング・フィーチャーの構成要素内で命名されます。 +-- + +InstantOn は、サーバーがチェックポイントからリストアされたどのような環境においても、外部リソースへの接続を有効化するために、メッセージングとコネクターの構成要素を動的に更新することができます。 + +例えば、下のメッセージング構成は、IBM® MQ キューマネージャーをホストするシステムのホスト名及び IP ポートを指定する Liberty 変数を宣言します。サーバーのリストア環境内でこれらの変数を定義して下さい。サーバーがリストアされたとき、接続ファクトリーとメッセージ・エンドポイント・アクティベーション構成は、Open Liberty が IBM® MQ キューマネージャーに接続できるよう、環境固有のホスト名及びポート値を更新します。 + +[source,xml] +---- + + + + + + + + + + + + + + + + + + + +---- + +Jakarta フィーチャーの InstantOn サポートに関する今後のアナウンスもお見逃しなく。 + +// DO NOT MODIFY THIS LINE. + +// // // // DO NOT MODIFY THIS COMMENT BLOCK // // // // +// Blog issue: https://github.com/OpenLiberty/blogs/issues/3877 +// Contact/Reviewer: +// // // // // // // // +[#jcache] +== 分散 HTTP セッション・キャッシュの InstantOn サポート + +24.0.0.6 リリースでは link:{url-prefix}/docs/latest/reference/feature/sessionCache-1.0.html[JCache セッション・パーシスタンス] フィーチャーに対する InstantOn サポートも提供します。このフィーチャーは分散インメモリ・キャッシュを作成するために JCache プロバイダーを使用します。分散セッション・キャッシュは、サーバーがクラスターを構成するために少なくとも他の 1つのサーバーと接続されている場合に使用することができます。Open Liberty サーバーはクラスター内で以下のように構成することができます。 + +- クライアント・サーバー モデル: Open Liberty サーバーは JCache クライアントとして振る舞い、専用の JCache サーバーに接続します。 +- ピア・ツー・ピア モデル: Open Liberty サーバーは、自分と同様に JCache セッション・パーシスタンス フィーチャーを実行し、同じクラスターの一部として構成された Open Liberty サーバーと接続することができます。 + +JCache セッション・パーシスタンスを有効にするためには、`sessionCache-1.0` フィーチャーが `server.xml` ファイル内で有効にされていなければなりません。 + +[source,xml] +---- +sessionCache-1.0 +---- + +`server.xml` ファイル内で、以下の例のようにしてクライアント・サーバー モデルを構成することができます。 +You can configure the client/server model in the `server.xml` file, similar to the following example. + +[source,xml] +---- + + + + + + + + +---- + +`server.xml` ファイル内で、以下の例のようにしてピア モデルを構成することができます。 + +[source,xml] +---- + + + + + + + + + +---- + +**注:** +JCache プロバイダーとして Infinispan を使用してピア・ツー・ピア モデルでの InstantOn サポートを提供する場合、Infinispan 12 またはそれ以降を使用しなければなりません。また JCache セッション・パーシスタンス フィーチャーに加えて、link:{url-prefiux}/docs/latest/reference/feature/mpReactiveStreams-3.0.html[MicroProfile Reactive Streams 3.0] またはそれ以降と、link:{url-prefix}docs/latest/reference/feature/mpMetrics-4.0.html[MicroProfile Metrics 4.0] またはそれ以降を `server.xml` ファイル内で有効にする必要があります。 + +サーバーがチェックポイントからリストアされた際に、ベンダー固有の JCachee 構成プロパティーを使用することができます。下の構成はサーバー・リスト、ユーザー名、パスワードの値をリストアされた環境で定義された変数として使用しています。 + +[source,xml] +---- + + + + + + + +---- + +// DO NOT MODIFY THIS LINE. + +[#CVEs] +== このリリースで修正されたセキュリティ脆弱性 (CVE) +[cols="5*"] +|=== +|CVE |CVSS スコア |脆弱性評価 |影響を受けるバージョン |備考 + +|http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-22354[CVE-2024-22354] +|7.0 +|XML 外部エンティティ (XXE) インジェクション +|17.0.0.3 - 24.0.0.5 +| +|=== + +以前のセキュリティ脆弱性に対する修正は、link:{url-prefix}/docs/latest/security-vulnerabilities.html[セキュリティ脆弱性 (CVE) リスト] を参照して下さい。 + +== いますぐ Open Liberty 24.0.0.6 を入手 + +<> 入手可能です。