diff --git a/Jenkinsfile b/Jenkinsfile index 42a9a3d..36c4c31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,14 @@ pipeline { } stages { + stage('Pre') { + steps { + sshagent([env.SSH_CREDENTIALS_ID]) { + sh 'ssh alex@117.72.202.202 "bash /home/alex/alex-api/bin/pre-steps.sh"' + } + } + } + stage('Build') { steps { sh 'mvn clean package -DskipTests' @@ -21,8 +29,8 @@ pipeline { scp target/alex-api-0.0.1-SNAPSHOT.jar ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_DIR}/app/ ssh ${REMOTE_USER}@${REMOTE_HOST} ' cd ${REMOTE_DIR} && - docker compose down && - docker compose up -d --build + sudo docker compose down && + sudo docker compose up -d --build ' """ } diff --git a/app/alex-api-0.0.1-SNAPSHOT.jar b/app/alex-api-0.0.1-SNAPSHOT.jar index d66dfaf..c6e030d 100755 Binary files a/app/alex-api-0.0.1-SNAPSHOT.jar and b/app/alex-api-0.0.1-SNAPSHOT.jar differ diff --git a/docker-compose.yml b/docker-compose.yml old mode 100755 new mode 100644 index b834ead..a0dfb11 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -60,11 +60,10 @@ services: # 声明命名数据卷 volumes: mysql-data: - external: true # 使用已有的 mysql-data 卷,不创建新卷 redis-data: - external: true # 创建自定义网络 networks: alex-bridge-network: driver: bridge + diff --git a/logs/alex-api.log b/logs/alex-api.log index 2ec3645..7ff753d 100644 --- a/logs/alex-api.log +++ b/logs/alex-api.log @@ -7,39 +7,19 @@ =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.6.13) -2025-07-15 09:34:11.450 INFO 2719370 --- [ main] com.ctgu.alexapi.AlexApiApplication : Starting AlexApiApplication using Java 17.0.15 on server with PID 2719370 (/home/alex/alex-api/app/alex-api-0.0.1-SNAPSHOT.jar started by alex in /home/alex) -2025-07-15 09:34:11.452 INFO 2719370 --- [ main] com.ctgu.alexapi.AlexApiApplication : The following 1 profile is active: "dev" -2025-07-15 09:34:12.544 INFO 2719370 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode -2025-07-15 09:34:12.547 INFO 2719370 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode. -2025-07-15 09:34:12.590 INFO 2719370 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 20 ms. Found 0 Redis repository interfaces. -2025-07-15 09:34:13.738 INFO 2719370 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8888 (http) -2025-07-15 09:34:13.770 INFO 2719370 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] -2025-07-15 09:34:13.770 INFO 2719370 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.68] -2025-07-15 09:34:13.950 INFO 2719370 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext -2025-07-15 09:34:13.950 INFO 2719370 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2362 ms +2025-07-15 14:25:40.790 INFO 2747605 --- [ main] com.ctgu.alexapi.AlexApiApplication : Starting AlexApiApplication using Java 17.0.15 on server with PID 2747605 (/home/alex/alex-api/app/alex-api-0.0.1-SNAPSHOT.jar started by alex in /home/alex) +2025-07-15 14:25:40.794 INFO 2747605 --- [ main] com.ctgu.alexapi.AlexApiApplication : The following 1 profile is active: "dev" +2025-07-15 14:25:41.976 INFO 2747605 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode +2025-07-15 14:25:41.979 INFO 2747605 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode. +2025-07-15 14:25:42.017 INFO 2747605 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 12 ms. Found 0 Redis repository interfaces. +2025-07-15 14:25:43.070 INFO 2747605 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8888 (http) +2025-07-15 14:25:43.118 INFO 2747605 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2025-07-15 14:25:43.119 INFO 2747605 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.68] +2025-07-15 14:25:43.262 INFO 2747605 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2025-07-15 14:25:43.263 INFO 2747605 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2344 ms _ _ |_ _ _|_. ___ _ | _ | | |\/|_)(_| | |_\ |_)||_|_\ / | 3.5.1 -2025-07-15 09:34:16.185 INFO 2719370 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8888 (http) with context path '' -2025-07-15 09:34:16.204 INFO 2719370 --- [ main] com.ctgu.alexapi.AlexApiApplication : Started AlexApiApplication in 5.761 seconds (JVM running for 6.61) -2025-07-15 09:45:02.685 INFO 2719370 --- [0.0-8888-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' -2025-07-15 09:45:02.686 INFO 2719370 --- [0.0-8888-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' -2025-07-15 09:45:02.687 INFO 2719370 --- [0.0-8888-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms -2025-07-15 09:45:02.907 INFO 2719370 --- [0.0-8888-exec-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... -2025-07-15 09:45:03.268 INFO 2719370 --- [0.0-8888-exec-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. -2025-07-15 10:55:24.202 INFO 2719370 --- [0.0-8888-exec-3] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header - Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level. - -java.lang.IllegalArgumentException: Invalid character found in method name [0x030x000x00/*0xe00x000x000x000x000x00Cookie: ]. HTTP method names must be tokens - at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:419) ~[tomcat-embed-core-9.0.68.jar!/:na] - at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:271) ~[tomcat-embed-core-9.0.68.jar!/:na] - at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.68.jar!/:na] - at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.68.jar!/:na] - at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789) ~[tomcat-embed-core-9.0.68.jar!/:na] - at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.68.jar!/:na] - at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.68.jar!/:na] - at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.68.jar!/:na] - at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.68.jar!/:na] - at java.base/java.lang.Thread.run(Thread.java:840) ~[na:na] - +2025-07-15 14:25:45.257 INFO 2747605 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8888 (http) with context path '' +2025-07-15 14:25:45.268 INFO 2747605 --- [ main] com.ctgu.alexapi.AlexApiApplication : Started AlexApiApplication in 5.509 seconds (JVM running for 6.119)