ob-deploy.spec 8.5 KB
Newer Older
R
Rongfeng Fu 已提交
1
Name: ob-deploy
R
Rongfeng Fu 已提交
2
Version: %(echo $VERSION)
R
Rongfeng Fu 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
Release: %(echo $RELEASE)%{?dist}
# if you want use the parameter of rpm_create on build time,
# uncomment below
Summary: ob-deploy
Group: Development/Tools
License: GPL
Url: git@github.com:oceanbase/obdeploy.git
# BuildRoot:  %_topdir/BUILDROOT
%define debug_package %{nil}
%define __os_install_post %{nil}


# uncomment below, if your building depend on other packages

# uncomment below, if depend on other packages

Autoreq: 0
# BuildRequires: mariadb-devel


%description
# if you want publish current svn URL or Revision use these macros
ob-deploy

%debug_package
# support debuginfo package, to reduce runtime package size

# prepare your files
# OLDPWD is the dir of rpm_create running
# _prefix is an inner var of rpmbuild,
# can set by rpm_create, default is "/home/a"
# _lib is an inner var, maybe "lib" or "lib64" depend on OS

# create dirs
%install
RPM_DIR=$OLDPWD
SRC_DIR=$OLDPWD/..
BUILD_DIR=$OLDPWD/rpmbuild
rm -fr $SRC_DIR/mirror/remote && mkdir -p $SRC_DIR/mirror/remote && cd $SRC_DIR/mirror/remote 
wget https://mirrors.aliyun.com/oceanbase/OceanBase.repo
cd $SRC_DIR/
rm -rf build.log build dist obd.spec
R
Rongfeng Fu 已提交
45 46 47 48 49 50 51
if [ `git log |head -n1 | awk -F' ' '{print $2}'` ]; then
    CID=`git log |head -n1 | awk -F' ' '{print $2}'`
    BRANCH=`git rev-parse --abbrev-ref HEAD`
else
    CID='UNKNOWN'
    BRANCH='UNKNOWN'
fi
R
Rongfeng Fu 已提交
52 53 54 55 56
DATE=`date '+%b %d %Y %H:%M:%S'`
VERSION="$RPM_PACKAGE_VERSION"
if  [ "$OBD_DUBUG" ]; then
    VERSION=$VERSION".`date +%s`"
