From 0193a8947f0e20fcf2ef29681354cab066315fc3 Mon Sep 17 00:00:00 2001 From: dxin <1554389441@qq.com> Date: Mon, 24 Nov 2025 23:21:19 +0800 Subject: [PATCH] + --- 1.conf | 456 +++++++++++++++++++++++++++++++++++------------ 12.yml | 42 +++++ next/next安装.md | 140 +++++++++++++++ 3 files changed, 527 insertions(+), 111 deletions(-) create mode 100644 next/next安装.md diff --git a/1.conf b/1.conf index 2797785..b053532 100644 --- a/1.conf +++ b/1.conf @@ -1,114 +1,348 @@ -pipeline { - agent any - tools{ - maven 'mvn3.8.8' - jdk 'jdk21' - } - stages { - stage('checkout 代码') { - steps { - git branch: 'master', credentialsId: 'fly_gitlab_auth', url: 'http://172.24.16.20/root/fly_moon_agent.git' - } - } - stage('Maven 编译') { - steps { - sh "cd ${WORKSPACE}/ && mvn clean install -P prod -Dmaven.test.skip=true" - } - } - stage('jar A同步') { - steps { - echo("A同步") - sh """ - scp ${WORKSPACE}/flymoon-agent-api/target/flymoon-agent-api.jar 172.24.16.10:/data/webapps/flymoon_agent/flymoon-agent-api-new.jar - scp ${WORKSPACE}/flymoon-agent-provider/target/flymoon-agent.jar 172.24.16.10:/data/webapps/flymoon_agent/flymoon-agent-new.jar - """ - } - } - stage('jar B同步') { - steps { - echo("B同步") - sh """ - scp ${WORKSPACE}/flymoon-agent-api/target/flymoon-agent-api.jar 172.24.16.7:/data/webapps/flymoon_agent/flymoon-agent-api-new.jar - scp ${WORKSPACE}/flymoon-agent-provider/target/flymoon-agent.jar 172.24.16.7:/data/webapps/flymoon_agent/flymoon-agent-new.jar - """ - } - } - stage('替换A旧jar') { - steps { - sh """ - ssh 172.24.16.10 ' - cd /data/webapps/flymoon_agent/ && - if [ -f flymoon-agent.jar ]; then - cp flymoon-agent.jar flymoon-agent-backup.jar - fi && - mv flymoon-agent-new.jar flymoon-agent.jar - ' - """ - sh """ - ssh 172.24.16.10 ' - cd /data/webapps/flymoon_agent/ && - if [ -f flymoon-agent-api.jar ]; then - cp flymoon-agent-api.jar flymoon-agent-api-backup.jar - fi && - mv flymoon-agent-api-new.jar flymoon-agent-api.jar - ' - """ - } - } - stage('jar A下线') { - steps { - echo("A下线") - sh "ssh 172.24.16.10 'sh /data/sh/kill_fly_moon_agent.sh' " - } - } - stage('jar A启动') { - steps { - echo("A启动") - sh "ssh 172.24.16.10 'nohup /data/jdk-21.0.7/bin/java -jar /data/webapps/flymoon_agent/flymoon-agent.jar --spring.profiles.active=prod > /dev/null 2>&1 &' " - } - } - stage('探测A服务 ') { - steps { - echo("探测A服务") - sh "ssh 172.24.16.10 'sh /data/sh/check_flymoon_agent.sh' " - } - } - stage('替换B旧jar') { - steps { - sh """ - ssh 172.24.16.7 ' - cd /data/webapps/flymoon_agent/ && - if [ -f flymoon-agent.jar ]; then - cp flymoon-agent.jar flymoon-agent-backup.jar - fi && - mv flymoon-agent-new.jar flymoon-agent.jar - ' - """ - sh """ - ssh 172.24.16.7 ' - cd /data/webapps/flymoon_agent/ && - if [ -f flymoon-agent-api.jar ]; then - cp flymoon-agent-api.jar flymoon-agent-api-backup.jar - fi && - mv flymoon-agent-api-new.jar flymoon-agent-api.jar - ' - """ - } - } - stage('jar B下线') { - steps { - echo("B下线") - sh "ssh 172.24.16.7 'sh /data/sh/kill_fly_moon_agent.sh' " - } - } +Active Choices Plug-in - stage('jar B启动') { - steps { - echo("B启动") - sh "ssh 172.24.16.7 'nohup /data/jdk-21.0.7/bin/java -jar /data/webapps/flymoon_agent/flymoon-agent.jar --spring.profiles.active=prod > /dev/null 2>&1 &' " - } - } - } -} +Ant Plugin +Apache HttpComponents Client 4.x API Plugin + +Apache HttpComponents Client 5.x API Plugin + +ASM API Plugin + +Authentication Tokens API Plugin + +Authorize Project + +Bitbucket Branch Source Plugin + + + +#------------------------------------------------ +Bitbucket Pipeline for Blue Ocean +Blue Ocean +Blue Ocean Core JS +Blue Ocean Pipeline Editor +Common API for Blue Ocean +Config API for Blue Ocean +Dashboard for Blue Ocean +Design Language +Display URL API +Display URL for Blue Ocean +Events API for Blue Ocean +Git Pipeline for Blue Ocean +GitHub Pipeline for Blue Ocean +i18n for Blue Ocean +JWT for Blue Ocean +Personalization for Blue Ocean +Pipeline implementation for Blue Ocean +Pipeline SCM API for Blue Ocean +REST API for Blue Ocean +REST Implementation for Blue Ocean +Web for Blue Ocean +#------------------------------------------------ + + +Bootstrap 5 API Plugin +bouncycastle API Plugin +Branch API +Build Timeout +Caffeine API Plugin +Checks API plugin +Cloud Statistics Plugin +Command Agent Launcher Plugin +Commons Compress API +commons-collections4 v4.x API Wrapper Plugin +commons-lang3 v3.x Jenkins API Plugin +commons-text API Plugin +Config File Provider Plugin +Credentials Binding Plugin +Credentials Plugin +Dark Theme +Delivery Pipeline Plugin +Dev Tools Symbols API Plugin +Docker +Docker API +Docker Commons Plugin +Docker Pipeline +Durable Task Plugin +ECharts API Plugin +EDDSA API Plugin +Email Extension Plugin +Favorite +Folders Plugin +Font Awesome API Plugin +Git client plugin +Git Parameter Plug-In +Git plugin +GitHub API Plugin +GitHub Branch Source Plugin +GitHub plugin +GitLab API Plugin +GitLab Branch Source Plugin +Go Plugin +Gradle Plugin +Gson API Plugin + + +#------------------------------------------------ + + + + +Handy Uri Templates 2.x API Plugin +HTML Publisher plugin +Image Tag Parameter Plugin +Infrastructure plugin for Publish Over X +Instance Identity +Ionicons API +Jackson 2 API Plugin +Jakarta Activation API +Jakarta Mail API +Jakarta XML Binding API +Java JSON Web Token (JJWT) Plugin +JavaBeans Activation Framework (JAF) API +Javadoc Plugin +JavaMail API +JAXB plugin +Jersey 2 API +Jersey 3 API +Joda Time API Plugin +jQuery plugin +JQuery3 API Plugin +JSch dependency plugin +JSON Api Plugin +JSON Path API Plugin +jsoup API Plugin +JUnit Plugin +Kubernetes CLI Plugin +Kubernetes Client API Plugin +Kubernetes Credentials Plugin +Kubernetes Credentials Provider +Kubernetes plugin + +#-------------------------!!!----------------------- +lark-notice + +Lark Notice Plugin +#---------------------------!!!!--------------------- + +LDAP Plugin +Localization Support Plugin +Localization: Chinese (Simplified) +Mailer Plugin +Matrix Authorization Strategy Plugin +Matrix Project Plugin +Maven Integration plugin +Metrics Plugin +Mina SSHD API :: Common +Mina SSHD API :: Core +NodeJS Plugin +OkHttp Plugin +Oracle Java SE Development Kit Installer Plugin +OWASP Markup Formatter Plugin +PAM Authentication plugin +Parameterized Trigger plugin + + + + + + + +Pipeline + + + +Pipeline Graph Analysis Plugin + + + +Pipeline Graph View Plugin + + + + + +Pipeline Utility Steps + + +Pipeline: API + + + +Pipeline: Basic Steps + + + +Pipeline: Build Step + + +Pipeline: Declarative + + + + +Pipeline: Declarative Extension Points API + + + + +Pipeline: GitHub Groovy Libraries + + +Pipeline: Groovy + + + + +Pipeline: Groovy Libraries + + + +Pipeline: Input Step + + + +Pipeline: Job + + + +Pipeline: Milestone Step + + +Pipeline: Model API + + + +Pipeline: Multibranch + + + +Pipeline: Multibranch with defaults + + + +Pipeline: Nodes and Processes + + + +Pipeline: REST API Plugin + + + +Pipeline: SCM Step + + + + +Pipeline: Stage Step + + + +Pipeline: Stage Tags Metadata + + + + +Pipeline: Stage View Plugin + + + +Pipeline: Step API + + + +Pipeline: Supporting APIs + + +Plain Credentials Plugin + + +Plugin Utilities API Plugin + + + +Pretested Integration Plugin + + + +Prism API Plugin + + +Pub-Sub "light" Bus + + + +Publish Over SSH + + +Resource Disposer Plugin + + + + + + +Role-based Authorization Strategy + + + +SCM API + + + +Script Security Plugin + + + + +Server Sent Events (SSE) Gateway Plugin + + +SnakeYAML API Plugin + + + +SSH Build Agents plugin + + + + +SSH Credentials Plugin + + + +SSH server + + + +Structs Plugin + + + + +Theme Manager + + + +Timestamper + + + +Token Macro Plugin + + +Trilead API Plugin + + + +Variant Plugin + + + +View Job Filters + + + + +Workspace Cleanup Plugin diff --git a/12.yml b/12.yml index 7f953cc..2cf42eb 100644 --- a/12.yml +++ b/12.yml @@ -1,3 +1,45 @@ + +1、创建安装目录 +sudo mkdir -p /data/nvm +sudo chown $USER:$USER /data/nvm + +2、NVM 安装脚本 +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh > install_nvm.sh + +3、执行安装脚本,指定自定义目录 +export NVM_DIR="/data/nvm" +bash install_nvm.sh + +4、在当前 shell 中加载 NVM +export NVM_DIR="/data/nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + +5、(可选)将加载命令写入用户 Profile +export NVM_DIR="/data/nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + + + + + + + + + + + + + + + + + + + + + + + 帮我整理优化补充一下项目需求: 现已有es的数据流存储了项目的日志,需要一个程序可以自动读取并告警,这个程序可以使用python语言,需要有web界面可以对告警规则进行创建设置修改,告警规则的存储尽量不要用到其他软件的支持比如mysql等,最终该程序需要打包成docker镜像进行运行。 1、目前访问该es是需要密码的,因此该程序web界面要有连接es的相关设置,可以输入es网址、账号、密码。 diff --git a/next/next安装.md b/next/next安装.md new file mode 100644 index 0000000..0ab4a32 --- /dev/null +++ b/next/next安装.md @@ -0,0 +1,140 @@ +1、下载压缩包并解压: + +```gitlab +cd /data/ +wget https://download.sonatype.com/nexus/3/nexus-3.86.2-01-linux-x86_64.tar.gz +tar -zxf nexus-3.86.2-01-linux-x86_64.tar.gz +mv nexus-3.86.2-01-linux-x86_64 nexus +``` + +2、创建nexus用户、给权限、更改脚本使用nexus用户 + +```gitlab +useradd -M -r -s /bin/false nexus +chown -R nexus:nexus /data/nexus +cd /data/nexus +vim /data/nexus/bin/nexus + # user to execute as; optional but recommended to set + run_as_user='nexus' +``` + +3、创建systemctl + +```gitlab +vim /etc/systemd/system/nexus.service + +[Unit] +Description=Nexus Repository Manager +After=network.target + +[Service] +Type=forking +LimitNOFILE=65536 + +User=nexus +Group=nexus + +ExecStart=/data/nexus/bin/nexus start +ExecStop=/data/nexus/bin/nexus stop +Restart=on-abort + +# JVM 内存你可根据机器调整 (默认 2G),在 nexus.vmoptions 修改,这里的路径要跟随实际解压出来的路径,或者是用本机的 +Environment=JAVA_HOME=/data/nexus/jdk/temurin_17.0.13_11_linux_x86_64/jdk-17.0.13+11Environment=JAVA_HOME=/data/nexus/jdk +Environment=RUN_AS_USER=nexus + +[Install] +WantedBy=multi-user.target +``` + +4、重载systemctl、启动、查看日志 + +```gitlab +systemctl daemon-reload +systemctl start nexus +systemctl status nexus -l + +# 日志 +tail -f /data/sonatype-work/nexus3/log/nexus.log + +# 如果报错执行5:/data/nexus/bin/nexus: line 175: /data/sonatype-work/nexus3/nexus.pid: Permission denied +``` + +5、给工作目录权限 + +```gitlab +chown -R nexus:nexus /data/nexus +chown -R nexus:nexus /data/sonatype-work +chmod -R 755 /data/sonatype-work + +# 重启查看 +systemctl restart nexus +systemctl status nexus -l + +# 端口占用8081 +ss -ntl | grep 8081 + +# 自启 +systemctl enable nexus +``` + +6、账号密码 + +```gitlab +默认账号:admin +密码:cat /data/sonatype-work/nexus3/admin.password +``` + +--- + +扩展 : + +```gitlab +# Nexus 3 有两个目录:程序目录 + 数据目录 + +NEXUS_HOME(程序目录) 存放程序文件、脚本、jar /data/nexus/ +NEXUS_DATA(数据目录) 存放仓库数据、配置、日志 /data/sonatype-work/nexus3/ + +/data/nexus/ # 下载官方tar包解压后改名的目录 + ├── bin/ # nexus 启动脚本 + ├── etc/ # 配置文件 + ├── deploy/ + ├── jdk/ + ├── *.txt + +/data/sonatype-work/nexus3/ # 所有仓库的数据(比如 Maven 私服上传的 artifacts)都存这里 + ├── blobs/ # 仓库文件,所有上传的 jar 包都在这 + ├── db/ # 配置数据库 + ├── etc/ # 配置 + ├── log/ # 日志 + ├── cache/ + └── nexus.pid # PID 文件 +``` + + +--- + +异常 + +```gitlab +查看日志报错: +tail -f /data/sonatype-work/nexus3/log/nexus.log +2025-11-21 12:06:34,120+0800 WARN [Timer-0] *SYSTEM java.util.prefs - Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock. +2025-11-21 12:06:38,968+0800 INFO [qtp2016701496-114] *UNKNOWN org.apache.shiro.session.mgt.AbstractValidatingSessionManager - Enabling session validation scheduler... +2025-11-21 12:06:38,985+0800 INFO [qtp2016701496-114] *UNKNOWN org.sonatype.nexus.internal.security.anonymous.AnonymousManagerImpl - Using default configuration: AnonymousConfigurationData{enabled=true, userId='anonymous', realmName='NexusAuthorizingRealm'} +2025-11-21 12:06:53,592+0800 INFO [quartz-14-thread-4] *TASK org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Malicious Risk On Disk - Auto enable Health Check for proxy repositories on startup' [malicious-risk-on-disk-auto-enable-rhc] state change WAITING -> RUNNING +2025-11-21 12:06:53,594+0800 INFO [quartz-14-thread-4] *TASK com.sonatype.nexus.risk.riskondisk.MaliciousRiskOnDiskAutoEnableRHCTask - Starting malicious-risk-on-disk-auto-enable-rhc task +2025-11-21 12:06:53,594+0800 INFO [quartz-14-thread-4] *TASK com.sonatype.nexus.risk.riskondisk.MaliciousRiskOnDiskAutoEnableRHCTask - Found 2 proxy repositories +2025-11-21 12:06:53,673+0800 INFO [quartz-14-thread-4] *TASK com.sonatype.nexus.risk.riskondisk.MaliciousRiskOnDiskAutoEnableRHCTask - Completed malicious-risk-on-disk-auto-enable-rhc task +2025-11-21 12:06:53,674+0800 INFO [quartz-14-thread-4] *TASK org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Malicious Risk On Disk - Auto enable Health Check for proxy repositories on startup' [malicious-risk-on-disk-auto-enable-rhc] state change RUNNING -> WAITING (OK) +2025-11-21 12:07:04,119+0800 WARN [Timer-0] *SYSTEM java.util.prefs - Could not lock User prefs. Unix error code 2. +2025-11-21 12:07:04,119+0800 WARN [Timer-0] *SYSTEM java.util.prefs - Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock. + +# 因为 Nexus 用 systemd 方式启动时,Java 会尝试写入,~/.java/.userPrefs/,但 nexus 用户没有对应目录,或者目录不可写 +# 创建的nexus的家目录并给权限 +mkdir -p /home/nexus/.java/.userPrefs +chown -R nexus:nexus /home/nexus/.java +# 如果 nexus 用户没有 home +usermod -d /home/nexus nexus +# 重启 nexus 服务 +systemctl restart nexus +``` \ No newline at end of file