doc: [skip e2e] fix the build deb (#34751)

Signed-off-by: ping.liu <ping.liu@zilliz.com>
This commit is contained in:
pingliu 2024-07-17 19:39:42 +08:00 committed by GitHub
parent 88b373b024
commit 21aa23a23e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 85 additions and 62 deletions

61
build/deb/README.md Normal file
View File

@ -0,0 +1,61 @@
# Building Deb package with Docker
Building Milvus Deb package is easy if you take advantage of the containerized build environment. This document will guide you through this build process.
1. Docker, using one of the following configurations:
- **Linux with local Docker** Install Docker according to the [instructions](https://docs.docker.com/installation/#installation) for your OS.
2. Get the opensource milvus code
```bash
git clone https://github.com/milvus-io/milvus.git
cp -r milvus/build/deb .
cd deb
```
3. Start the milvus container and build the deb package
```bash
# Replace the VERSION with your own
sudo docker run -v .:/deb -ti --entrypoint /bin/bash milvusdb/milvus:v$VERSION
# in the container
cd /deb
bash build_deb.sh $VERSION $VERSION $MAINTAINER $DEBEMAIL
```
4. Install the deb package on ubuntu system
```bash
sudo apt-get update
sudo dpkg -i milvus_$VERSION-1_amd64.deb # This package is in the milvus-deb directory
sudo apt-get -f install
```
5. Check the status of Milvus
```bash
sudo systemctl status milvus
```
6. Connect to Milvus
Please refer to [Hello Milvus](https://milvus.io/docs/v2.3.x/example_code.md), then run the example code.
7. Uninstall Milvus
```bash
sudo dpkg -P milvus
```
8. (Optional) By default, Milvus is started in embed mode. If you rely on external etcd and minio, you can modify the following configuration and then restart Milvus.
```bash
sudo vim /etc/milvus/configs/milvus.yaml
```
```yaml
etcd:
endpoints: etcd-ip:2379
...
use:
embed: false
minio:
address: minio-ip
...
common:
storageType: remote
```

View File

@ -1,29 +1,34 @@
#!/bin/bash
#Download milvus source code
git clone https://github.com/milvus-io/milvus.git
cd milvus
# $1 is the branch name or commit number
git checkout $1
make
cd ..
#Change config
rm -rf milvus
cp -r /milvus .
sed -i 's#embed: false#embed: true#' milvus/configs/milvus.yaml
sed -i 's#dir: default.etcd#data.dir: /var/lib/milvus/etcd#' milvus/configs/milvus.yaml
sed -i '/data.dir: \/var\/lib\/milvus\/etcd/a \ config:\n path: /etc/milvus/configs/embedEtcd.yaml' milvus/configs/milvus.yaml
sed -i 's#storageType: remote#storageType: local#' milvus/configs/milvus.yaml
cat << EOF > milvus/configs/embedEtcd.yaml
listen-client-urls: http://0.0.0.0:2379
advertise-client-urls: http://0.0.0.0:2379
quota-backend-bytes: 4294967296
auto-compaction-mode: revision
auto-compaction-retention: '1000'
EOF
#Prepare for milvus-deb
rm -rf milvus-deb
mkdir -p milvus-deb/milvus
mkdir milvus-deb/milvus/milvus-bin
mkdir milvus-deb/milvus/milvus-lib
## binary
cp milvus/bin/milvus milvus-deb/milvus/milvus-bin/
wget https://github.com/etcd-io/etcd/releases/download/v3.5.0/etcd-v3.5.0-linux-amd64.tar.gz && tar -xf etcd-v3.5.0-linux-amd64.tar.gz
cp etcd-v3.5.0-linux-amd64/etcd milvus-deb/milvus/milvus-bin/milvus-etcd
wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio.RELEASE.2021-02-14T04-01-33Z -O milvus-deb/milvus/milvus-bin/milvus-minio
## lib
cp -d milvus/internal/core/output/lib/* milvus-deb/milvus/milvus-lib/
cp /usr/lib/x86_64-linux-gnu/libgfortran.so.4.0.0 milvus-deb/milvus/milvus-lib/libgfortran.so.4
cp -d milvus/lib/* milvus-deb/milvus/milvus-lib/
cp /usr/lib/x86_64-linux-gnu/libgfortran.so.5.0.0 milvus-deb/milvus/milvus-lib/libgfortran.so.4
cp /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0 milvus-deb/milvus/milvus-lib/libgomp.so.1
cp /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0 milvus-deb/milvus/milvus-lib/libquadmath.so.0
cp /usr/lib/x86_64-linux-gnu/libtbb.so.2 milvus-deb/milvus/milvus-lib/libtbb.so.2
cp /usr/lib/libopenblas-r0.3.9.so milvus-deb/milvus/milvus-lib/libopenblas.so.0
cp /usr/lib/x86_64-linux-gnu/libopenblas.so.0 milvus-deb/milvus/milvus-lib/libopenblas.so.0
## script
cp -r scripts milvus-deb/milvus/
## config
@ -31,7 +36,7 @@ cp -r milvus/configs milvus-deb/milvus/
# set env
apt update
apt install gnupg pbuilder ubuntu-dev-tools apt-file dh-make build-essential -y
apt install gnupg pbuilder ubuntu-dev-tools apt-file dh-make build-essential libopenblas-dev brz-debian -y
## $3 is name, $4 is email
bzr whoami "$3 $4"
export DEBFULLNAME="$3"
@ -58,8 +63,4 @@ rm -rf milvus/debian/*.ex milvus/debian/*.EX
cd milvus
bzr add debian/source/format
bzr commit -m "Initial commit of Debian packaging."
bzr builddeb -- -us -uc
#sign package and upload to launcgpad
#bzr builddeb -S
#dput ppa:milvusdb/milvus milvus_$2-1_source.changes
dpkg-buildpackage -us -uc -ui

View File

@ -10,20 +10,16 @@ override_dh_auto_install:
mkdir -p $(PWD)/debian/milvus/usr/bin
mkdir -p $(PWD)/debian/milvus/usr/lib/milvus/
mkdir -p $(PWD)/debian/milvus/etc/milvus/configs/advanced
mkdir -p $(PWD)/debian/milvus/var/lib/milvus/minio-data
mkdir -p $(PWD)/debian/milvus/var/lib/milvus/etcd-data
mkdir -p $(PWD)/debian/milvus/lib/systemd/system
mkdir -p $(PWD)/debian/milvus/etc/ld.so.conf.d
cp -f $(PWD)/milvus-bin/milvus $(PWD)/debian/milvus/usr/bin/
cp -f $(PWD)/milvus-bin/milvus-minio $(PWD)/debian/milvus/usr/bin/
cp -f $(PWD)/milvus-bin/milvus-etcd $(PWD)/debian/milvus/usr/bin/
cp -P -r $(PWD)/milvus-lib/* $(PWD)/debian/milvus/usr/lib/milvus/
cp -r $(PWD)/configs/advanced/* $(PWD)/debian/milvus/etc/milvus/configs/advanced/
cp $(PWD)/configs/milvus.yaml $(PWD)/debian/milvus/etc/milvus/configs/
cp $(PWD)/configs/glog.conf $(PWD)/debian/milvus/etc/milvus/configs/
cp $(PWD)/configs/embedEtcd.yaml $(PWD)/debian/milvus/etc/milvus/configs/
cp $(PWD)/scripts/milvus.conf $(PWD)/debian/milvus/etc/ld.so.conf.d/
cp $(PWD)/scripts/milvus.service $(PWD)/debian/milvus/lib/systemd/system/
cp $(PWD)/scripts/milvus-etcd.service $(PWD)/debian/milvus/lib/systemd/system/
cp $(PWD)/scripts/milvus-minio.service $(PWD)/debian/milvus/lib/systemd/system/
override_dh_shlibdeps:
dh_shlibdeps -l$(shell pwd)/milvus-lib

View File

@ -1,16 +0,0 @@
[Unit]
Description=Etcd of Milvus Standalone Server
After=network.target syslog.target
PartOf=milvus.service
[Install]
WantedBy=multi-user.target
Alias=milvus-etcd.service
[Service]
StandardOutput=journal
StandardError=inherit
Restart=always
# Start main service
ExecStart=/usr/bin/milvus-etcd --data-dir /var/lib/milvus/etcd-data

View File

@ -1,17 +0,0 @@
[Unit]
Description=MinIO of Milvus Standalone Server
After=network.target syslog.target
PartOf=milvus.service
[Install]
WantedBy=multi-user.target
Alias=milvus-minio.service
[Service]
Type=simple
StandardOutput=journal
StandardError=inherit
Restart=always
# Start main service
ExecStart=/usr/bin/milvus-minio server /var/lib/milvus/minio-data

View File

@ -2,9 +2,7 @@
[Unit]
Description=Milvus Standalone Server
Wants=milvus-etcd.service milvus-minio.service
Requires=milvus-etcd.service milvus-minio.service
After=network.target syslog.target milvus-etcd.service milvus-minio.service
After=network.target syslog.target
[Install]
WantedBy=multi-user.target