fi
R
Rongfeng Fu 已提交
57 58 59 60
cd $SRC_DIR/web
yarn
yarn build
cd $SRC_DIR
R
Rongfeng Fu 已提交
61
cat _cmd.py | sed "s/<CID>/$CID/" | sed "s/<B_BRANCH>/$BRANCH/" | sed "s/<B_TIME>/$DATE/" | sed "s/<DEBUG>/$OBD_DUBUG/" | sed "s/<VERSION>/$VERSION/" > obd.py
F
v1.5.0  
frf12 已提交
62
sed -i "s|<DOC_LINK>|$OBD_DOC_LINK|" _errno.py
R
Rongfeng Fu 已提交
63 64 65 66
mkdir -p $BUILD_DIR/SOURCES ${RPM_BUILD_ROOT}
mkdir -p $BUILD_DIR/SOURCES/{site-packages}
mkdir -p ${RPM_BUILD_ROOT}/usr/bin
mkdir -p ${RPM_BUILD_ROOT}/usr/obd
R
Rongfeng Fu 已提交
67 68 69 70
pip install -r plugins-requirements3.txt --target=$BUILD_DIR/SOURCES/site-packages  -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
pip install -r service/service-requirements.txt --target=$BUILD_DIR/SOURCES/site-packages  -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
# pyinstaller -y --clean -n obd-web -p $BUILD_DIR/SOURCES/site-packages -F service/app.py
pyinstaller --hidden-import=decimal -p $BUILD_DIR/SOURCES/site-packages --hidden-import service/app.py --hidden-import=configparser -F obd.py
R
Rongfeng Fu 已提交
71
rm -f obd.py obd.spec
R
Rongfeng Fu 已提交
72
\mkdir -p $BUILD_DIR/SOURCES/web
R
Rongfeng Fu 已提交
73
\cp -rf $SRC_DIR/dist/obd ${RPM_BUILD_ROOT}/usr/bin/obd
R
Rongfeng Fu 已提交
74
\cp -rf $SRC_DIR/web/dist $BUILD_DIR/SOURCES/web
R
Rongfeng Fu 已提交
75
\cp -rf $SRC_DIR/plugins $BUILD_DIR/SOURCES/plugins
F
v1.6.0  
frf12 已提交
76
\cp -rf $SRC_DIR/optimize $BUILD_DIR/SOURCES/optimize
F
frf12 已提交
77
\cp -rf $SRC_DIR/example $BUILD_DIR/SOURCES/example
R
Rongfeng Fu 已提交
78
\cp -rf $SRC_DIR/config_parser $BUILD_DIR/SOURCES/config_parser
R
Rongfeng Fu 已提交
79
\rm -fr $BUILD_DIR/SOURCES/plugins/oceanbase-ce
R
Rongfeng Fu 已提交
80
\rm -fr $BUILD_DIR/SOURCES/config_parser/oceanbase-ce
R
Rongfeng Fu 已提交
81 82
\cp -rf $SRC_DIR/profile/ $BUILD_DIR/SOURCES/
\cp -rf $SRC_DIR/mirror/ $BUILD_DIR/SOURCES/
R
Rongfeng Fu 已提交
83
\cp -rf $BUILD_DIR/SOURCES/web ${RPM_BUILD_ROOT}/usr/obd/
R
Rongfeng Fu 已提交
84
\cp -rf $BUILD_DIR/SOURCES/plugins ${RPM_BUILD_ROOT}/usr/obd/
F
v1.6.0  
frf12 已提交
85
\cp -rf $BUILD_DIR/SOURCES/optimize ${RPM_BUILD_ROOT}/usr/obd/
R
Rongfeng Fu 已提交
86
\cp -rf $BUILD_DIR/SOURCES/config_parser ${RPM_BUILD_ROOT}/usr/obd/
R
Rongfeng Fu 已提交
87 88 89 90 91 92 93
\cp -rf $BUILD_DIR/SOURCES/mirror ${RPM_BUILD_ROOT}/usr/obd/
mkdir -p ${RPM_BUILD_ROOT}/etc/profile.d/
\cp -rf $BUILD_DIR/SOURCES/profile/* ${RPM_BUILD_ROOT}/etc/profile.d/
mkdir -p ${RPM_BUILD_ROOT}/usr/obd/lib/
\cp -rf $BUILD_DIR/SOURCES/site-packages ${RPM_BUILD_ROOT}/usr/obd/lib/site-packages
mkdir -p ${RPM_BUILD_ROOT}/usr/obd/lib/executer
\cp -rf ${RPM_DIR}/executer27 ${RPM_BUILD_ROOT}/usr/obd/lib/executer/
F
frf12 已提交
94
\cp -rf $BUILD_DIR/SOURCES/example ${RPM_BUILD_ROOT}/usr/obd/
F
v1.6.0  
frf12 已提交
95 96
cd ${RPM_BUILD_ROOT}/usr/obd/plugins && ln -s oceanbase oceanbase-ce && \cp -rf obproxy/3.1.0 obproxy-ce/ && \cp -rf $SRC_DIR/plugins/obproxy-ce/* obproxy-ce/
mv obproxy/3.1.0 obproxy/3.2.1
F
v1.5.0  
frf12 已提交
97
cd ${RPM_BUILD_ROOT}/usr/obd/config_parser && ln -s oceanbase oceanbase-ce
F
v1.6.0  
frf12 已提交
98
cd ${RPM_BUILD_ROOT}/usr/obd/optimize && ln -s obproxy obproxy-ce
R
Rongfeng Fu 已提交
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124

# package infomation
%files
# set file attribute here
%defattr(-,root,root,0777)
# need not list every file here, keep it as this
/usr/bin/obd
/usr/obd/*
/etc/profile.d/*
## create an empy dir


## need bakup old config file, so indicate here


## or need keep old config file, so indicate with "noreplace"

## indicate the dir for crontab


%post
# chkconfig: 2345 10 90
# description: obd ....
chmod -R 755 /usr/obd/*
chown -R root:root /usr/obd/*
find /usr/obd -type f -exec chmod 644 {} \;
R
Rongfeng Fu 已提交
125 126
chmod +x /usr/bin/obd
chmod +x /usr/obd/lib/executer/executer27/bin/executer
R
Rongfeng Fu 已提交
127 128 129 130 131
echo -e 'Installation of obd finished successfully\nPlease source /etc/profile.d/obd.sh to enable it'
#/sbin/chkconfig --add obd
#/sbin/chkconfig obd on

%changelog
R
Rongfeng Fu 已提交
132 133 134 135 136 137 138 139 140
* Wed Dec 14 2022 obd 1.6.2
 - new features: support OceanBaseCE BP upgrade
 - fix bug: grafana init failed when remote deploy
* Thu Nov 24 2022 obd 1.6.1
 - new features: minimum startup resource check
 - fix bug: grafana dashboard title
 - fix bug: autodeploy maybe failed in the case of large memory and small disk
 - fix bug: obproxy frequent core dump in demo
 - fix bug: remote install rsync transmission does not use the user.port
F
v1.6.0  
frf12 已提交
141 142 143 144 145
* Mon Oct 31 2022 obd 1.6.0
 - new features: support oceanbase 4.0
 - new features: support Prometheus
 - new features: support Grafana
 - new features: obd demo
F
v1.5.0  
frf12 已提交
146 147 148 149 150 151
* Wed Aug 17 2022 obd 1.5.0
 - new features: obd cluster reinstall
 - new features: obd tool
 - new features: support rsync
 - new keyword: include
 - more option: obd test mysqltest
F
frf12 已提交
152 153 154 155
* Sun Jul 17 2022 obd 1.4.0
 - new features: support tpcc
 - new features: support mysqltest record
 - fix bug: tpch ddl
R
Rongfeng Fu 已提交
156 157 158
* Tue Apr 26 2022 obd 1.3.3
 - new features: change repository for a deployed component
 - fix bug: check kernel version when autdeploy obproxy
R
Rongfeng Fu 已提交
159 160
* Wed Apr 20 2022 obd 1.3.2
 - fix bug: remote install will return None when success
R
Rongfeng Fu 已提交
161 162 163 164 165
* Wed Apr 20 2022 obd 1.3.1
 - new features: some alarm levels will be reduced when developer mode is turned on
 - fix bug: fail to connect obproxy when upgrade
 - fix bug: change ilog/clog/slog owner when user change
 - fix bug: typo: formate
R
Rongfeng Fu 已提交
166 167
* Wed Mar 30 2022 obd 1.3.0
 - new features: support rotation restart
R
Rongfeng Fu 已提交
168
 - new features: support switching deployment users
R
Rongfeng Fu 已提交
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
 - new features: obd cluster chst
 - new features: obd cluster check4ocp
 - fix bug: fixed the default path in tpch
 - fix bug: fixed the default component in sysbench
* Wed Jan 05 2022 obd 1.2.1
- fix bug: fixed the upgrade path encoding error when you use the obd cluster upgrade command without setting the Chinese environment.
- fix bug: fixed the problem caused by no mysqlt.connector dependency when you use the obd cluster upgrade command.
- fix bug: fixed OBD cannot choose and upgrade the target component when you have only one component.
* Fri Dec 31 2021 obd 1.2.0
 - new features: obd mirror disable/enable
 - new features: support obagent 1.1.0
 - new features: parameter check
 - new features: new option "--wp/--with-parameter" for restart
 - new features: support cross version upgrade and rolling upgrade for oceanbase/oceanbase-ce
 - fix bug: can not connect to root when sysbench useing obproxy node
R
Rongfeng Fu 已提交
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
* Fri Dec 31 2021 obd 1.2.0
 - new features: obd mirror disable/enable
 - new features: support obagent 1.1.0
 - new features: parameter check
 - new features: new option "--wp/--with-parameter" for restart
 - new features: support cross version upgrade and rolling upgrade for oceanbase/oceanbase-ce
 - fix bug: can not connect to root when sysbench useing obproxy node
* Thu Sep 30 2021 obd 1.1.1
 - new features: obd test tych
 - new features: new keyword "depends" for configuration file
 - new features: new option "--wop/--without-parameter" for start/restart
 - new features: a daemon will be started when obproxy is started
 - new features: support obagent
 - fix bug: fail to get devname when devname length more than 5
* Mon Aug 09 2021 obd 1.1.0
 - new features: obd cluster autdeploy
 - new features: obd cluster tenant
 - new features: obd test sysbench
 - enhanced startup check
 - new configuration item for redo log
 - start / stop the specified server or component
 - fix bug: proxyro_password and observer_sys_password can not be None
 - more help infomation
* Mon Jun 28 2021 obd 1.0.2
 - fix memory and disk check bug
* Mon Jun 28 2021 obd 1.0.1
 - support configuration password
 - Multi-level checks before start
 - new features: obd cluster upgrade
 - new features: obd update
 - cancel the timeout limit for waiting for the cluster to initialize
 - new configuration item for store log