kopia lustrzana https://github.com/OpenDroneMap/WebODM
clean up and fix bugs
rodzic
b00d5683f3
commit
5205d3ca91
|
@ -8,7 +8,7 @@ services:
|
|||
depends_on:
|
||||
- node-odm
|
||||
environment:
|
||||
- PYOPENCL_COMPILER_OUTPUT=1
|
||||
- WO_DEFAULT_NODES
|
||||
node-odm:
|
||||
image: opendronemap/nodeodm:gpu.intel
|
||||
devices:
|
||||
|
@ -17,13 +17,3 @@ services:
|
|||
- "3000"
|
||||
restart: unless-stopped
|
||||
oom_score_adj: 500
|
||||
environment:
|
||||
- PYOPENCL_COMPILER_OUTPUT=1
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: 3
|
||||
memory: 6144M
|
||||
reservations:
|
||||
cpus: 2
|
||||
memory: 4096M
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
# WebODM Debian Package
|
||||
This directory contains scripts to build a Debian package which, in turn, will install WebODM and its dependencies.
|
||||
|
||||
## OS Support
|
||||
It has been tested on Ubuntu 18.04 and 20.04, but should work on other Debian-based systems.
|
||||
|
||||
## GPU Support
|
||||
NIVIDA and Intel hardware are detected and installation/configuration is customized accordingly. AMD is not currently supported, but could be added with help from someone with hardware and/or experience.
|
||||
|
||||
## Building the Debian Package
|
||||
### To build the package, run:
|
||||
```
|
||||
./build.sh
|
||||
```
|
||||
|
||||
This script will collect the necessary components and put them in a directory unique to the package version (e.g. `/path/to/WebODM/dpkg/build/webodm_1.9.7-1`). If that directory already exists, then it will be deleted first.
|
||||
|
||||
This directory will then be used to build the Debian package, and bundles it together with an install script (e.g. `/path/to/WebODM/dpkg/deb/webodm_1.9.7-1`).
|
||||
|
||||
## Installing the Debian Package
|
||||
### To install the package, run:
|
||||
```
|
||||
./install.sh
|
||||
```
|
||||
|
||||
This script will first attempt to detect GPU hardware and install the appropriate drivers. It will then use `dpkg` to install the package. You will be prompted before anything is installed.
|
||||
|
||||
If all goes well, then this will leave you with a `systemd` service, named `webodm-docker.service`.
|
||||
|
||||
### View the status of the service:
|
||||
```
|
||||
sudo systemctl status webodm-docker
|
||||
```
|
||||
|
||||
### Stop the service:
|
||||
```
|
||||
sudo systemctl stop webodm-docker
|
||||
```
|
||||
|
||||
### Start the service:
|
||||
```
|
||||
sudo systemctl start webodm-docker
|
||||
```
|
||||
|
||||
### Restart the service:
|
||||
```
|
||||
sudo systemctl restart webodm-docker
|
||||
```
|
||||
|
||||
### View service logs:
|
||||
```
|
||||
journalctl -u webodm-docker.service
|
||||
```
|
|
@ -5,7 +5,7 @@ set -euxo
|
|||
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
WEBODM_VERSION=1.9.7
|
||||
WEBODM_DPKG_VERSION=3
|
||||
WEBODM_DPKG_VERSION=1
|
||||
WEBODM_DPKG_NAME="webodm_${WEBODM_VERSION}-${WEBODM_DPKG_VERSION}"
|
||||
|
||||
BUILD_DIR="${HERE}/build"
|
||||
|
@ -13,13 +13,34 @@ DEB_DIR="${HERE}/deb"
|
|||
WEBODM_DIR="${HERE}/${WEBODM_DPKG_NAME}/opt/WebODM"
|
||||
NODEODM_DIR="${HERE}/${WEBODM_DPKG_NAME}/opt/nodeodm"
|
||||
|
||||
function build() {
|
||||
prepareBuildDir
|
||||
prepareDebDir
|
||||
prepareNodeODMDir
|
||||
prepareWebODMDir
|
||||
moveToBuildDir
|
||||
buildDeb
|
||||
bundle
|
||||
}
|
||||
|
||||
function buildDeb() {
|
||||
dpkg-deb --build "${WEBODM_DPKG_NAME}"
|
||||
}
|
||||
|
||||
function bundle() {
|
||||
mkdir -p "${DEB_DIR}/${WEBODM_DPKG_NAME}"
|
||||
cp "${HERE}/install.sh" "${DEB_DIR}/${WEBODM_DPKG_NAME}/"
|
||||
cp "${BUILD_DIR}/${WEBODM_DPKG_NAME}/${WEBODM_DPKG_NAME}/opt/WebODM/detect_gpus.sh" "${DEB_DIR}/${WEBODM_DPKG_NAME}/"
|
||||
cp "${WEBODM_DPKG_NAME}.deb" "${DEB_DIR}/${WEBODM_DPKG_NAME}/"
|
||||
}
|
||||
|
||||
function moveToBuildDir() {
|
||||
cd "${BUILD_DIR}/${WEBODM_DPKG_NAME}"
|
||||
}
|
||||
|
||||
function prepareBuildDir() {
|
||||
if [ -d "${BUILD_DIR}" ]; then
|
||||
rm -Rf "${BUILD_DIR}"
|
||||
if [ -d "${BUILD_DIR}/${WEBODM_DPKG_NAME}" ]; then
|
||||
rm -Rf "${BUILD_DIR}/${WEBODM_DPKG_NAME}"
|
||||
fi
|
||||
|
||||
mkdir -p "${BUILD_DIR}/${WEBODM_DPKG_NAME}"
|
||||
|
@ -34,6 +55,11 @@ function prepareDebDir() {
|
|||
mkdir -p "${DEB_DIR}"
|
||||
}
|
||||
|
||||
function prepareNodeODMDir() {
|
||||
# This can go away when we can pull the image from Docker Hub.
|
||||
git clone -b bkd/gpu https://github.com/airmap/nodeodm.git "${BUILD_DIR}/${WEBODM_DPKG_NAME}/${WEBODM_DPKG_NAME}/opt/nodeodm"
|
||||
}
|
||||
|
||||
function prepareWebODMDir() {
|
||||
TMP_DIR="/tmp/WebODM"
|
||||
if [ -d "${BUILD_DIR}" ]; then
|
||||
|
@ -44,26 +70,4 @@ function prepareWebODMDir() {
|
|||
mv "${TMP_DIR}" "${BUILD_DIR}/${WEBODM_DPKG_NAME}/${WEBODM_DPKG_NAME}/opt/"
|
||||
}
|
||||
|
||||
function prepareNodeODMDir() {
|
||||
# This can go away when we can pull the image from Docker Hub.
|
||||
git clone -b bkd/gpu https://github.com/airmap/nodeodm.git "${BUILD_DIR}/${WEBODM_DPKG_NAME}/${WEBODM_DPKG_NAME}/opt/nodeodm"
|
||||
}
|
||||
|
||||
function build() {
|
||||
dpkg-deb --build "${WEBODM_DPKG_NAME}"
|
||||
}
|
||||
|
||||
function bundle() {
|
||||
mkdir -p "${DEB_DIR}/${WEBODM_DPKG_NAME}"
|
||||
cp "${HERE}/install.sh" "${DEB_DIR}/${WEBODM_DPKG_NAME}/"
|
||||
cp "${BUILD_DIR}/${WEBODM_DPKG_NAME}/${WEBODM_DPKG_NAME}/opt/WebODM/detect_gpus.sh" "${DEB_DIR}/${WEBODM_DPKG_NAME}/"
|
||||
cp "${WEBODM_DPKG_NAME}.deb" "${DEB_DIR}/${WEBODM_DPKG_NAME}/"
|
||||
}
|
||||
|
||||
prepareBuildDir
|
||||
prepareDebDir
|
||||
prepareNodeODMDir
|
||||
prepareWebODMDir
|
||||
moveToBuildDir
|
||||
build
|
||||
bundle
|
||||
|
|
|
@ -5,7 +5,7 @@ set -ux
|
|||
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
WEBODM_VERSION=1.9.7
|
||||
WEBODM_DPKG_VERSION=3
|
||||
WEBODM_DPKG_VERSION=1
|
||||
WEBODM_DPKG_NAME="webodm_${WEBODM_VERSION}-${WEBODM_DPKG_VERSION}"
|
||||
|
||||
function aptFixInstall() {
|
||||
|
@ -20,12 +20,6 @@ function ensureDocker() {
|
|||
fi
|
||||
}
|
||||
|
||||
function ensureDockerCompose() {
|
||||
if ! command -v docker-compose &> /dev/null; then
|
||||
sudo apt install docker-compose
|
||||
fi
|
||||
}
|
||||
|
||||
function ensureIntelOpenCL() {
|
||||
if [ "${GPU_INTEL}" = false ]; then
|
||||
return
|
||||
|
@ -114,19 +108,18 @@ function ensureNVIDIAOpenCL() {
|
|||
function ensureOpenCL() {
|
||||
source "${HERE}/detect_gpus.sh"
|
||||
|
||||
if [ "${GPU_NVIDIA}" = true ]; then
|
||||
ensureNVIDIAOpenCL
|
||||
fi
|
||||
|
||||
if [ "${GPU_INTEL}" = true ]; then
|
||||
ensureIntelOpenCL
|
||||
fi
|
||||
|
||||
# if [ "${GPU_NVIDIA}" = true ]; then
|
||||
# ensureNVIDIAOpenCL
|
||||
# fi
|
||||
}
|
||||
|
||||
function install() {
|
||||
ensureOpenCL
|
||||
ensureDocker
|
||||
ensureDockerCompose
|
||||
sudo dpkg -i "${HERE}/${WEBODM_DPKG_NAME}.deb"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
Package: WebODM
|
||||
Version: 1.9.7-3
|
||||
Version: 1.9.7-1
|
||||
Section: base
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
Depends: docker.io | docker-ce,
|
||||
docker-compose,
|
||||
ocl-icd-libopencl1,
|
||||
clinfo,
|
||||
python3,
|
||||
|
|
|
@ -9,17 +9,17 @@ export WEBODM_DIR=/opt/WebODM
|
|||
export WEBODM_VENV_DIR="${WEBODM_DIR}/python3-venv"
|
||||
export NODEODM_DIR=/opt/nodeodm
|
||||
|
||||
function abortRemove() {
|
||||
echo "Unable to remove webodm."
|
||||
}
|
||||
|
||||
function addNodeODMGPUIntelDockerGroups() {
|
||||
DOCKER_COMPOSE_FILE="${WEBODM_DIR}/docker-compose.nodeodm.gpu.intel.yml"
|
||||
for gid in $(id -G "${WEBODM_USER}"); do
|
||||
echo "Checking gid ${gid}."
|
||||
SED_SEARCH="/^\s\{4\}group_add/{:start /${gid}$/!"
|
||||
SED_SEARCH="${SED_SEARCH}{N;b start};/${gid}$/p}"
|
||||
# SED_OUT=$(sed -n '/^\s\{4\}group_add/{:start /$gid$/!{N;b start};/10/p}' "${DOCKER_COMPOSE_FILE}")
|
||||
SED_OUT=$(sed -n "${SED_SEARCH}" "${DOCKER_COMPOSE_FILE}")
|
||||
if [ -z "${SED_OUT}" ]; then
|
||||
echo "Adding gid ${gid}."
|
||||
echo "SED_OUT: ${SED_OUT}"
|
||||
sed -i "/^\s\{4\}image/a \ \ \ \ group_add:\n\ \ \ \ \ \ - ${gid}" "${DOCKER_COMPOSE_FILE}"
|
||||
fi
|
||||
done
|
||||
|
@ -37,6 +37,24 @@ function buildNodeODMGPUIntelDockerImage() {
|
|||
docker build -f Dockerfile.gpu.intel -t opendronemap/nodeodm:gpu.intel --build-arg RENDER_GROUP_ID="${RENDER_GROUP_ID}" .
|
||||
}
|
||||
|
||||
function configure() {
|
||||
detectGPUs
|
||||
createGroup
|
||||
createUser
|
||||
|
||||
if [ "${GPU_INTEL}" = true ]; then
|
||||
buildNodeODMGPUIntelDockerImage
|
||||
addNodeODMGPUIntelDockerGroups
|
||||
fi
|
||||
|
||||
createVenv
|
||||
setFilePermissions
|
||||
upgradePythonPip
|
||||
installPythonDockerCompose
|
||||
enableService
|
||||
startService
|
||||
}
|
||||
|
||||
function createGroup() {
|
||||
if [ "${GPU_INTEL}" = true ]; then
|
||||
if ! grep -q "^render:" /etc/group; then
|
||||
|
@ -90,37 +108,13 @@ function setFilePermissions() {
|
|||
chown -R "${WEBODM_USER}:${WEBODM_USER}" "${WEBODM_DIR}"
|
||||
}
|
||||
|
||||
function upgradePythonPip() {
|
||||
su "${WEBODM_USER}" -c "python3 -m pip install --upgrade pip"
|
||||
}
|
||||
|
||||
####
|
||||
|
||||
function startService() {
|
||||
systemctl daemon-reload
|
||||
systemctl restart webodm-docker.service
|
||||
}
|
||||
|
||||
function abortRemove() {
|
||||
echo "Unable to remove webodm."
|
||||
}
|
||||
|
||||
function configure() {
|
||||
detectGPUs
|
||||
createGroup
|
||||
createUser
|
||||
|
||||
if [ "${GPU_INTEL}" = true ]; then
|
||||
buildNodeODMGPUIntelDockerImage
|
||||
addNodeODMGPUIntelDockerGroups
|
||||
fi
|
||||
|
||||
createVenv
|
||||
setFilePermissions
|
||||
upgradePythonPip
|
||||
installPythonDockerCompose
|
||||
enableService
|
||||
startService
|
||||
function upgradePythonPip() {
|
||||
su "${WEBODM_USER}" -c "python3 -m pip install --upgrade pip"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
|
|
|
@ -9,6 +9,10 @@ export WEBODM_DIR=/opt/WebODM
|
|||
export WEBODM_VENV_DIR="${WEBODM_DIR}/python3-venv"
|
||||
export NODEODM_DIR=/opt/nodeodm
|
||||
|
||||
function abortInstall() {
|
||||
purge
|
||||
}
|
||||
|
||||
function deleteUser() {
|
||||
if grep -q "^${WEBODM_USER}:" /etc/passwd; then
|
||||
userdel "${WEBODM_USER}"
|
||||
|
@ -21,38 +25,12 @@ function deleteUserHome() {
|
|||
fi
|
||||
}
|
||||
|
||||
function deleteVenv() {
|
||||
if [ -d "${WEBODM_VENV_DIR}" ]; then
|
||||
rm -Rf "${WEBODM_VENV_DIR}"
|
||||
fi
|
||||
}
|
||||
|
||||
function stopService() {
|
||||
UNIT_NAME="webodm-docker.service"
|
||||
set +e
|
||||
systemctl is-active -q "${UNIT_NAME}"
|
||||
if [ "${?}" -eq 0 ]; then
|
||||
set -e
|
||||
systemctl stop "${UNIT_NAME}"
|
||||
else
|
||||
set -e
|
||||
fi
|
||||
systemctl disable "${UNIT_NAME}"
|
||||
systemctl daemon-reload
|
||||
|
||||
/opt/WebODM/webodm.sh down
|
||||
}
|
||||
|
||||
function purge() {
|
||||
stopService
|
||||
deleteUser
|
||||
deleteVenv
|
||||
deleteUserHome
|
||||
}
|
||||
|
||||
function abortInstall() {
|
||||
purge
|
||||
}
|
||||
|
||||
case $1 in
|
||||
abort-install)
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euxo
|
||||
|
||||
export WEBODM_VERSION=1.9.7
|
||||
export WEBODM_USER=odm
|
||||
export WEBODM_USER_HOME="/home/${WEBODM_USER}"
|
||||
export WEBODM_DIR=/opt/WebODM
|
||||
export WEBODM_VENV_DIR="${WEBODM_DIR}/python3-venv"
|
||||
export NODEODM_DIR=/opt/nodeodm
|
||||
|
||||
function install() {
|
||||
echo "preinst install"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
install)
|
||||
install
|
||||
;;
|
||||
default)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euxo
|
||||
|
||||
export WEBODM_VERSION=1.9.7
|
||||
export WEBODM_USER=odm
|
||||
export WEBODM_USER_HOME="/home/${WEBODM_USER}"
|
||||
export WEBODM_DIR=/opt/WebODM
|
||||
export WEBODM_VENV_DIR="${WEBODM_DIR}/python3-venv"
|
||||
export NODEODM_DIR=/opt/nodeodm
|
||||
|
||||
function remove() {
|
||||
stopService
|
||||
}
|
||||
|
||||
function stopService() {
|
||||
UNIT_NAME="webodm-docker.service"
|
||||
set +e
|
||||
|
||||
systemctl is-active -q "${UNIT_NAME}"
|
||||
if [ "${?}" -eq 1 ]; then
|
||||
set -e
|
||||
systemctl stop "${UNIT_NAME}"
|
||||
systemctl disable "${UNIT_NAME}"
|
||||
else
|
||||
set -e
|
||||
fi
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
if [ -f "${WEBODM_DIR}/webodm.sh" ]; then
|
||||
"${WEBODM_DIR}/webodm.sh" down
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
remove)
|
||||
remove
|
||||
;;
|
||||
default)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
|
@ -8,6 +8,7 @@ Type=forking
|
|||
User=odm
|
||||
Group=odm
|
||||
WorkingDirectory=/opt/WebODM
|
||||
Environment=PATH=/home/odm/.local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
ExecStart=/bin/bash -c 'screen -dmS webodm /opt/WebODM/webodm.sh start'
|
||||
ExecStop=/bin/bash -c '/opt/WebODM/webodm.sh stop'
|
||||
Restart=on-failure
|
||||
|
|
Ładowanie…
Reference in New Issue