1
0

Compare commits

..

55 Commits

Author SHA1 Message Date
11e1604683 update for project tag with such as multi-tenancy while build package 2024-10-17 16:46:02 +08:00
a78fd76e3b fix: postinst shell script 2024-10-16 16:53:01 +08:00
22119320d1 add: update config file while upgrade 2024-10-16 16:40:50 +08:00
c4142d894b add: upgrade config file while upgrade 2024-10-16 16:22:53 +08:00
815a754485 release 2.2410.1 for multi-tenant 2024-10-12 13:58:59 +08:00
1bbaf9b4d7 Merge branch 'main' into multi-tenant 2024-10-12 11:03:39 +08:00
debef0a5f1 export open api v2409.4 2024-10-12 10:58:58 +08:00
TsMask
fea9a201c8 chore: 更新版本号 2.2409.4 2024-09-27 11:30:27 +08:00
912fc763a8 tips update 2024-09-25 18:21:39 +08:00
ac6ef015eb release 2.2409.1 for multi-tenancy 2024-09-25 18:20:49 +08:00
69a54c9243 Merge branch 'main' into multi-tenant 2024-09-25 17:09:04 +08:00
TsMask
eea255ff95 fix: deb卸载systemctl操作判断 2024-09-21 16:32:23 +08:00
TsMask
586b4c2f5a fix: deb卸载systemctl操作判断 2024-09-21 16:12:45 +08:00
TsMask
1c565bdd61 fix: deb安装前systemctl stop的操作判断 2024-09-21 12:11:47 +08:00
TsMask
ac25c16e74 fix: deb安装对systemctl stop的操作 2024-09-21 11:46:05 +08:00
TsMask
c726cdc65b chore: 更新版本号 2.2409.3 2024-09-20 19:04:46 +08:00
472538f649 fix: .. 2024-09-04 18:34:45 +08:00
20e5f2bcf5 fix... 2024-09-04 18:32:45 +08:00
67bbf47c87 fix: ... 2024-09-04 18:29:42 +08:00
050edce089 fix: ... 2024-09-04 18:24:17 +08:00
06302a33e6 fix: ... 2024-09-04 17:59:32 +08:00
432a526dc2 fix: ... 2024-09-04 17:45:24 +08:00
acaefa8dae fix: ... 2024-09-04 17:36:13 +08:00
0012615659 fix: .... 2024-09-04 17:34:18 +08:00
0114e59ed0 fix: wasm file issue 2024-09-04 17:31:50 +08:00
b6e06a39e0 fix: ... 2024-09-04 17:21:21 +08:00
b30f9d45fe fix:. .. 2024-09-04 17:19:16 +08:00
123e621b05 fix: ... 2024-09-04 17:14:22 +08:00
00d992dd4d fix: change var 2024-09-04 17:07:46 +08:00
9b9b9e9267 fix: build error with wiregasm.wasm.gz 2024-09-04 16:56:58 +08:00
31a072d4e2 fix: rm build step in omc.spec 2024-09-04 16:36:33 +08:00
842417b63c fix: remove install step 2024-09-04 16:28:06 +08:00
d8b25cd071 fix: ... 2024-09-04 16:16:28 +08:00
8a63fb0173 fix: stop service at the begin install 2024-09-04 16:13:15 +08:00
8d3dccbeef fix: ... 2024-09-04 14:56:50 +08:00
915807dc53 opt: rpm support environment parameter to DB install or upgrade 2024-09-04 11:22:33 +08:00
e7ea8dbf4a fix: postinst enhancement 2024-09-03 18:46:50 +08:00
2cfc10c86a fix: postinst with environment param 2024-09-03 16:56:57 +08:00
ba9fec53f9 release for 2.2409.1 2024-09-03 16:52:46 +08:00
e5dd8363ca opt: dpkg support environment paramter to do DB install or upgrade 2024-09-03 16:18:34 +08:00
TsMask
480363ae04 chore: 更新版本号2.2408.5 2024-08-31 10:18:36 +08:00
TsMask
eca52ccbc9 chore: 更新版本号2.2408.4 2024-08-23 19:07:31 +08:00
TsMask
71311cb6a8 chore: 更新版本号2.2408.3 2024-08-16 19:25:35 +08:00
TsMask
84bb2f5ec9 chore: 更新版本号2.2408.2 2024-08-09 20:07:51 +08:00
TsMask
dc8ec525f2 chore: 更新版本号2.2408.1 2024-08-02 10:08:37 +08:00
TsMask
bca9f94b01 fix: Nginx配置文件 2024-07-30 18:16:09 +08:00
TsMask
5b31d4739b fix: agt字符改为omc 2024-07-29 18:31:02 +08:00
TsMask
2bdd14a761 chore: 更新版本号 2.2407.4 2024-07-27 11:19:09 +08:00
TsMask
b542ee6073 fix: dep打包时默认restconf配置文件信息 2024-07-27 11:17:14 +08:00
TsMask
2717409d47 fix: Nginx配置文件变更 2024-07-27 11:14:32 +08:00
TsMask
9ab3d2d53f del: deb22打包移除kvdb服务绑定 2024-07-27 11:07:46 +08:00
TsMask
8a4bd1216a del: deb18打包移除kvdb服务绑定 2024-07-27 11:07:34 +08:00
TsMask
80f3b33813 del: rpm打包移除kvdb服务绑定 2024-07-27 10:56:53 +08:00
TsMask
f66806e127 fix: Nginx配置文件变更 2024-07-27 10:46:19 +08:00
TsMask
10752171a1 chore: 更新版本号 2.2407.3 2024-07-16 11:39:23 +08:00
45 changed files with 21974 additions and 13151 deletions

View File

