feat: 新增 15 个服务组件,总计 59 个
系统服务: NTP, DHCP, BIND, NFS, SAMBA, RSYNC, Sersync, vsftpd, Subversion 数据库中间件: Mycat CI/CD: GitLab, Jenkins 高可用: Keepalived, HAProxy, LVS 新增 4 个分类: 系统服务、数据库中间件、CI/CD、高可用
This commit is contained in:
@@ -0,0 +1,181 @@
|
||||
export const ntpSchema = {
|
||||
id: 'ntp',
|
||||
name: 'NTP',
|
||||
icon: 'Timer',
|
||||
category: '系统服务',
|
||||
description: 'NTP 网络时间协议服务配置',
|
||||
format: 'conf',
|
||||
fileName: 'ntp.conf',
|
||||
groups: [
|
||||
{
|
||||
title: '时间服务器',
|
||||
fields: [
|
||||
{
|
||||
key: 'server',
|
||||
label: 'NTP 服务器',
|
||||
type: 'text',
|
||||
default: 'pool.ntp.org',
|
||||
tip: '主 NTP 服务器地址',
|
||||
},
|
||||
{
|
||||
key: 'server2',
|
||||
label: '备用 NTP 服务器',
|
||||
type: 'text',
|
||||
default: 'cn.ntp.org.cn',
|
||||
tip: '备用 NTP 服务器地址',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '访问控制',
|
||||
fields: [
|
||||
{
|
||||
key: 'restrict',
|
||||
label: 'IPv4 访问限制',
|
||||
type: 'text',
|
||||
default: '-4 default kod notrap nomodify nopeer noquery limited',
|
||||
tip: 'IPv4 默认访问控制规则',
|
||||
},
|
||||
{
|
||||
key: 'restrict6',
|
||||
label: 'IPv6 访问限制',
|
||||
type: 'text',
|
||||
default: '-6 default kod notrap nomodify nopeer noquery limited',
|
||||
tip: 'IPv6 默认访问控制规则',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '文件路径',
|
||||
fields: [
|
||||
{
|
||||
key: 'driftfile',
|
||||
label: '漂移文件路径',
|
||||
type: 'text',
|
||||
default: '/var/lib/ntp/drift',
|
||||
tip: '频率补偿文件路径',
|
||||
},
|
||||
{
|
||||
key: 'logfile',
|
||||
label: '日志文件路径',
|
||||
type: 'text',
|
||||
default: '/var/log/ntp.log',
|
||||
tip: 'NTP 日志文件路径',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '认证配置',
|
||||
fields: [
|
||||
{
|
||||
key: 'enableAuth',
|
||||
label: '启用认证',
|
||||
type: 'switch',
|
||||
default: false,
|
||||
tip: '启用 NTP 认证机制',
|
||||
},
|
||||
{
|
||||
key: 'keysFile',
|
||||
label: '密钥文件路径',
|
||||
type: 'text',
|
||||
default: '/etc/ntp/keys',
|
||||
dependsOn: { key: 'enableAuth', value: true },
|
||||
tip: 'NTP 认证密钥文件',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '性能调优',
|
||||
fields: [
|
||||
{
|
||||
key: 'tinkerPanic',
|
||||
label: 'Tinker Panic 阈值',
|
||||
type: 'number',
|
||||
min: 0,
|
||||
max: 1000,
|
||||
default: 0,
|
||||
tip: '0=永不 panic,超过此秒数偏移将 panic',
|
||||
},
|
||||
{
|
||||
key: 'burst',
|
||||
label: '启用 Burst 模式',
|
||||
type: 'switch',
|
||||
default: false,
|
||||
tip: '在网络正常时发送一批请求以提高精度',
|
||||
},
|
||||
{
|
||||
key: 'minpoll',
|
||||
label: '最小轮询间隔 (2^n 秒)',
|
||||
type: 'number',
|
||||
min: 3,
|
||||
max: 17,
|
||||
default: 6,
|
||||
tip: '最小轮询间隔指数,3=8秒',
|
||||
},
|
||||
{
|
||||
key: 'maxpoll',
|
||||
label: '最大轮询间隔 (2^n 秒)',
|
||||
type: 'number',
|
||||
min: 3,
|
||||
max: 17,
|
||||
default: 10,
|
||||
tip: '最大轮询间隔指数,10=1024秒',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
export function generateNtpConf(config) {
|
||||
const lines = []
|
||||
lines.push(`# NTP 配置文件 - 由 ConfTemplate 生成`)
|
||||
lines.push(`# 生成时间: ${new Date().toLocaleString('zh-CN')}`)
|
||||
lines.push(``)
|
||||
|
||||
// Time servers
|
||||
lines.push(`# ======================== 时间服务器 ========================`)
|
||||
lines.push(`server ${config.server} iburst minpoll ${config.minpoll} maxpoll ${config.maxpoll}`)
|
||||
lines.push(`server ${config.server2} iburst minpoll ${config.minpoll} maxpoll ${config.maxpoll}`)
|
||||
lines.push(``)
|
||||
|
||||
// Access control
|
||||
lines.push(`# ======================== 访问控制 ========================`)
|
||||
lines.push(`restrict ${config.restrict}`)
|
||||
lines.push(`restrict ${config.restrict6}`)
|
||||
lines.push(`restrict 127.0.0.1`)
|
||||
lines.push(`restrict ::1`)
|
||||
lines.push(``)
|
||||
|
||||
// File paths
|
||||
lines.push(`# ======================== 文件路径 ========================`)
|
||||
lines.push(`driftfile ${config.driftfile}`)
|
||||
lines.push(`logfile ${config.logfile}`)
|
||||
lines.push(``)
|
||||
|
||||
// Authentication
|
||||
if (config.enableAuth) {
|
||||
lines.push(`# ======================== 认证配置 ========================`)
|
||||
lines.push(`enable auth`)
|
||||
lines.push(`keys ${config.keysFile}`)
|
||||
lines.push(``)
|
||||
}
|
||||
|
||||
// Performance
|
||||
lines.push(`# ======================== 性能调优 ========================`)
|
||||
if (config.tinkerPanic > 0) {
|
||||
lines.push(`tinker panic ${config.tinkerPanic}`)
|
||||
} else {
|
||||
lines.push(`tinker panic 0`)
|
||||
}
|
||||
if (config.burst) {
|
||||
lines.push(`burst`)
|
||||
}
|
||||
lines.push(``)
|
||||
|
||||
// Leap second
|
||||
lines.push(`# ======================== 其他 ========================`)
|
||||
lines.push(`# 闰秒文件(如需要)`)
|
||||
lines.push(`# leapfile /usr/share/zoneinfo/leap-seconds.list`)
|
||||
|
||||
return lines.join('\n')
|
||||
}
|
||||
Reference in New Issue
Block a user