apolloconfig / apollo

Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
https://www.apolloconfig.com
Apache License 2.0
28.95k stars 10.19k forks source link

docker的portal无法启动 #5013

Closed JohnngSong closed 7 months ago

JohnngSong commented 8 months ago

portal 的docker启动后8070口无法访问,没看到错误,请看完整日志: OpenJDK 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release. OpenJDK 64-Bit Server VM warning: CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release.


/ \ | | | / \ | ' \ / | | |/ / | |) | () | | | () | // \ ./ /|||__/ ||

:: Spring Boot :: (v2.6.8)

2023-11-03 14:11:32.810 INFO 1 --- [ main] c.c.f.apollo.portal.PortalApplication : Starting PortalApplication v2.1.0 using Java 1.8.0_342 on 9f6ebbdff348 with PID 1 (/apollo-portal/apollo-portal-2.1.0.jar started by root in /apollo-portal) 2023-11-03 14:11:32.816 INFO 1 --- [ main] c.c.f.apollo.portal.PortalApplication : The following 2 profiles are active: "github", "auth" 2023-11-03 14:11:34.883 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 2023-11-03 14:11:34.885 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2023-11-03 14:11:35.072 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 175 ms. Found 14 JPA repository interfaces. 2023-11-03 14:11:36.332 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8070 (http) 2023-11-03 14:11:36.357 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2023-11-03 14:11:36.358 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.63] 2023-11-03 14:11:36.476 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2023-11-03 14:11:36.477 INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3595 ms 2023-11-03 14:11:36.654 INFO 1 --- [ main] o.s.s.p.JdbcUserDetailsManager : No authentication manager set. Reauthentication of users when changing passwords will not be performed. 2023-11-03 14:11:36.788 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2023-11-03 14:11:37.099 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2023-11-03 14:11:37.175 INFO 1 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2023-11-03 14:11:37.304 INFO 1 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.9.Final 2023-11-03 14:11:37.605 INFO 1 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} 2023-11-03 14:11:37.837 INFO 1 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect 2023-11-03 14:11:37.959 WARN 1 --- [ main] org.hibernate.cfg.AnnotationBinder : HHH000503: A class should not be annotated with both @Inheritance and @MappedSuperclass. @Inheritance will be ignored for: com.ctrip.framework.apollo.common.entity.BaseEntity. 2023-11-03 14:11:39.102 INFO 1 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2023-11-03 14:11:39.116 INFO 1 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2023-11-03 14:11:40.371 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : apollo.portal.envs = dev,prod 2023-11-03 14:11:40.372 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : organizations = [{"orgId":"Java","orgName":"Java"},{"orgId":"TEST2","orgName":"样例部门2"}]. Old value = null 2023-11-03 14:11:40.372 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : superAdmin = apollo. Old value = null 2023-11-03 14:11:40.372 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : api.readTimeout = 10000. Old value = null 2023-11-03 14:11:40.372 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : consumer.token.salt = someSalt. Old value = null 2023-11-03 14:11:40.372 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : admin.createPrivateNamespace.switch = true. Old value = null 2023-11-03 14:11:40.372 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : configView.memberOnly.envs = pro. Old value = null 2023-11-03 14:11:40.372 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : apollo.portal.meta.servers = {"dev":"http://configservice-dev-ha:8080","prod":"http://configservice-prod-ha:8080"}. Old value = null 2023-11-03 14:11:40.984 INFO 1 --- [ main] f.a.p.e.DatabasePortalMetaServerProvider : Loaded meta server addresses from portal config: {PROD=http://configservice-prod-ha:8080/, DEV=http://configservice-dev-ha:8080} 2023-11-03 14:11:40.987 INFO 1 --- [ main] .f.a.p.e.DefaultPortalMetaServerProvider : Loaded meta server addresses from system property, os environment and properties file: {UAT=http://fill-in-uat-meta-server:8080/, PRO=http://fill-in-pro-meta-server:8080/, LPT=${lpt_meta}, DEV=http://fill-in-dev-meta-server:8080/, FAT=http://fill-in-fat-meta-server:8080/, LOCAL=http://localhost:8080} 2023-11-03 14:11:41.930 WARN 1 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning

2023-11-03 14:11:41.974 INFO 1 --- [erviceLocator-1] c.c.f.a.p.e.PortalMetaDomainService : Located meta server address [http://configservice-dev-ha:8080] for env [DEV]

2023-11-03 14:11:42.281 INFO 1 --- [erviceLocator-1] c.c.f.a.p.e.PortalMetaDomainService : Located meta server address [http://configservice-prod-ha:8080] for env [PROD] 2023-11-03 14:11:42.369 INFO 1 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter@542ff147, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@2d801d8, org.springframework.security.web.context.SecurityContextPersistenceFilter@5a51336a, org.springframework.security.web.header.HeaderWriterFilter@52433946, org.springframework.security.web.authentication.logout.LogoutFilter@59127611, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@2299d903, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@632d4cf2, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@59a94d0f, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@2b1a901d, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@b9b97ad, org.springframework.security.web.session.SessionManagementFilter@48e74764, org.springframework.security.web.access.ExceptionTranslationFilter@166e5a6d, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@66b6873f] 2023-11-03 14:11:42.671 INFO 1 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html] 2023-11-03 14:11:43.095 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 4 endpoint(s) beneath base path '' 2023-11-03 14:11:43.170 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8070 (http) with context path '' 2023-11-03 14:11:43.193 INFO 1 --- [ main] s.a.ScheduledAnnotationBeanPostProcessor : No TaskScheduler/ScheduledExecutorService bean found for scheduled processing 2023-11-03 14:11:43.204 INFO 1 --- [ main] c.c.f.apollo.portal.PortalApplication : Started PortalApplication in 11.047 seconds (JVM running for 12.28)

dosubot[bot] commented 8 months ago

🤖

Hi @JohnngSong, good to see you again! I'm going to jump right in and start looking into your issue. I'll get back to you with a comprehensive response shortly.

dosubot[bot] commented 8 months ago

🤖

这个问题可能与Docker的网络配置有关。尽管Dockerfile暴露了8070端口,但您需要确保Docker容器正确地将此端口映射到您的主机机器。

在Dockerfile注释中提供的Docker运行命令中,-p 8070:8070参数用于将容器的8070端口映射到主机机器的8070端口。如果在启动Docker容器时未正确使用此参数,您将无法在8070端口上访问Apollo portal。

然而,在共享的上下文中,提到您正在使用Docker Compose启动Apollo配置中心。在这种情况下,您需要确保docker-compose.yml文件为Apollo portal正确地映射了端口。在docker-compose.yml文件中,端口映射应如下所示:

ports:
  - "8070:8070"

如果您仍然遇到问题,请检查您的Docker和网络配置。

在共享的上下文中,显示了Apollo Admin Service的Dockerfile。看起来服务设置为暴露8090端口,而不是8070端口。这可能是您无法在8070端口上访问portal的原因。您可能需要调整您的Docker运行命令或Docker Compose文件,以将正确的端口(8090)映射到您的主机机器。

参考资料:

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

JohnngSong commented 7 months ago

端口为 ports:

lhsaq2009 commented 3 months ago

进入容器:

[root@Haisen-68 ~]$ docker exec -it apollo-portal /bin/sh # 进入容器

/ # vi apollo-portal/config/apollo-env.properties # 修改配置

dev.meta=http://47.93.246.61:8080                   # 将 fill-in-uat-meta-server 改成了容器的宿主的对外 IP
fat.meta=http://47.93.246.61:8080                   # 将 fill-in-uat-meta-server 改成了容器的宿主的对外 IP

这里可能有坑,我的版本 apollo 1.8.2

UPDATE apolloportaldb.serverconfig SET Key = 'apollo.portal.meta.servers', Value = '{ "dev.meta": "http://47.93.246.61:8080" }' WHERE Id = 8; 无效

docker run -p 8070:8070 的时候,添加 -e DEV_META=http://47.93.246.61:8081 也不奏效

只有去手动修改容器的配置文件才有效