@@ -55,7 +55,7 @@ fi
ProjectL=omc ProjectL=omc
ProjectU=OMC ProjectU=OMC
PROJECT=${ProjectL} PROJECT=${ProjectL}
VERSION=2.2408.1 VERSION=2.2410.1
RelDate=`date +%Y%m%d` RelDate=`date +%Y%m%d`
RelVer=${VERSION}-${RelDate} RelVer=${VERSION}-${RelDate}
Ky10Arch=ky10.aarch64 Ky10Arch=ky10.aarch64
@@ -68,6 +68,7 @@ RpmArch=`arch`
RpmsDir=${EmsBuildRoot}/rpmbuild/RPMS/ RpmsDir=${EmsBuildRoot}/rpmbuild/RPMS/
ReleaseDir=${EmsBuildRoot}/release ReleaseDir=${EmsBuildRoot}/release
DumpToolDir=${EmsBEDir}/tools/misc DumpToolDir=${EmsBEDir}/tools/misc
ProjectTag=multi-tenancy
BuildDir=${EmsBuildRoot}/build BuildDir=${EmsBuildRoot}/build
BuildOMCDir=${BuildDir}/usr/local/omc BuildOMCDir=${BuildDir}/usr/local/omc
@@ -190,8 +191,14 @@ case "${pkgtype}" in
DebFEBuildDir=${DebFEBuild2204Dir} DebFEBuildDir=${DebFEBuild2204Dir}
#DebPkgFile=${PROJECT}-${VERSION}-22.04-${Release).${PLATFORM).deb #DebPkgFile=${PROJECT}-${VERSION}-22.04-${Release).${PLATFORM).deb
DebPkgFile=${PROJECT}-r${VERSION}-${RelDate}-ub22.deb DebPkgFile=${PROJECT}-r${VERSION}-${RelDate}-ub22.deb
if [ ! $ProjectTag = "" ]; then
DebPkgFile=${PROJECT}-r${VERSION}-${RelDate}-ub22-${ProjectTag}.deb
fi
elif [[ ${VersionID} =~ 'VERSION_ID="18.04"' ]]; then elif [[ ${VersionID} =~ 'VERSION_ID="18.04"' ]]; then
DebPkgFile=${PROJECT}-r${VERSION}-${RelDate}-ub18.deb DebPkgFile=${PROJECT}-r${VERSION}-${RelDate}-ub18.deb
if [ ! $ProjectTag = "" ]; then
DebPkgFile=${PROJECT}-r${VERSION}-${RelDate}-ub18-${ProjectTag}.deb
fi
else else
echo "Invalid OS release: ${VersionID}" echo "Invalid OS release: ${VersionID}"
exit 1 exit 1
@@ -234,7 +241,7 @@ case "${pkgtype}" in
#cp -rf ${BuildDir}/systemd/*.service ${DebBuildDir}/lib/systemd/system/ #cp -rf ${BuildDir}/systemd/*.service ${DebBuildDir}/lib/systemd/system/
chmod +x ${DebBuildDir}/usr/local/omc/bin/* chmod +x ${DebBuildDir}/usr/local/omc/bin/*
sed -i "s/YYYYMMDD/${RelDate}/g" ${DebBuildDir}/DEBIAN/control sed -i "s/YYYYMMDD/${RelDate}/g" ${DebBuildDir}/DEBIAN/control
perl -0777 -i -pe 's/ne:\n user: root/ne:\n user: agtuser/g' ${DebBuildDir}/usr/local/omc/etc/default/restconf.yaml perl -0777 -i -pe 's/ne:\n user: root/ne:\n user: omcuser/g' ${DebBuildDir}/usr/local/omc/etc/default/restconf.yaml
dpkg -b ${DebBuildDir} ${ReleasePkgDir}/${DebPkgFile} dpkg -b ${DebBuildDir} ${ReleasePkgDir}/${DebPkgFile}
cd ${ReleasePkgDir} cd ${ReleasePkgDir}

View File

@@ -1,57 +1,40 @@
server { server {
listen 4443 ssl; listen 44080;
listen [::]:4443 ssl; listen 44443;
server_name 0.0.0.0; listen [::]:44080;
root /usr/local/omc/htdocs/front/; listen [::]:44443;
index index.html index.htm; server_name localhost;
server_name localhost;
# SSL
ssl_certificate /usr/local/omc/etc/certs/omc-server.crt;
ssl_certificate_key /usr/local/omc/etc/certs/omc-server.key;
# CA, 自定义 client_max_body_size 100M;
ssl_client_certificate /usr/local/omc/etc/certs/omc-ca.crt; keepalive_timeout 180s;
ssl_verify_client on;
# ssl ciphers
ssl_protocols TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
# location /api/rest/securityManagement { #access_log /var/log/nginx/host.access.log main;
# proxy_pass http://127.0.0.1:5050;
# } # ssl_certificate /usr/local/omc/etc/certs/omc-server.crt;
# location /api/rest/resourceManagement { # ssl_certificate_key /usr/local/omc/etc/certs/omc-server.key;
# proxy_pass http://127.0.0.1:5050; # ssl_client_certificate /usr/local/omc/etc/certs/omc-ca.crt;
# } # ssl_verify_client on;
# location /api/rest/performanceManagement { # ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
# proxy_pass http://127.0.0.1:5050; # ssl_session_timeout 5m;
# } # ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
# location /api/rest/faultManagement { # ssl_prefer_server_ciphers on;
# proxy_pass http://127.0.0.1:5050;
# } # OMC
# location /api/rest/aaaa/ {
# proxy_pass http://127.0.0.1:4040;
# }
location /api/rest/ {
proxy_pass http://127.0.0.1:3030;
}
location / { location / {
try_files $uri $uri/ =404; root /usr/local/omc/htdocs/front;
try_files $uri $uri/ /index.html;
index index.html index.htm;
} }
}
server {
listen 8888 default_server;
listen [::]:8888 default_server;
root /usr/local/omc/htdocs/front/;
index index.html index.htm;
server_name localhost;
location /omc-api/ { location /omc-api/ {
proxy_pass http://127.0.0.1:3030/; proxy_pass http://127.0.0.1:33030/;
proxy_http_version 1.1; proxy_connect_timeout 180s;
proxy_cache_bypass $http_upgrade; proxy_send_timeout 180s;
proxy_read_timeout 180s;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
proxy_set_header Host $host; proxy_set_header Host $host;
@@ -62,11 +45,27 @@ server {
proxy_set_header X-Forwarded-Port $server_port; proxy_set_header X-Forwarded-Port $server_port;
} }
location / { location /api/rest/ {
root /usr/local/omc/htdocs/front; proxy_pass http://127.0.0.1:33030/api/rest/;
try_files $uri $uri/ /index.html; proxy_cache_bypass $http_upgrade;
index index.html index.htm; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} }
} }

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -1,5 +1,5 @@
Package: OMC Package: OMC
Version: 2.2408.1-YYYYMMDD Version: 2.2410.1-YYYYMMDD
Section: AGrandTech Section: AGrandTech
Prioritt: optional Prioritt: optional
Architecture: amd64 Architecture: amd64

View File

@@ -1,21 +1,16 @@
# !/bin/bash # !/bin/bash
RedisRootDir=/usr/local
OMCRootDir=/usr/local/omc OMCRootDir=/usr/local/omc
RedisOldRootDir=/usr/local/db
RedisConfDir=${RedisRootDir}/etc/kvdb
DependsRootDir=${OMCRootDir}/depends
SystemdRootDir=/lib/systemd/system SystemdRootDir=/lib/systemd/system
OMCEtcDir=${OMCRootDir}/etc OMCEtcDir=${OMCRootDir}/etc
FERootDir=${OMCRootDir}/htdocs/front FERootDir=${OMCRootDir}/htdocs/front
X86Lib64Dir=/lib/x86_64-linux-gnu X86Lib64Dir=/lib/x86_64-linux-gnu
OmcBinDir=${OMCRootDir}/bin OMCBinDir=${OMCRootDir}/bin
OMCStaticDir=${OMCRootDir}/static OMCStaticDir=${OMCRootDir}/static
UsrLocalBinDir=/usr/local/bin UsrLocalBinDir=/usr/local/bin
OmcDaemon=omcd OMCDaemon=omcd
NginxEtcDir=/etc/nginx NginxEtcDir=/etc/nginx
NginxConfDir=${NginxEtcDir}/conf.d NginxConfDir=${NginxEtcDir}/conf.d
NginxSiteAvailable=${NginxEtcDir}/sites-available
CFileList="restconf.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml omc.conf" CFileList="restconf.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml omc.conf"
LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png" LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png"
@@ -25,7 +20,6 @@ echo " sudo systemctl start/stop/restart/status restagent.service"
echo " sudo systemctl start/stop/restart/status crontask.service" echo " sudo systemctl start/stop/restart/status crontask.service"
echo " sudo systemctl start/stop/restart/status sshsvc.service" echo " sudo systemctl start/stop/restart/status sshsvc.service"
echo " sudo systemctl start/stop/restart/status captrace.service" echo " sudo systemctl start/stop/restart/status captrace.service"
echo " sudo systemctl start/stop/restart/status kvdb.service"
echo " or run: " echo " or run: "
echo " sudo /usr/local/omc/bin/omcsvc.sh start/stop/restart/status" echo " sudo /usr/local/omc/bin/omcsvc.sh start/stop/restart/status"
echo "" echo ""
@@ -41,7 +35,7 @@ chmod +rx libwsutil.so.13.1.0
if [ ! -e libwsutil.so.13 ]; then ln -s libwsutil.so.13.1.0 libwsutil.so.13; fi if [ ! -e libwsutil.so.13 ]; then ln -s libwsutil.so.13.1.0 libwsutil.so.13; fi
if [ ! -e libwsutil.so ]; then ln -s libwsutil.so.13.1.0 libwsutil.so; fi if [ ! -e libwsutil.so ]; then ln -s libwsutil.so.13.1.0 libwsutil.so; fi
cd ${UsrLocalBinDir} cd ${UsrLocalBinDir}
if [ ! -e ${OmcDaemon} ]; then ln -s ${OmcBinDir}/omcsvc.sh ${OmcDaemon}; fi if [ ! -e ${OMCDaemon} ]; then ln -s ${OMCBinDir}/omcsvc.sh ${OMCDaemon}; fi
chmod +rx ${OMCRootDir}/bin/* chmod +rx ${OMCRootDir}/bin/*
chmod +rx ${OMCRootDir}/* chmod +rx ${OMCRootDir}/*
@@ -51,9 +45,12 @@ chmod -R 755 ${OMCRootDir}/htdocs/front
for CFile in ${CFileList}; do for CFile in ${CFileList}; do
if [ ! -e "${OMCEtcDir}/${CFile}" ]; then if [ ! -e "${OMCEtcDir}/${CFile}" ]; then
cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir} cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir}
# else else
# mv -f ${OMCEtcDir}/${CFile} ${OMCEtcDir}/${CFile}.bak # mv -f ${OMCEtcDir}/${CFile} ${OMCEtcDir}/${CFile}.bak
# cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir} # cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir}
if [ -e "${OMCBinDir}/upgconf.sh" ]; then
${OMCBinDir}/upgconf.sh
fi
fi fi
done done
@@ -115,27 +112,25 @@ done
if [ ! -e "${FERootDir}/config.js" ]; then if [ ! -e "${FERootDir}/config.js" ]; then
cp ${FERootDir}/default/config.js ${FERootDir}; cp ${FERootDir}/default/config.js ${FERootDir};
fi fi
for LogoFile in ${LogoFileList}; do for LogoFile in ${LogoFileList}; do
if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then
cp ${OMCStaticDir}/agt.d/logo/${LogoFile} ${OMCStaticDir}/logo; cp ${OMCStaticDir}/omc.d/logo/${LogoFile} ${OMCStaticDir}/logo;
fi fi
done done
if ! id -u omc >/dev/null 2>&1 ; then if ! id -u omc >/dev/null 2>&1 ; then
useradd -d /opt/omc -m -s /bin/bash -pomc123 omc; useradd -d /opt/omc -m -s /bin/bash -pomc123 omc;
mkdir -p /opt/omc/ftp mkdir -p /opt/omc/ftp
else else
echo "user omc exist"; echo "user omc exist";
fi fi
if [ ! -e "${NginxConfDir}/omc.conf" ]; then if [ ! -e "${NginxConfDir}/omc.conf" ]; then
mkdir -p ${NginxConfDir} mkdir -p ${NginxConfDir}
cp -f ${OMCEtcDir}/nginx/omc.conf ${NginxConfDir}; cp -f ${OMCEtcDir}/nginx/omc.conf ${NginxConfDir};
fi fi
#cp -f ${OMCEtcDir}/nginx/default ${NginxSiteAvailable}
if [ -e "${NginxSiteAvailable}/default" ]; then
sed -i 's/listen 80 default_server;/listen 1080 default_server;/g' ${NginxSiteAvailable}/default
sed -i 's/listen \[::\]:80 default_server;/listen \[::\]:1080 default_server;/g' ${NginxSiteAvailable}/default
fi
# disable auto upgrade # disable auto upgrade
systemctl disable --now unattended-upgrades systemctl disable --now unattended-upgrades
@@ -144,12 +139,11 @@ systemctl enable restagent.service
systemctl enable crontask.service systemctl enable crontask.service
systemctl enable sshsvc.service systemctl enable sshsvc.service
systemctl enable captrace.service systemctl enable captrace.service
#systemctl enable kvdb.service
systemctl daemon-reload systemctl daemon-reload
#systemctl stop nginx.service
# read environment parameter and to do # read environment parameter and to do
if [ "$M_PARAM" == "install" -o "$M_PARAM" == "upgrade" ]; then if [ "$M_PARAM" = "install" -o "$M_PARAM" = "upgrade" ]; then
echo "M parameter: $M_PARAM" echo "M parameter: $M_PARAM"
if [ -n "$C_PARAM" ]; then if [ -n "$C_PARAM" ]; then
echo "C parameter: $C_PARAM" echo "C parameter: $C_PARAM"
@@ -164,15 +158,9 @@ if [ "$M_PARAM" == "install" -o "$M_PARAM" == "upgrade" ]; then
fi fi
fi fi
systemctl stop restagent.service echo -n "Starting OMC service ... "
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
#systemctl stop kvdb.service
#systemctl start nginx.service
#systemctl start kvdb.service
systemctl start crontask.service systemctl start crontask.service
systemctl start sshsvc.service systemctl start sshsvc.service
systemctl start captrace.service systemctl start captrace.service
systemctl start restagent.service systemctl start restagent.service
echo "done"

View File

@@ -1,27 +1,31 @@
# !/bin/bash # !/bin/bash
X86Lib64Dir=/lib/x86_64-linux-gnu X86Lib64Dir=/lib/x86_64-linux-gnu
cd ${X86Lib64Dir} rm -rf ${X86Lib64Dir}/libwireshark.so.15
rm libwireshark.so.15 rm -rf ${X86Lib64Dir}/libwireshark.so
rm libwireshark.so rm -rf ${X86Lib64Dir}/libwiretap.so.12
rm libwiretap.so.12 rm -rf ${X86Lib64Dir}/libwiretap.so
rm libwiretap.so rm -rf ${X86Lib64Dir}/libwsutil.so.13
rm libwsutil.so.13 rm -rf ${X86Lib64Dir}/libwsutil.so
rm libwsutil.so
systemctl stop nginx.service
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
#systemctl stop kvdb.service
#rm -rf /usr/local/omc #rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf rm -rf /etc/nginx/conf.d/omc.conf
rm -f /usr/local/bin/omcd rm -f /usr/local/bin/omcd
systemctl daemon-reload
if systemctl list-units --type=service --all | grep -q 'restagent.service'; then
echo -n "Stopping OMC service ... "
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
echo "done"
fi
systemctl disable restagent.service systemctl disable restagent.service
systemctl disable crontask.service systemctl disable crontask.service
systemctl disable sshsvc.service systemctl disable sshsvc.service
systemctl disable captrace.service systemctl disable captrace.service
#systemctl disable kvdb.service
systemctl daemon-reload systemctl daemon-reload

View File

@@ -1,6 +1,17 @@
# !/bin/bash # !/bin/bash
systemctl daemon-reload
if systemctl list-units --type=service --all | grep -q 'restagent.service'; then
echo -n "Stopping OMC service ... "
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
echo "done"
fi
FERootDir=/usr/local/omc/htdocs/front FERootDir=/usr/local/omc/htdocs/front
# apt-get install zip # apt-get install zip
# clear front-end old hash js files # clear front-end old hash js files
rm -rf ${FERootDir}/assets rm -rf ${FERootDir}/assets

View File

@@ -1,51 +1,40 @@
server { server {
listen 4443 ssl; listen 44080;
listen [::]:4443 ssl; listen 44443;
server_name 0.0.0.0; listen [::]:44080;
root /usr/local/omc/htdocs/front/; listen [::]:44443;
index index.html index.htm; server_name localhost;
server_name localhost;
# SSL
ssl_certificate /usr/local/omc/etc/certs/ca_cert.pem;
ssl_certificate_key /usr/local/omc/etc/certs/private_key.pem;
#ssl_certificate /usr/local/omc/etc/certs/tsa-omc.pem;
#ssl_certificate_key /usr/local/omc/etc/certs/tsa-omc_pri.pem;
# location /api/rest/securityManagement { client_max_body_size 100M;
# proxy_pass http://127.0.0.1:5050; keepalive_timeout 180s;
# }
# location /api/rest/resourceManagement { #access_log /var/log/nginx/host.access.log main;
# proxy_pass http://127.0.0.1:5050;
# } # ssl_certificate /usr/local/omc/etc/certs/omc-server.crt;
# location /api/rest/performanceManagement { # ssl_certificate_key /usr/local/omc/etc/certs/omc-server.key;
# proxy_pass http://127.0.0.1:5050; # ssl_client_certificate /usr/local/omc/etc/certs/omc-ca.crt;
# } # ssl_verify_client on;
# location /api/rest/faultManagement { # ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
# proxy_pass http://127.0.0.1:5050; # ssl_session_timeout 5m;
# } # ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
# location /api/rest/aaaa/ { # ssl_prefer_server_ciphers on;
# proxy_pass http://127.0.0.1:4040;
# } # OMC
location /api/rest/ {
proxy_pass http://127.0.0.1:3030;
}
location / { location / {
try_files $uri $uri/ =404; root /usr/local/omc/htdocs/front;
try_files $uri $uri/ /index.html;
index index.html index.htm;
} }
}
server {
listen 8888 default_server;
listen [::]:8888 default_server;
root /usr/local/omc/htdocs/front/;
index index.html index.htm;
server_name localhost;
location /omc-api/ { location /omc-api/ {
proxy_pass http://127.0.0.1:3030/; proxy_pass http://127.0.0.1:33030/;
proxy_http_version 1.1; proxy_connect_timeout 180s;
proxy_cache_bypass $http_upgrade; proxy_send_timeout 180s;
proxy_read_timeout 180s;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
proxy_set_header Host $host; proxy_set_header Host $host;
@@ -56,11 +45,27 @@ server {
proxy_set_header X-Forwarded-Port $server_port; proxy_set_header X-Forwarded-Port $server_port;
} }
location / { location /api/rest/ {
root /usr/local/omc/htdocs/front; proxy_pass http://127.0.0.1:33030/api/rest/;
try_files $uri $uri/ /index.html; proxy_cache_bypass $http_upgrade;
index index.html index.htm; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} }
} }

View File

@@ -1,11 +0,0 @@
[Service]
Type=forking
ExecStart=/usr/local/bin/kvdb-server /usr/local/etc/kvdb/kvdb.conf
ExecStopPost=
PIDFile=
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target

View File

@@ -4,35 +4,39 @@
# count: rotation count of log, default is 30 rotation # count: rotation count of log, default is 30 rotation
logger: logger:
file: /usr/local/omc/log/restagent.log file: /usr/local/omc/log/restagent.log
level: debug level: warn
duration: 24 duration: 24
count: 90 count: 90
# rest agent listen ipv4/v6 and port, support multiple routines # rest agent listen ipv4/v6 and port, support multiple routines
# ip: 0.0.0.0 or ::0, support IPv4/v6 # ip: 0.0.0.0 or ::0, support IPv4/v6
# clientAuthType: 0:NoClientCert (default), 1:RequestClientCert, 2:RequireAnyClientCert,
# 3:VerifyClientCertIfGiven, 4:RequireAndVerifyClientCerts
rest: rest:
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 3030 port: 33030
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 4443 port: 33443
schema: https schema: https
caFile: /usr/local/omc/etc/certs/rootca.crt clientAuthType: 0
certFile: /usr/local/omc/etc/certs/tsa-omc.crt caFile: /usr/local/omc/etc/certs/omc-ca.crt
keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key certFile: /usr/local/omc/etc/certs/omc-server.crt
keyFile: /usr/local/omc/etc/certs/omc-server.key
webServer: webServer:
enabled: true enabled: true
rootDir: /usr/local/omc/htdocs/front rootDir: /usr/local/omc/htdocs/front
listen: listen:
- addr: :8080 - addr: :80
schema: http schema: http
- addr: :8443 - addr: :443
schema: https schema: https
caFile: /usr/local/omc/etc/certs/rootca.crt clientAuthType: 0
certFile: /usr/local/omc/etc/certs/tsa-omc.crt caFile: /usr/local/omc/etc/certs/omc-ca.crt
keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key certFile: /usr/local/omc/etc/certs/omc-server.crt
keyFile: /usr/local/omc/etc/certs/omc-server.key
database: database:
type: mysql type: mysql
@@ -41,89 +45,116 @@ database:
host: 127.0.0.1 host: 127.0.0.1
port: 33066 port: 33066
name: tenants_db name: tenants_db
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
backup: /usr/local/omc/database backup: /usr/local/omc/database
# Redis 缓存数据,数据源声明全小写 # Redis data cache
redis: redis:
dataSource: dataSource:
# OMC系统使用库 # OMC system db
default: default:
port: 6379 # Redis port port: 6379 # Redis port
host: "127.0.0.1" # Redis host host: "127.0.0.1" # Redis host
password: "" password: "helloearth"
db: 10 # Redis db_num db: 10 # Redis db_num
# UDM网元用户库 # UDM sub/auth db
udmuser: udmuser:
port: 6379 # Redis port port: 6379 # Redis port
host: "127.0.0.1" host: "127.0.0.1"
password: "" password: "helloearth"
db: 0 # Redis db_num db: 0 # Redis db_num
# 多个数据源时可以用这个指定默认的数据源 # used to specify the default data source for multiple data resourece
defaultDataSourceName: "default" defaultDataSourceName: "default"
# sleep: time delay for after write buffer (millisecond)
# deadLine: timeout for io read and write (second)
mml: mml:
port: 4100 port: 4100
port2: 5002
sleep: 200 sleep: 200
deadLine: 10
sizeRow: 600
sizeCol: 128
bufferSize: 65535
user: admin user: admin
password: admin password: admin
mmlHome: ./mmlhome mmlHome: ./mmlhome
upload: /home/agtuser
# NE config
ne: ne:
user: agtuser user: omcuser
etcdir: /usr/local/etc etcdir: /usr/local/etc
bindir: /usr/local/bin bindir: /usr/local/bin
omcdir: /usr/local/omc omcdir: /usr/local/omc
scpdir: /tmp scpdir: /tmp
licensedir: /usr/local/etc/{neType}/license licensedir: /usr/local/etc/{neType}/license
# backup etc list of IMS, does not contain spaces
etcListIMS: '{*.yaml,mmtel,vars.cfg}'
etcListDefault: '{*.yaml,*.conf,*.cfg}'
# true/false to overwrite config file when dpkg ne software
dpkgOverwrite: false
# dpkg timeout (second)
dpkgTimeout: 180
# chk2ne: true/false, if put OmcNeConfig parameters to NE # chk2ne: true/false, if put OmcNeConfig parameters to NE
omc: omc:
uriPrefix: /api/rest/oam uriPrefix: "/omc/rest"
neType: OMC neType: OMC
neId: 001 neId: 001
rmUID: 4400HX101 rmUID: 4400HX101
neName: OMC neName: OMC
province: GD province: ""
vendor: "" vendor: ""
dn: 4600 dn: ""
chk2ne: false chk2ne: false
sn: 13750650 sn: "-"
checksign: false checksign: false
rootDir: /usr/local/omc
binDir: /usr/local/omc/bin
backup: /usr/local/omc/backup backup: /usr/local/omc/backup
upload: /usr/local/omc/upload upload: /usr/local/omc/upload
frontUpload: /usr/local/omc/htdocs/front/upload frontUpload: /usr/local/omc/htdocs/front/upload
frontTraceDir: /usr/local/omc/htdocs/front/trace frontTraceDir: /usr/local/omc/htdocs/front/trace
software: /usr/local/omc/software software: /usr/local/omc/software
license: /usr/local/omc/license license: /usr/local/omc/license
gtpUri: gtp:192.168.2.119:2152 gtpUri: gtp:192.168.2.119:32152
checkContentType: false checkContentType: false
testMode: false testMode: false
rbacMode: true rbacMode: true
runDir: /usr/local/omc/run runDir: /usr/local/omc/run
cmdTimeout: 120
# Alarm module setting # Alarm module setting
# Forward interface: # Forward interface:
# email/sms # email/sms/smsc
alarm: alarm:
forwardAlarm: true forwardAlarm: true
email: email:
smtp: smtp@xxx.com smtp: smtp.xxx.com
port: 25 port: 25
user: smtpuser user: smtpuser@xxx.com
password: smtpuser@omc password: xxxxxx
# TLS skip verify: true/false
tlsSkipVerify: true
smProxy: smsc
sms: sms:
apiURL: http://smsc.xxx.com apiURL: http://smsc.xxx.com
accessKeyID: xxx accessKeyID: xxx
accessKeySecret: xxx accessKeySecret: xxx
signName: XXX SMSC signName: XXX SMSC
templateCode: 1000 templateCode: 1000
smsc:
addr: "192.168.13.114:2775"
systemID: "alarmsmsfw"
password: "omc123"
systemType: ""
#User authorized information # User authorized information
# crypt: mysql/md5/bcrypt # crypt: mysql/md5/bcrypt
# token: true/false to check accessToken # token: true/false to check accessToken
# expires for session, unit: second # expires for session, unit: second
# Support single/multiple session of user # Support single/multiple session of user
#
auth: auth:
crypt: bcrypt crypt: bcrypt
token: true token: true
@@ -148,5 +179,5 @@ params:
rmuidregexp: "[0-9]{4}[A-Z]{2}[A-Z]{2}[0-9A-Z]{1}[0-9A-Z]{3}[0-9A-Z]{1,16}" rmuidregexp: "[0-9]{4}[A-Z]{2}[A-Z]{2}[0-9A-Z]{1}[0-9A-Z]{3}[0-9A-Z]{1,16}"
testConfig: testConfig:
enabled: true enabled: false
file: /usr/local/omc/etc/testconfig.yaml file: /usr/local/omc/etc/testconfig.yaml

View File

@@ -1,5 +1,5 @@
Package: OMC Package: OMC
Version: 2.2408.1-YYYYMMDD Version: 2.2410.1-YYYYMMDD
Section: AGrandTech Section: AGrandTech
Prioritt: optional Prioritt: optional
Architecture: amd64 Architecture: amd64

View File

@@ -1,21 +1,16 @@
# !/bin/bash # !/bin/bash
RedisRootDir=/usr/local
OMCRootDir=/usr/local/omc OMCRootDir=/usr/local/omc
RedisOldRootDir=/usr/local/db
RedisConfDir=${RedisRootDir}/etc/kvdb
DependsRootDir=${OMCRootDir}/depends
SystemdRootDir=/lib/systemd/system SystemdRootDir=/lib/systemd/system
OMCEtcDir=${OMCRootDir}/etc OMCEtcDir=${OMCRootDir}/etc
FERootDir=${OMCRootDir}/htdocs/front FERootDir=${OMCRootDir}/htdocs/front
X86Lib64Dir=/lib/x86_64-linux-gnu X86Lib64Dir=/lib/x86_64-linux-gnu
OmcBinDir=${OMCRootDir}/bin OMCBinDir=${OMCRootDir}/bin
OMCStaticDir=${OMCRootDir}/static OMCStaticDir=${OMCRootDir}/static
UsrLocalBinDir=/usr/local/bin UsrLocalBinDir=/usr/local/bin
OmcDaemon=omcd OMCDaemon=omcd
NginxEtcDir=/etc/nginx NginxEtcDir=/etc/nginx
NginxConfDir=${NginxEtcDir}/conf.d NginxConfDir=${NginxEtcDir}/conf.d
NginxSiteAvailable=${NginxEtcDir}/sites-available
CFileList="restconf.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml omc.conf" CFileList="restconf.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml omc.conf"
LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png" LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png"
@@ -25,7 +20,6 @@ echo " sudo systemctl start/stop/restart/status restagent.service"
echo " sudo systemctl start/stop/restart/status crontask.service" echo " sudo systemctl start/stop/restart/status crontask.service"
echo " sudo systemctl start/stop/restart/status sshsvc.service" echo " sudo systemctl start/stop/restart/status sshsvc.service"
echo " sudo systemctl start/stop/restart/status captrace.service" echo " sudo systemctl start/stop/restart/status captrace.service"
echo " sudo systemctl start/stop/restart/status kvdb.service"
echo " or run: " echo " or run: "
echo " sudo /usr/local/omc/bin/omcsvc.sh start/stop/restart/status" echo " sudo /usr/local/omc/bin/omcsvc.sh start/stop/restart/status"
echo "" echo ""
@@ -41,7 +35,7 @@ chmod +rx libwsutil.so.13.1.0
if [ ! -e libwsutil.so.13 ]; then ln -s libwsutil.so.13.1.0 libwsutil.so.13; fi if [ ! -e libwsutil.so.13 ]; then ln -s libwsutil.so.13.1.0 libwsutil.so.13; fi
if [ ! -e libwsutil.so ]; then ln -s libwsutil.so.13.1.0 libwsutil.so; fi if [ ! -e libwsutil.so ]; then ln -s libwsutil.so.13.1.0 libwsutil.so; fi
cd ${UsrLocalBinDir} cd ${UsrLocalBinDir}
if [ ! -e ${OmcDaemon} ]; then ln -s ${OmcBinDir}/omcsvc.sh ${OmcDaemon}; fi if [ ! -e ${OMCDaemon} ]; then ln -s ${OMCBinDir}/omcsvc.sh ${OMCDaemon}; fi
chmod +rx ${OMCRootDir}/bin/* chmod +rx ${OMCRootDir}/bin/*
chmod +rx ${OMCRootDir}/* chmod +rx ${OMCRootDir}/*
@@ -51,91 +45,36 @@ chmod -R 755 ${OMCRootDir}/htdocs/front
for CFile in ${CFileList}; do for CFile in ${CFileList}; do
if [ ! -e "${OMCEtcDir}/${CFile}" ]; then if [ ! -e "${OMCEtcDir}/${CFile}" ]; then
cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir} cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir}
# else else
# mv -f ${OMCEtcDir}/${CFile} ${OMCEtcDir}/${CFile}.bak # mv -f ${OMCEtcDir}/${CFile} ${OMCEtcDir}/${CFile}.bak
# cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir} # cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir}
if [ -e "${OMCBinDir}/upgconf.sh" ]; then
${OMCBinDir}/upgconf.sh
fi
fi fi
done done
# # Install redis db if not exist /usr/local/db
# if [ ! -e "${RedisRootDir}/bin/kvdb-server" ]; then
# # if [ ! -e "${RedisRootDir}" ]; then
# # mkdir -p ${RedisRootDir}
# # fi
# # stop old adb service
# if [ -e "${RedisOldRootDir}/bin/redis-server" ] && [ -e "${SystemdRootDir}/adb.service" ]; then
# systemctl stop adb.service
# systemctl disable adb.service
# fi
# # stop adb service
# if [ -e "${UsrLocalBinDir}/adb-server" ] && [ -e "${SystemdRootDir}/adb.service" ]; then
# systemctl stop adb.service
# systemctl disable adb.service
# fi
# cp -rf ${DependsRootDir}/kvdb/* /
# chmod +rx ${RedisRootDir}/bin/kvdb*
# if [ ! -e "${RedisConfDir}/kvdb.conf" ]; then
# cp ${RedisConfDir}/default/kvdb.conf ${RedisConfDir};
# fi
# sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/kvdb.conf
# LINE="masterauth helloearth"
# FILE="${RedisConfDir}/kvdb.conf"
# # 检查文件中是否存在该行
# if ! grep -qxF "$LINE" "$FILE"; then
# # 如果不存在,将其添加到文件末尾
# echo "$LINE" >> "$FILE"
# fi
# # copy the old adb dump.rdb
# if [ -e "${RedisOldRootDir}/bin/conf/dump.rdb" ] && [ ! -e "${RedisConfDir}/dump.rdb" ]; then
# cp -f ${RedisOldRootDir}/bin/conf/dump.rdb ${RedisConfDir};
# mv -f ${RedisRootDir}/db ${RedisRootDir}/adb.old
# fi
# # copy the adb dump.rdb
# if [ -e "${RedisRootDir}/etc/adb/dump.rdb" ] && [ ! -e "${RedisRootDir}/etc/kvdb/dump.rdb" ]; then
# cp -f ${RedisRootDir}/etc/adb/dump.rdb ${RedisRootDir}/etc/kvdb/;
# mv -f ${RedisRootDir}/etc/adb ${RedisRootDir}/etc/adb.old
# fi
# # cp -f ${DependsRootDir}/systemd/kvdb.service ${SystemdRootDir}
# else
# if [ ! -e "${RedisConfDir}/kvdb.conf" ]; then
# cp ${RedisConfDir}/default/kvdb.conf ${RedisConfDir}
# fi
# sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/kvdb.conf
# LINE="masterauth helloearth"
# FILE="${RedisConfDir}/kvdb.conf"
# # 检查文件中是否存在该行
# if ! grep -qxF "$LINE" "$FILE"; then
# # 如果不存在,将其添加到文件末尾
# echo "$LINE" >> "$FILE"
# fi
# fi
if [ ! -e "${FERootDir}/config.js" ]; then if [ ! -e "${FERootDir}/config.js" ]; then
cp ${FERootDir}/default/config.js ${FERootDir}; cp ${FERootDir}/default/config.js ${FERootDir};
fi fi
for LogoFile in ${LogoFileList}; do for LogoFile in ${LogoFileList}; do
if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then
cp ${OMCStaticDir}/agt.d/logo/${LogoFile} ${OMCStaticDir}/logo; cp ${OMCStaticDir}/omc.d/logo/${LogoFile} ${OMCStaticDir}/logo;
fi fi
done done
if ! id -u omc >/dev/null 2>&1 ; then if ! id -u omc >/dev/null 2>&1 ; then
useradd -d /opt/omc -m -s /bin/bash -pomc123 omc; useradd -d /opt/omc -m -s /bin/bash -pomc123 omc;
mkdir -p /opt/omc/ftp mkdir -p /opt/omc/ftp
else else
echo "user omc exist"; echo "user omc exist";
fi fi
if [ ! -e "${NginxConfDir}/omc.conf" ]; then if [ ! -e "${NginxConfDir}/omc.conf" ]; then
mkdir -p ${NginxConfDir} mkdir -p ${NginxConfDir}
cp -f ${OMCEtcDir}/nginx/omc.conf ${NginxConfDir}; cp -f ${OMCEtcDir}/nginx/omc.conf ${NginxConfDir};
fi fi
#cp -f ${OMCEtcDir}/nginx/default ${NginxSiteAvailable}
if [ -e "${NginxSiteAvailable}/default" ]; then
sed -i 's/listen 80 default_server;/listen 1080 default_server;/g' ${NginxSiteAvailable}/default
sed -i 's/listen \[::\]:80 default_server;/listen \[::\]:1080 default_server;/g' ${NginxSiteAvailable}/default
fi
# disable auto upgrade # disable auto upgrade
systemctl disable --now unattended-upgrades systemctl disable --now unattended-upgrades
@@ -144,12 +83,11 @@ systemctl enable restagent.service
systemctl enable crontask.service systemctl enable crontask.service
systemctl enable sshsvc.service systemctl enable sshsvc.service
systemctl enable captrace.service systemctl enable captrace.service
#systemctl enable kvdb.service
systemctl daemon-reload systemctl daemon-reload
#systemctl stop nginx.service
# read environment parameter and to do # read environment parameter and to do
if [ "$M_PARAM" == "install" -o "$M_PARAM" == "upgrade" ]; then if [ "$M_PARAM" = "install" -o "$M_PARAM" = "upgrade" ]; then
echo "M parameter: $M_PARAM" echo "M parameter: $M_PARAM"
if [ -n "$C_PARAM" ]; then if [ -n "$C_PARAM" ]; then
echo "C parameter: $C_PARAM" echo "C parameter: $C_PARAM"
@@ -164,15 +102,9 @@ if [ "$M_PARAM" == "install" -o "$M_PARAM" == "upgrade" ]; then
fi fi
fi fi
systemctl stop restagent.service echo -n "Starting OMC service ... "
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
#systemctl stop kvdb.service
#systemctl start nginx.service
#systemctl start kvdb.service
systemctl start crontask.service systemctl start crontask.service
systemctl start sshsvc.service systemctl start sshsvc.service
systemctl start captrace.service systemctl start captrace.service
systemctl start restagent.service systemctl start restagent.service
echo "done"

View File

@@ -1,27 +1,31 @@
# !/bin/bash # !/bin/bash
X86Lib64Dir=/lib/x86_64-linux-gnu X86Lib64Dir=/lib/x86_64-linux-gnu
cd ${X86Lib64Dir} rm -rf ${X86Lib64Dir}/libwireshark.so.15
rm libwireshark.so.15 rm -rf ${X86Lib64Dir}/libwireshark.so
rm libwireshark.so rm -rf ${X86Lib64Dir}/libwiretap.so.12
rm libwiretap.so.12 rm -rf ${X86Lib64Dir}/libwiretap.so
rm libwiretap.so rm -rf ${X86Lib64Dir}/libwsutil.so.13
rm libwsutil.so.13 rm -rf ${X86Lib64Dir}/libwsutil.so
rm libwsutil.so
systemctl stop nginx.service
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
#systemctl stop kvdb.service
#rm -rf /usr/local/omc #rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf rm -rf /etc/nginx/conf.d/omc.conf
rm -f /usr/local/bin/omcd rm -f /usr/local/bin/omcd
systemctl daemon-reload
if systemctl list-units --type=service --all | grep -q 'restagent.service'; then
echo -n "Stopping OMC service ... "
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
echo "done"
fi
systemctl disable restagent.service systemctl disable restagent.service
systemctl disable crontask.service systemctl disable crontask.service
systemctl disable sshsvc.service systemctl disable sshsvc.service
systemctl disable captrace.service systemctl disable captrace.service
#systemctl disable kvdb.service
systemctl daemon-reload systemctl daemon-reload

View File

@@ -1,6 +1,17 @@
# !/bin/bash # !/bin/bash
systemctl daemon-reload
if systemctl list-units --type=service --all | grep -q 'restagent.service'; then
echo -n "Stopping OMC service ... "
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
echo "done"
fi
FERootDir=/usr/local/omc/htdocs/front FERootDir=/usr/local/omc/htdocs/front
# apt-get install zip # apt-get install zip
# clear front-end old hash js files # clear front-end old hash js files
rm -rf ${FERootDir}/assets rm -rf ${FERootDir}/assets

View File

@@ -1,51 +1,40 @@
server { server {
listen 4443 ssl; listen 44080;
listen [::]:4443 ssl; listen 44443;
server_name 0.0.0.0; listen [::]:44080;
root /usr/local/omc/htdocs/front/; listen [::]:44443;
index index.html index.htm; server_name localhost;
server_name localhost;
# SSL
ssl_certificate /usr/local/omc/etc/certs/ca_cert.pem;
ssl_certificate_key /usr/local/omc/etc/certs/private_key.pem;
#ssl_certificate /usr/local/omc/etc/certs/tsa-omc.pem;
#ssl_certificate_key /usr/local/omc/etc/certs/tsa-omc_pri.pem;
# location /api/rest/securityManagement { client_max_body_size 100M;
# proxy_pass http://127.0.0.1:5050; keepalive_timeout 180s;
# }
# location /api/rest/resourceManagement { #access_log /var/log/nginx/host.access.log main;
# proxy_pass http://127.0.0.1:5050;
# } # ssl_certificate /usr/local/omc/etc/certs/omc-server.crt;
# location /api/rest/performanceManagement { # ssl_certificate_key /usr/local/omc/etc/certs/omc-server.key;
# proxy_pass http://127.0.0.1:5050; # ssl_client_certificate /usr/local/omc/etc/certs/omc-ca.crt;
# } # ssl_verify_client on;
# location /api/rest/faultManagement { # ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
# proxy_pass http://127.0.0.1:5050; # ssl_session_timeout 5m;
# } # ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
# location /api/rest/aaaa/ { # ssl_prefer_server_ciphers on;
# proxy_pass http://127.0.0.1:4040;
# } # OMC
location /api/rest/ {
proxy_pass http://127.0.0.1:3030;
}
location / { location / {
try_files $uri $uri/ =404; root /usr/local/omc/htdocs/front;
try_files $uri $uri/ /index.html;
index index.html index.htm;
} }
}
server {
listen 8888 default_server;
listen [::]:8888 default_server;
root /usr/local/omc/htdocs/front/;
index index.html index.htm;
server_name localhost;
location /omc-api/ { location /omc-api/ {
proxy_pass http://127.0.0.1:3030/; proxy_pass http://127.0.0.1:33030/;
proxy_http_version 1.1; proxy_connect_timeout 180s;
proxy_cache_bypass $http_upgrade; proxy_send_timeout 180s;
proxy_read_timeout 180s;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
proxy_set_header Host $host; proxy_set_header Host $host;
@@ -56,11 +45,27 @@ server {
proxy_set_header X-Forwarded-Port $server_port; proxy_set_header X-Forwarded-Port $server_port;
} }
location / { location /api/rest/ {
root /usr/local/omc/htdocs/front; proxy_pass http://127.0.0.1:33030/api/rest/;
try_files $uri $uri/ /index.html; proxy_cache_bypass $http_upgrade;
index index.html index.htm; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} }
} }

View File

@@ -1,11 +0,0 @@
[Service]
Type=forking
ExecStart=/usr/local/bin/kvdb-server /usr/local/etc/kvdb/kvdb.conf
ExecStopPost=
PIDFile=
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target

View File

@@ -4,35 +4,39 @@
# count: rotation count of log, default is 30 rotation # count: rotation count of log, default is 30 rotation
logger: logger:
file: /usr/local/omc/log/restagent.log file: /usr/local/omc/log/restagent.log
level: debug level: warn
duration: 24 duration: 24
count: 90 count: 90
# rest agent listen ipv4/v6 and port, support multiple routines # rest agent listen ipv4/v6 and port, support multiple routines
# ip: 0.0.0.0 or ::0, support IPv4/v6 # ip: 0.0.0.0 or ::0, support IPv4/v6
# clientAuthType: 0:NoClientCert (default), 1:RequestClientCert, 2:RequireAnyClientCert,
# 3:VerifyClientCertIfGiven, 4:RequireAndVerifyClientCerts
rest: rest:
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 3030 port: 33030
- ipv4: 0.0.0.0 - ipv4: 0.0.0.0
ipv6: ipv6:
port: 4443 port: 33443
schema: https schema: https
caFile: /usr/local/omc/etc/certs/rootca.crt clientAuthType: 0
certFile: /usr/local/omc/etc/certs/tsa-omc.crt caFile: /usr/local/omc/etc/certs/omc-ca.crt
keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key certFile: /usr/local/omc/etc/certs/omc-server.crt
keyFile: /usr/local/omc/etc/certs/omc-server.key
webServer: webServer:
enabled: true enabled: true
rootDir: /usr/local/omc/htdocs/front rootDir: /usr/local/omc/htdocs/front
listen: listen:
- addr: :8080 - addr: :80
schema: http schema: http
- addr: :8443 - addr: :443
schema: https schema: https
caFile: /usr/local/omc/etc/certs/rootca.crt clientAuthType: 0
certFile: /usr/local/omc/etc/certs/tsa-omc.crt caFile: /usr/local/omc/etc/certs/omc-ca.crt
keyFile: /usr/local/omc/etc/certs/tsa-omc_pri.key certFile: /usr/local/omc/etc/certs/omc-server.crt
keyFile: /usr/local/omc/etc/certs/omc-server.key
database: database:
type: mysql type: mysql
@@ -43,87 +47,113 @@ database:
name: tenants_db name: tenants_db
backup: /usr/local/omc/database backup: /usr/local/omc/database
# Redis 缓存数据,数据源声明全小写 # Redis data cache
redis: redis:
dataSource: dataSource:
# OMC系统使用库 # OMC system db
default: default:
port: 6379 # Redis port port: 6379 # Redis port
host: "127.0.0.1" # Redis host host: "127.0.0.1" # Redis host
password: "" password: "helloearth"
db: 10 # Redis db_num db: 10 # Redis db_num
# UDM网元用户库 # UDM sub/auth db
udmuser: udmuser:
port: 6379 # Redis port port: 6379 # Redis port
host: "127.0.0.1" host: "127.0.0.1"
password: "" password: "helloearth"
db: 0 # Redis db_num db: 0 # Redis db_num
# 多个数据源时可以用这个指定默认的数据源 # used to specify the default data source for multiple data resourece
defaultDataSourceName: "default" defaultDataSourceName: "default"
# sleep: time delay for after write buffer (millisecond)
# deadLine: timeout for io read and write (second)
mml: mml:
port: 4100 port: 4100
port2: 5002
sleep: 200 sleep: 200
deadLine: 10
sizeRow: 600
sizeCol: 128
bufferSize: 65535
user: admin user: admin
password: admin password: admin
mmlHome: ./mmlhome mmlHome: ./mmlhome
upload: /home/agtuser
# NE config
ne: ne:
user: agtuser user: omcuser
etcdir: /usr/local/etc etcdir: /usr/local/etc
bindir: /usr/local/bin bindir: /usr/local/bin
omcdir: /usr/local/omc omcdir: /usr/local/omc
scpdir: /tmp scpdir: /tmp
licensedir: /usr/local/etc/{neType}/license licensedir: /usr/local/etc/{neType}/license
# backup etc list of IMS, does not contain spaces
etcListIMS: '{*.yaml,mmtel,vars.cfg}'
etcListDefault: '{*.yaml,*.conf,*.cfg}'
# true/false to overwrite config file when dpkg ne software
dpkgOverwrite: false
# dpkg timeout (second)
dpkgTimeout: 180
# chk2ne: true/false, if put OmcNeConfig parameters to NE # chk2ne: true/false, if put OmcNeConfig parameters to NE
omc: omc:
uriPrefix: /api/rest/oam uriPrefix: "/omc/rest"
neType: OMC neType: OMC
neId: 001 neId: 001
rmUID: 4400HX101 rmUID: 4400HX101
neName: OMC neName: OMC
province: GD province: ""
vendor: "" vendor: ""
dn: 4600 dn: ""
chk2ne: false chk2ne: false
sn: 13750650 sn: "-"
checksign: false checksign: false
rootDir: /usr/local/omc
binDir: /usr/local/omc/bin
backup: /usr/local/omc/backup backup: /usr/local/omc/backup
upload: /usr/local/omc/upload upload: /usr/local/omc/upload
frontUpload: /usr/local/omc/htdocs/front/upload frontUpload: /usr/local/omc/htdocs/front/upload
frontTraceDir: /usr/local/omc/htdocs/front/trace frontTraceDir: /usr/local/omc/htdocs/front/trace
software: /usr/local/omc/software software: /usr/local/omc/software
license: /usr/local/omc/license license: /usr/local/omc/license
gtpUri: gtp:192.168.2.119:2152 gtpUri: gtp:192.168.2.119:32152
checkContentType: false checkContentType: false
testMode: false testMode: false
rbacMode: true rbacMode: true
runDir: /usr/local/omc/run runDir: /usr/local/omc/run
cmdTimeout: 120
# Alarm module setting # Alarm module setting
# Forward interface: # Forward interface:
# email/sms # email/sms/smsc
alarm: alarm:
forwardAlarm: true forwardAlarm: true
email: email:
smtp: smtp@xxx.com smtp: smtp.xxx.com
port: 25 port: 25
user: smtpuser user: smtpuser@xxx.com
password: smtpuser@omc password: xxxxxx
# TLS skip verify: true/false
tlsSkipVerify: true
smProxy: smsc
sms: sms:
apiURL: http://smsc.xxx.com apiURL: http://smsc.xxx.com
accessKeyID: xxx accessKeyID: xxx
accessKeySecret: xxx accessKeySecret: xxx
signName: XXX SMSC signName: XXX SMSC
templateCode: 1000 templateCode: 1000
smsc:
addr: "192.168.13.114:2775"
systemID: "alarmsmsfw"
password: "omc123"
systemType: ""
#User authorized information # User authorized information
# crypt: mysql/md5/bcrypt # crypt: mysql/md5/bcrypt
# token: true/false to check accessToken # token: true/false to check accessToken
# expires for session, unit: second # expires for session, unit: second
# Support single/multiple session of user # Support single/multiple session of user
#
auth: auth:
crypt: bcrypt crypt: bcrypt
token: true token: true
@@ -148,5 +178,5 @@ params:
rmuidregexp: "[0-9]{4}[A-Z]{2}[A-Z]{2}[0-9A-Z]{1}[0-9A-Z]{3}[0-9A-Z]{1,16}" rmuidregexp: "[0-9]{4}[A-Z]{2}[A-Z]{2}[0-9A-Z]{1}[0-9A-Z]{3}[0-9A-Z]{1,16}"
testConfig: testConfig:
enabled: true enabled: false
file: /usr/local/omc/etc/testconfig.yaml file: /usr/local/omc/etc/testconfig.yaml

File diff suppressed because one or more lines are too long

View File

@@ -73,4 +73,11 @@ D:\local.git\ems.agt\tools\loadpconf> go run .\loadpconf.go .\load.go .\db.go -p
D:\local.git\ems.agt\tools\loadmconf> go run .\loadmconf.go .\load.go .\db.go -m ..\..\config\mml\system\mme_sys_mml_config.yaml D:\local.git\ems.agt\tools\loadmconf> go run .\loadmconf.go .\load.go .\db.go -m ..\..\config\mml\system\mme_sys_mml_config.yaml
# ssh信任关系绑定出错时执行 # ssh信任关系绑定出错时执行
ssh-keygen -f "/root/.ssh/known_hosts" -R "20.15.0.190" ssh-keygen -f "/root/.ssh/known_hosts" -R "20.15.0.190"
# mariadb 10.6 创建修改用户密码和权限
grant all privileges on *.* to root@'%' IDENTIFIED BY "admin123@EMS" with grant option;
flush privileges;
grant all privileges on *.* to root@'localhost' IDENTIFIED BY "admin123@EMS" with grant option;
flush privileges;

View File

@@ -1,51 +1,40 @@
server { server {
listen 4443 ssl; listen 44080;
listen [::]:4443 ssl; listen 44443;
server_name 0.0.0.0; listen [::]:44080;
root /usr/local/omc/htdocs/front/; listen [::]:44443;
index index.html index.htm; server_name localhost;
server_name localhost;
# SSL
ssl_certificate /usr/local/omc/etc/certs/ca_cert.pem;
ssl_certificate_key /usr/local/omc/etc/certs/private_key.pem;
#ssl_certificate /usr/local/omc/etc/certs/tsa-omc.pem;
#ssl_certificate_key /usr/local/omc/etc/certs/tsa-omc_pri.pem;
# location /api/rest/securityManagement { client_max_body_size 100M;
# proxy_pass http://127.0.0.1:5050; keepalive_timeout 180s;
# }
# location /api/rest/resourceManagement { #access_log /var/log/nginx/host.access.log main;
# proxy_pass http://127.0.0.1:5050;
# } # ssl_certificate /usr/local/omc/etc/certs/omc-server.crt;
# location /api/rest/performanceManagement { # ssl_certificate_key /usr/local/omc/etc/certs/omc-server.key;
# proxy_pass http://127.0.0.1:5050; # ssl_client_certificate /usr/local/omc/etc/certs/omc-ca.crt;
# } # ssl_verify_client on;
# location /api/rest/faultManagement { # ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
# proxy_pass http://127.0.0.1:5050; # ssl_session_timeout 5m;
# } # ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
# location /api/rest/aaaa/ { # ssl_prefer_server_ciphers on;
# proxy_pass http://127.0.0.1:4040;
# } # OMC
location /api/rest/ {
proxy_pass http://127.0.0.1:3030;
}
location / { location / {
try_files $uri $uri/ =404; root /usr/local/omc/htdocs/front;
try_files $uri $uri/ /index.html;
index index.html index.htm;
} }
}
server {
listen 8888 default_server;
listen [::]:8888 default_server;
root /usr/local/omc/htdocs/front/;
index index.html index.htm;
server_name localhost;
location /omc-api/ { location /omc-api/ {
proxy_pass http://127.0.0.1:3030/; proxy_pass http://127.0.0.1:33030/;
proxy_http_version 1.1; proxy_connect_timeout 180s;
proxy_cache_bypass $http_upgrade; proxy_send_timeout 180s;
proxy_read_timeout 180s;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
proxy_set_header Host $host; proxy_set_header Host $host;
@@ -56,11 +45,27 @@ server {
proxy_set_header X-Forwarded-Port $server_port; proxy_set_header X-Forwarded-Port $server_port;
} }
location / { location /api/rest/ {
root /usr/local/omc/htdocs/front; proxy_pass http://127.0.0.1:33030/api/rest/;
try_files $uri $uri/ /index.html; proxy_cache_bypass $http_upgrade;
index index.html index.htm; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} }
} }

View File

@@ -1,84 +0,0 @@
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 1080;
listen [::]:1080;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl http2;
# listen [::]:443 ssl http2;
# server_name _;
# root /usr/share/nginx/html;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers PROFILE=SYSTEM;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }
}

View File

@@ -1,11 +0,0 @@
[Service]
Type=forking
ExecStart=/usr/local/bin/kvdb-server /usr/local/etc/kvdb/kvdb.conf
ExecStopPost=
PIDFile=
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target

View File

@@ -7,118 +7,69 @@
%define project_Uname OMC %define project_Uname OMC
Name: %{project_lname} Name: %{project_lname}
Summary: AGrandTech 5GC OMC Summary: 5GC OMC
Version: 2.2408.1 Version: 2.2410.1
Release: %{release_date} Release: %{release_date}
Vendor: AGrandTech Vendor: omc
URL: https://www.agrandtech.com/ URL: https://www.omc.com/
License: commercial License: commercial
Group: Applications/Communications Group: Applications/Communications
#BuildRoot: $PWD/rpmoutput #BuildRoot: $PWD/rpmoutput
%description %description
AGrandTech's 5GC OMC 5GC OMC
%prep %prep
rm -rf ${RPM_BUILD_ROOT}/* rm -rf ${RPM_BUILD_ROOT}/*
#rm -rf ${RPM_BUILD_ROOT}/lib
#rm -rf ${RPM_BUILD_ROOT}/usr
mkdir -p ${RPM_BUILD_ROOT} mkdir -p ${RPM_BUILD_ROOT}
cd ${RPM_BUILD_ROOT}
#mkdir -p usr/local/omc/
#mkdir -p usr/local/db/
#mkdir -p etc/nginx/conf.d
#mkdir -p lib/systemd/system/
#cd ${RPM_BUILD_DIR}
cp -rf ${RPM_BUILD_DIR}/* ${RPM_BUILD_ROOT}/ cp -rf ${RPM_BUILD_DIR}/* ${RPM_BUILD_ROOT}/
chmod +rx ${RPM_BUILD_ROOT}/usr/local/omc chmod +rx ${RPM_BUILD_ROOT}/usr/local/omc
chmod +rx ${RPM_BUILD_ROOT}/usr/local/omc/* chmod +rx ${RPM_BUILD_ROOT}/usr/local/omc/*
# chmod +rx ${RPM_BUILD_ROOT}/usr/local/db/bin/*
chmod +rx ${RPM_BUILD_ROOT}/usr/local/bin/* chmod +rx ${RPM_BUILD_ROOT}/usr/local/bin/*
chmod -R 755 ${RPM_BUILD_ROOT}/usr/local/omc/htdocs/front chmod +x ${RPM_BUILD_ROOT}/usr/local/omc/htdocs/front
chmod +rx ${RPM_BUILD_ROOT}/usr/lib64/* chmod +rx ${RPM_BUILD_ROOT}/usr/lib64/*
#cp -rf omc/.ssh ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf omc/mmllog ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf omc/mmlhome ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf omc/bin ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf omc/etc ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf omc/htdocs ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf omc/log ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf omc/backup ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf omc/upload ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf omc/software ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf omc/license ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf omc/database ${RPM_BUILD_ROOT}/usr/local/omc/
#cp -rf db/* ${RPM_BUILD_ROOT}/usr/local/db/
#cp -f nginx/omc.conf ${RPM_BUILD_ROOT}/etc/nginx/conf.d/
#cp -f systemd/restagent.service ${RPM_BUILD_ROOT}/lib/systemd/system/restagent.service
#cp -f systemd/crontask.service ${RPM_BUILD_ROOT}/lib/systemd/system/crontask.service
#cp -f systemd/sshsvc.service ${RPM_BUILD_ROOT}/lib/systemd/system/sshsvc.service
#cp -f systemd/captrace.service ${RPM_BUILD_ROOT}/lib/systemd/system/captrace.service
#cp -f systemd/kvdb.service ${RPM_BUILD_ROOT}/lib/systemd/system/kvdb.service
%build
#cd %{buildroot}/..
#make
# 安装完成后执行 # 安装完成后执行
%post %post
OmcRootDir=/usr/local/omc OMCRootDir=/usr/local/omc
DependsRootDir=${OmcRootDir}/depends OMCEtcDir=${OMCRootDir}/etc
RedisBinDir=/usr/local/bin FERootDir=${OMCRootDir}/htdocs/front
RedisConfDir=/usr/local/etc/kvdb
OMCEtcDir=${OmcRootDir}/etc
FERootDir=${OmcRootDir}/htdocs/front
UsrLib64Dir=/usr/lib64 UsrLib64Dir=/usr/lib64
OmcBinDir=${OmcRootDir}/bin OMCBinDir=${OMCRootDir}/bin
OMCStaticDir=${OmcRootDir}/static OMCStaticDir=${OMCRootDir}/static
UsrLocalBinDir=/usr/local/bin UsrLocalBinDir=/usr/local/bin
OmcDaemon=omcd OMCDaemon=omcd
NginxEtcDir=/etc/nginx NginxEtcDir=/etc/nginx
CFileList="restconf.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml omc.conf" CFileList="restconf.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml omc.conf"
LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png" LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png"
echo -n "Stopping OMC service ... "
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
echo "done"
for CFile in ${CFileList}; do for CFile in ${CFileList}; do
if [ ! -e "${OMCEtcDir}/${CFile}" ]; then if [ ! -e "${OMCEtcDir}/${CFile}" ]; then
cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir} cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir}
else else
mv -f ${OMCEtcDir}/${CFile} ${OMCEtcDir}/${CFile}.bak # mv -f ${OMCEtcDir}/${CFile} ${OMCEtcDir}/${CFile}.bak
cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir} # cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir}
if [ -e "${OMCBinDir}/upgconf.sh" ]; then
${OMCBinDir}/upgconf.sh
fi
fi fi
done done
# Check if install kvdb
if [ ! -e "${RedisBinDir}/kvdb-server" ]; then
cp -rf ${DependsRootDir}/kvdb/* /
chmod 755 ${RedisBinDir}/kvdb*
systemctl enable kvdb.service
fi
if [ ! -e "${RedisConfDir}/kvdb.conf" ]; then
cp ${RedisConfDir}/default/kvdb.conf ${RedisConfDir};
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/kvdb.conf
LINE="masterauth helloearth"
FILE="${RedisConfDir}/kvdb.conf"
if ! grep -qxF "$LINE" "$FILE"; then
# 如果不存在,将其添加到文件末尾
echo "$LINE" >> "$FILE"
fi
if [ ! -e "${FERootDir}/config.js" ]; then cp ${FERootDir}/default/config.js ${FERootDir}; fi if [ ! -e "${FERootDir}/config.js" ]; then cp ${FERootDir}/default/config.js ${FERootDir}; fi
for LogoFile in ${LogoFileList}; do for LogoFile in ${LogoFileList}; do
if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then
cp ${OMCStaticDir}/agt.d/logo/${LogoFile} ${OMCStaticDir}/logo; cp ${OMCStaticDir}/omc.d/logo/${LogoFile} ${OMCStaticDir}/logo;
fi fi
done done
if ! id -u omc >/dev/null 2>&1 ; then useradd -d /opt/omc -m -s /bin/bash -p1000ftp@kp omc; else echo "user omc exist"; fi if ! id -u omc >/dev/null 2>&1 ; then useradd -d /opt/omc -m -s /bin/bash -p1000ftp@kp omc; else echo "user omc exist"; fi
mkdir -p /opt/omc/ftp mkdir -p /opt/omc/ftp
mkdir -p /opt/omc/ftp/log mkdir -p /opt/omc/ftp/log
#chmod +rx /usr/local/omc
#chmod +rx /usr/local/omc/*
#chmod +rx /usr/local/db/bin/*
#chmod +rx /usr/local/bin/*
#chmod -R 755 /usr/local/omc/htdocs/front
cd ${UsrLib64Dir} cd ${UsrLib64Dir}
if [ ! -e libwireshark.so.15 ]; then ln -s libwireshark.so.15.0.12 libwireshark.so.15; fi if [ ! -e libwireshark.so.15 ]; then ln -s libwireshark.so.15.0.12 libwireshark.so.15; fi
if [ ! -e libwireshark.so ]; then ln -s libwireshark.so.15.0.12 libwireshark.so; fi if [ ! -e libwireshark.so ]; then ln -s libwireshark.so.15.0.12 libwireshark.so; fi
@@ -127,12 +78,10 @@ if [ ! -e libwiretap.so ]; then ln -s libwiretap.so.12.0.12 libwiretap.so; fi
if [ ! -e libwsutil.so.13 ]; then ln -s libwsutil.so.13.1.0 libwsutil.so.13; fi if [ ! -e libwsutil.so.13 ]; then ln -s libwsutil.so.13.1.0 libwsutil.so.13; fi
if [ ! -e libwsutil.so ]; then ln -s libwsutil.so.13.1.0 libwsutil.so; fi if [ ! -e libwsutil.so ]; then ln -s libwsutil.so.13.1.0 libwsutil.so; fi
cd ${UsrLocalBinDir} cd ${UsrLocalBinDir}
if [ ! -e ${OmcDaemon} ]; then ln -s ${OmcBinDir}/omcsvc.sh ${OmcDaemon}; fi if [ ! -e ${OMCDaemon} ]; then ln -s ${OMCBinDir}/omcsvc.sh ${OMCDaemon}; fi
# sed -i 's/listen 80;/listen 1080;/g' ${NginxEtcDir}/nginx.conf
# sed -i 's/listen \[::\]:80;/listen \[::\]:1080;/g' ${NginxEtcDir}/nginx.conf
# setting firewall # setting firewall
PortList="80 33030 443 33443 22222" PortList="80 443 44080 44443 33030 22222"
for Port in ${PortList}; do for Port in ${PortList}; do
firewall-cmd --zone=public --add-port=${Port}/tcp --permanent firewall-cmd --zone=public --add-port=${Port}/tcp --permanent
done done
@@ -143,19 +92,29 @@ systemctl enable restagent.service
systemctl enable crontask.service systemctl enable crontask.service
systemctl enable sshsvc.service systemctl enable sshsvc.service
systemctl enable captrace.service systemctl enable captrace.service
#systemctl enable kvdb.service
systemctl stop restagent.service # read environment parameter and to do
systemctl stop crontask.service if [ "$M_PARAM" = "install" -o "$M_PARAM" = "upgrade" ]; then
systemctl stop sshsvc.service echo "M parameter: $M_PARAM"
systemctl stop captrace.service if [ -n "$C_PARAM" ]; then
# systemctl stop nginx.service echo "C parameter: $C_PARAM"
systemctl stop kvdb.service ${OMCRootDir}/bin/setomc.sh -m $M_PARAM -c $C_PARAM
systemctl start kvdb.service else
# systemctl start nginx.service ${OMCRootDir}/bin/setomc.sh -m $M_PARAM
fi
# exit while failed to run setomc.sh
if [ $? -ne 0 ]; then
echo "setomc.sh execution failed. Exiting."
exit 1
fi
fi
echo -n "Starting OMC service ... "
systemctl start captrace.service systemctl start captrace.service
systemctl start sshsvc.service systemctl start sshsvc.service
systemctl start crontask.service systemctl start crontask.service
systemctl start restagent.service systemctl start restagent.service
echo "done"
# 卸载时执行 # 卸载时执行
%postun %postun
@@ -171,41 +130,34 @@ rm libwsutil.so
rm -f ${UsrLocalBinDir}/omcd rm -f ${UsrLocalBinDir}/omcd
# setting firewall # setting firewall
PortList="80 33030 443 33443 22222" PortList="80 443 44080 44443 33030 22222"
for Port in ${PortList}; do for Port in ${PortList}; do
firewall-cmd --zone=public --remove-port=${Port}/tcp --permanent firewall-cmd --zone=public --remove-port=${Port}/tcp --permanent
done done
firewall-cmd --reload firewall-cmd --reload
if [ "$1" = "0" ] ; then if [ "$1" = "0" ] ; then
sudo systemctl stop restagent.service sudo systemctl stop restagent.service
sudo systemctl stop crontask.service sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service sudo systemctl stop captrace.service
#sudo systemctl stop kvdb.service #rm -rf /usr/local/omc
#sudo systemctl stop nginx.service rm -rf /etc/nginx/conf.d/omc.conf
#rm -rf /usr/local/omc sudo systemctl disable restagent.service
rm -rf /etc/nginx/conf.d/omc.conf sudo systemctl disable crontask.service
sudo systemctl disable restagent.service sudo systemctl disable sshsvc.service
sudo systemctl disable crontask.service sudo systemctl disable captrace.service
sudo systemctl disable sshsvc.service sudo systemctl daemon-reload
sudo systemctl disable captrace.service
#sudo systemctl disable kvdb.service
sudo systemctl daemon-reload
else else
sudo systemctl daemon-reload sudo systemctl daemon-reload
#sudo systemctl stop nginx.service sudo systemctl stop restagent.service
sudo systemctl stop restagent.service sudo systemctl stop crontask.service
sudo systemctl stop crontask.service sudo systemctl stop sshsvc.service
sudo systemctl stop sshsvc.service sudo systemctl stop captrace.service
sudo systemctl stop captrace.service sudo systemctl start crontask.service
#sudo systemctl stop kvdb.service sudo systemctl start sshsvc.service
#sudo systemctl start nginx.service sudo systemctl start captrace.service
sudo systemctl start kvdb.service sudo systemctl start restagent.service
sudo systemctl start crontask.service
sudo systemctl start sshsvc.service
sudo systemctl start captrace.service
sudo systemctl start restagent.service
fi fi
# 规定那些文件必须放入安装程序中,如果没有就报错 # 规定那些文件必须放入安装程序中,如果没有就报错
@@ -217,6 +169,7 @@ fi
/usr/local/omc/bin /usr/local/omc/bin
/usr/local/omc/etc /usr/local/omc/etc
/usr/local/omc/htdocs /usr/local/omc/htdocs
# %exclude /usr/local/omc/htdocs/front/wiregasm/wiregasm.wasm.gz
/usr/local/omc/log /usr/local/omc/log
/usr/local/omc/backup /usr/local/omc/backup
/usr/local/omc/upload /usr/local/omc/upload
@@ -224,13 +177,11 @@ fi
/usr/local/omc/license /usr/local/omc/license
/usr/local/omc/database /usr/local/omc/database
/usr/local/omc/static /usr/local/omc/static
/usr/local/omc/depends
#/etc/nginx/conf.d/omc.conf #/etc/nginx/conf.d/omc.conf
/lib/systemd/system/restagent.service /lib/systemd/system/restagent.service
/lib/systemd/system/crontask.service /lib/systemd/system/crontask.service
/lib/systemd/system/sshsvc.service /lib/systemd/system/sshsvc.service
/lib/systemd/system/captrace.service /lib/systemd/system/captrace.service
#/lib/systemd/system/kvdb.service
/usr/lib64/libwireshark.so.15.0.12 /usr/lib64/libwireshark.so.15.0.12
/usr/lib64/libwiretap.so.12.0.12 /usr/lib64/libwiretap.so.12.0.12
/usr/lib64/libwsutil.so.13.1.0 /usr/lib64/libwsutil.so.13.1.0