Skip to content

Commit

Permalink
[misc] add build deb script (#1548)
Browse files Browse the repository at this point in the history
* add build deb script

* update ignore file

* move ymir version to a single file

---------

Co-authored-by: ymir <[email protected]>
  • Loading branch information
fenrir-z and ymir authored Feb 7, 2023
1 parent 3f849e9 commit 61cd7d2
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,5 @@ ymir/backend/static
.husky/

*/updater/app/mir/protos/*.pyi

*.deb
35 changes: 35 additions & 0 deletions deploy/build-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

set -e

# get version
YMIR_VERSION=`cat ../ymir/command/mir/YMIR_VERSION`

mkdir deb-workplace/DEBIAN/ -p
mkdir deb-workplace/usr/ymir -p
cp ../ymir.sh ../.env ../docker-compose.dev.yml ../docker-compose.labelfree.yml \
../docker-compose.label_studio.yml ../docker-compose.modeldeploy.yml ../docker-compose.yml \
deb-workplace/usr/ymir

cat <<EOT > deb-workplace/DEBIAN/control
Package: YMIR
Version: ${YMIR_VERSION}
Priority: optional
Depends:
Suggests:
Architecture: amd64
Maintainer: ymir
Provides: ymir
Description: YMIR
EOT

cat <<EOT > deb-workplace/DEBIAN/postinst
#!/bin/sh
echo "Successfully installed ymir, please go to installation dir (default: /usr/ymir) and run ./ymir.sh start"
EOT

chmod +x deb-workplace/DEBIAN/postinst

dpkg-deb -b deb-workplace ymir-linux-amd64-${YMIR_VERSION}.deb

rm -rf deb-workplace
3 changes: 3 additions & 0 deletions ymir.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ check_docker_version() {
MIN_DOCKER_VER="20.10"
if ! command -v docker &> /dev/null; then
echo "please install docker ${MIN_DOCKER_VER} or newer version."
echo "see https://www.howtogeek.com/devops/how-to-install-docker-and-docker-compose-on-linux/ for details"
exit
fi
if ! echo "$(docker version --format '{{.Client.Version}}') ${MIN_DOCKER_VER}" | tr " " "\n" | sort -V | head -n 1 | grep -Eq "^${MIN_DOCKER_VER}$"; then
echo "please upgrade docker to ${MIN_DOCKER_VER} or newer version."
echo "see https://www.howtogeek.com/devops/how-to-install-docker-and-docker-compose-on-linux/ for details"
exit
fi
}
Expand All @@ -53,6 +55,7 @@ check_server_runtime(){
if cat ${ENV_FILE} | grep -oE "^${FIELD_SERVER_RUNTIME}=nvidia$"; then
if ! has_nvidia_driver; then
echo "please make sure Nvidia driver is installed when server runtime is set to nvidia."
echo "find your Nvidia drivers here: https://www.nvidia.com/Download/Find.aspx"
exit
fi
fi
Expand Down
1 change: 1 addition & 0 deletions ymir/command/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ include ymir_proto/ids/type_id_names.csv
include mir/conf/mining-template.yaml
include mir/conf/training-template.yaml
include mir/tools/phase_logger_conf.json
include mir/YMIR_VERSION
1 change: 1 addition & 0 deletions ymir/command/mir/YMIR_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.0
10 changes: 9 additions & 1 deletion ymir/command/mir/version.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import os

from mir.tools.code import MirCode
from mir.tools.errors import MirRuntimeError


def _get_ymir_version() -> str:
with open(os.path.join(os.path.dirname(__file__), 'YMIR_VERSION'), 'r') as f:
ver = f.read().strip()
return ver


# Current ymir system version
YMIR_VERSION = '2.1.0'
YMIR_VERSION = _get_ymir_version()
YMIR_REPO_VERSION = '2.0.0'
YMIR_MODEL_VERSION = '2.0.0'

Expand Down

0 comments on commit 61cd7d2

Please sign in to comment.