当前位置: 首页 > news >正文

git2consul+consul+gitlab连接

前提:安装好了gitlab和部署好了consul集群。使用git2consul连接持续检测gitlab仓库变化。
提交相关配置到gitlab中->git2consul连接gitlab,得到变化的配置 -> git2consul将变化的配置同步到consul中->后端服务器从consul中的key/value中得到变化的配置
1、git2consul安装

yum install epel-release -y
yum install -y nodejs
yum install npm -y
npm install git2consul
mkdir -pv /etc/git2consul/
cd /etc/git2consul/
vim  config.json
cat config.json  #配置文件指定了git2consul需要监控的git仓库地址、分支、
#前提:安装好了gitlab并且创建了项目
{"version": "1.0","repos" : [{"name" : "git", # conul中的key/value中的文件名"url" : "http://root:12345@192.168.50.156/root/class-test-yin.git",  #这个root是在gitlab中可以改变的"include_branch_name": false,"branches" : ["main"],#哪个分支"hooks": [{"type" : "polling","interval" : "1"}]}]
}cat  /etc/systemd/system/git2consul.service
[Unit]
Description=git2consul
After=network.target
[Service]
Type=simple
#User=git2consul
#Group=git2consul
#WorkingDirectory=/app/git2consul
ExecStart=/usr/local/bin/git2consul --endpoint 192.168.70.64 --port 8500 --config-file /etc/git2consul/config.json
TimeoutStopSec=59
[Install]
WantedBy=multi-user.target

启动git2consul后,不需要手动的去consul中添加key/value,会自动的导入

2、后端服务器相关配置

[root@first-1 class-assistant-linux-production]# cat appsettings.Production.json 
{"ConsulForConfig": {"Host": "http://192.168.70.64:8500","Prefix": "git/class-assistant/common"  #指定consul图形界面中配置文件的位置}
}

3、supervisor使用

[root@first-1 supervisord.d]# cat classAssistant.ini 
[program:core-class-assistant-linux-production]
command=/bin/bash -c "dotnet ClassAssistant.Apis.dll --urls http://*:260 --virtualPath=/class-assistant"
directory=/opt/class-assistant-linux-production
stderr_logfile=/var/log/classAssistant-production.error.log
stdout_logfile=/var/log/classAssistant-production.stdout.log
environment=DOTNET_ENVIRONMENT=Production,DISPLAY=:1
user=root
stopsignal=INT
autostart=true
autorestart=true
startsecs=3
yum install supervisor -y
vim /etc/supervisord.d/classAssistant.ini 
systemctl start supervisor
supervisorctl status

4、dotnet安装

rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
yum install dotnet-sdk-6.0 -y
yum install aspnetcore-runtime-6.0  -y
yum install dotnet-runtime-6.0  -y

相关文章:

  • 自动发卡平台源码优化版,支持个人免签支付
  • Unity2018发布安卓报错 Exception: Gradle install not valid
  • 大数据导论-大数据分析——沐雨先生
  • 数据库---PDO
  • Radio Silence for mac 好用的防火墙软件
  • 探索多种数据格式:JSON、YAML、XML、CSV等数据格式详解与比较
  • Day23:LeedCode 669. 修剪二叉搜索树 108.将有序数组转换为二叉搜索树 538.把二叉搜索树转换为累加树
  • 八大技术趋势案例(云计算大数据)
  • RabbitMQ中的交换机
  • Docker版本:18.06.1安装
  • 网络:udptcp套接字
  • Linux shell编程学习笔记42:md5sum
  • 傅立叶之美:深入研究傅里叶分析背后的原理和数学
  • LeetCode 面试经典150题 290.单词规律
  • 虚拟机-从头配置Ubuntu18.04(包括anaconda,cuda,cudnn,pycharm,ros,vscode)
  • IE9 : DOM Exception: INVALID_CHARACTER_ERR (5)
  • [微信小程序] 使用ES6特性Class后出现编译异常
  • 《用数据讲故事》作者Cole N. Knaflic:消除一切无效的图表
  • 【附node操作实例】redis简明入门系列—字符串类型
  • 【划重点】MySQL技术内幕:InnoDB存储引擎
  • ES6语法详解(一)
  • Linux学习笔记6-使用fdisk进行磁盘管理
  • mysql innodb 索引使用指南
  • UEditor初始化失败(实例已存在,但视图未渲染出来,单页化)
  • Webpack4 学习笔记 - 01:webpack的安装和简单配置
  • 从地狱到天堂,Node 回调向 async/await 转变
  • 基于 Ueditor 的现代化编辑器 Neditor 1.5.4 发布
  • 聊聊redis的数据结构的应用
  • 收藏好这篇,别再只说“数据劫持”了
  • 数据结构java版之冒泡排序及优化
  • 学习使用ExpressJS 4.0中的新Router
  • 移动端唤起键盘时取消position:fixed定位
  • 用Visual Studio开发以太坊智能合约
  • 转载:[译] 内容加速黑科技趣谈
  • 2017年360最后一道编程题
  • shell使用lftp连接ftp和sftp,并可以指定私钥
  • Spring Batch JSON 支持
  • 翻译 | The Principles of OOD 面向对象设计原则
  • ​软考-高级-系统架构设计师教程(清华第2版)【第9章 软件可靠性基础知识(P320~344)-思维导图】​
  • ###C语言程序设计-----C语言学习(3)#
  • (01)ORB-SLAM2源码无死角解析-(56) 闭环线程→计算Sim3:理论推导(1)求解s,t
  • (Redis使用系列) Springboot 使用Redis+Session实现Session共享 ,简单的单点登录 五
  • (附源码)springboot炼糖厂地磅全自动控制系统 毕业设计 341357
  • (提供数据集下载)基于大语言模型LangChain与ChatGLM3-6B本地知识库调优:数据集优化、参数调整、Prompt提示词优化实战
  • (五)网络优化与超参数选择--九五小庞
  • (一)搭建springboot+vue前后端分离项目--前端vue搭建
  • (转)JAVA中的堆栈
  • (转)shell中括号的特殊用法 linux if多条件判断
  • (转)为C# Windows服务添加安装程序
  • (轉貼) 資訊相關科系畢業的學生,未來會是什麼樣子?(Misc)
  • .NET 使用配置文件
  • .NET/C# 中设置当发生某个特定异常时进入断点(不借助 Visual Studio 的纯代码实现)
  • .NET4.0并行计算技术基础(1)
  • .net解析传过来的xml_DOM4J解析XML文件
  • .NET委托:一个关于C#的睡前故事