Install Xen Orchestra on FreeBSD

From SysAdm
Jump to navigation Jump to search

08.2019
FreeBSD 12.0-RELEASE amd64
python 2.7,node 8, use ports or poudriere
*make.conf:

DEFAULT_VERSIONS+=python=2.7

03.2020
FreeBSD 12.0-RELEASE-p3 amd64
node8 - EOL, python2.7 - EOL,
used node12, python3.7.7, need 4G RAM
07.2021
FreeBSD 13.0-RELEASE-p3 amd64
will not build with node16 - https://github.com/sass/node-sass/issues/3077
used node14, python3.8.10, need 4G RAM

  • install
    • security/bcrypt
    • devel/git-tiny
    • devel/gmake
    • www/node14
    • security/py-argon2-cffi
    • security/py-bcrypt
    • lang/python
    • databases/redis
    • www/yarn-node14
# cd /usr/local/
# git clone -b master http://github.com/vatesfr/xen-orchestra
# cd xen-orchestra
# rm yarn.lock
  • patch package.json
*** ./package.json.orig	2020-03-22 01:31:14.041059000 +0300
--- ./package.json	2020-03-21 23:42:31.350511000 +0300
***************
*** 30,35 ****
--- 30,38 ----
    "engines": {
      "yarn": "^1.7.0"
    },
+   "resolutions": {
+     "**/node-gyp" : "5.1.0"
+   },
    "husky": {
      "hooks": {
        "pre-commit": "lint-staged && scripts/lint-staged"
# yarn
# yarn build
  • rc.d script - /usr/local/etc/rc.d/xoa:
#!/bin/sh

# PROVIDE: xoa
# REQUIRE: LOGIN redis
# KEYWORD: shutdown

. /etc/rc.subr

name="xoa"
rcvar="${name}_enable"

pidfile="/var/run/$name.pid"
logfile="/var/log/xoa/xoa.log"
start_cmd="xoa_start"
stop_cmd="xoa_stop"

xoa_start()
{
    echo -n "Starting $name."
    if [ -f $pidfile ]; then
        pgrep -q -F $pidfile node
        if [ $? -eq 0 ]; then
            echo "Process already running"
            exit
        else
            echo "Removing stalling pidfile"
            rm -f $pidfile
        fi
    fi

    cd /usr/local/xen-orchestra/packages/xo-server
    /usr/sbin/daemon -f -p $pidfile -o $logfile /usr/local/bin/node -- bin/xo-server
    sleep 3
    pgrep -q -F $pidfile node
    if [ $? -eq 0 ]; then
        echo " done"
    else
        echo " error, process not running"
    fi
}

xoa_stop()
{
    echo -n "Stopping $name."
    if [ -f $pidfile ]; then
        kill `cat $pidfile`
        rm -f $pidfile
        echo " done"
    else
        echo " error, no pidfile"
    fi
}

load_rc_config $name
run_rc_command "$1"