Skip to content
Draft
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release Notes.
Apollo 2.5.0

------------------
* [Feature: Enable graceful shutdown for apollo-adminservice](#TODO)
* [Refactor: align permission validator api between openapi and portal](https://github.com/apolloconfig/apollo/pull/5337)
* [Feature: Provide a new configfiles API to return the raw content of configuration files directly](https://github.com/apolloconfig/apollo/pull/5336)
* [Feature: Enhanced instance configuration auditing and caching](https://github.com/apolloconfig/apollo/pull/5361)
Expand Down
3 changes: 3 additions & 0 deletions apollo-adminservice/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ spring:
properties:
hibernate:
metadata_builder_contributor: com.ctrip.framework.apollo.common.jpa.SqlFunctionsMetadataBuilderContributor
lifecycle:
timeout-per-shutdown-phase: 30s

server:
port: 8090
shutdown: graceful

logging:
file:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2025 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.adminservice;

import com.ctrip.framework.apollo.AdminServiceTestConfiguration;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = AdminServiceTestConfiguration.class,
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
properties = {
"server.shutdown=graceful",
"spring.lifecycle.timeout-per-shutdown-phase=30s"
})
public class GracefulShutdownConfigurationTest {

@Autowired
private ServletWebServerApplicationContext webServerAppContext;

@Test
public void testGracefulShutdownIsConfigured() {
assertNotNull("WebServer should be available", webServerAppContext);
assertTrue("Server should be running", webServerAppContext.getWebServer().getPort() > 0);

// Verify the lifecycle processor exists (indicates graceful shutdown is enabled)
assertNotNull("Lifecycle processor should be present for graceful shutdown",
webServerAppContext.getBean("lifecycleProcessor"));
}
}
2 changes: 2 additions & 0 deletions docs/en/deployment/distributed-deployment-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,8 @@ export JAVA_OPTS="-server -Xms2560m -Xmx2560m -Xss256k -XX:MetaspaceSize=128m -X

> Note 3: To adjust the listening port of the service, you can modify the `SERVER_PORT` in scripts/startup.sh.

> Note 4: Starting from version 2.5.0, apollo-adminservice supports graceful shutdown. When the service receives a stop signal, it will wait for in-flight requests to complete before shutting down, with a default timeout of 30 seconds. This feature is enabled via Spring Boot's `server.shutdown=graceful` and `spring.lifecycle.timeout-per-shutdown-phase=30s` configuration. To adjust the timeout, you can modify the settings in application.yml.

#### 2.2.2.3 Deploy apollo-portal

Upload `apollo-portal-x.x.x-github.zip` to the server, unzip it and execute scripts/startup.sh. To stop the service, execute scripts/shutdown.sh.
Expand Down
2 changes: 2 additions & 0 deletions docs/zh/deployment/distributed-deployment-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ export JAVA_OPTS="-server -Xms2560m -Xmx2560m -Xss256k -XX:MetaspaceSize=128m -X

> 注3:如要调整服务的监听端口,可以修改scripts/startup.sh中的`SERVER_PORT`。

> 注4:apollo-adminservice从2.5.0版本开始支持优雅下线功能。当服务收到停止信号时,会等待正在处理的请求完成后再关闭,默认等待时间为30秒。此功能通过Spring Boot的`server.shutdown=graceful`和`spring.lifecycle.timeout-per-shutdown-phase=30s`配置启用。如需调整超时时间,可以修改application.yml中的配置。

#### 2.2.2.3 部署apollo-portal
将`apollo-portal-x.x.x-github.zip`上传到服务器上,解压后执行scripts/startup.sh即可。如需停止服务,执行scripts/shutdown.sh.

Expand Down