From fbe7ce58ab94234d28dae162bd154592b624fba8 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Mon, 2 Mar 2020 23:50:12 +0100 Subject: [PATCH] initial ombi setup --- includes/ombi-conf/ombi.rc | 49 +++++++++++++++++++++ includes/organizr-conf/custom/organizr.conf | 4 +- install/ombi.sh | 28 ++++++++++++ 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 includes/ombi-conf/ombi.rc create mode 100644 install/ombi.sh diff --git a/includes/ombi-conf/ombi.rc b/includes/ombi-conf/ombi.rc new file mode 100644 index 00000000..a31da860 --- /dev/null +++ b/includes/ombi-conf/ombi.rc @@ -0,0 +1,49 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: ombi +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# ombi_enable (bool): Set to NO by default. +# Set it to YES to enable it. +# ombi_user: The user account ombi daemon runs as what +# you want it to be. It uses 'ombi' user by +# default. Do not sets it as empty or it will run +# as root. +# ombi_group: The group account ombi daemon runs as what +# you want it to be. It uses 'ombi' group by +# default. Do not sets it as empty or it will run +# as wheel. +# ombi_data_dir: Directory where ombi configuration +# data is stored. +# Default: /usr/local/share/ombi + +. /etc/rc.subr + +name=ombi +rcvar=ombi_enable +load_rc_config ${name} + +: ${ombi_enable:=NO} +: ${ombi_user:=ombi} +: ${ombi_group:=ombi} +: ${ombi_data_dir:="/config"} + +procname="/usr/local/bin/mono" +command="/usr/sbin/daemon" +command_args="-f ${procname} /usr/local/share/ombi/Ombi.exe" + +start_precmd=ombi_precmd +ombi_precmd() { +if [ ! -d ${ombi_data_dir} ]; +then install -d -o ${ombi_user} -g ${ombi_group} ${ombi_data_dir} +fi +export XDG_CONFIG_HOME=${ombi_data_dir} +} + +run_rc_command "$1" \ No newline at end of file diff --git a/includes/organizr-conf/custom/organizr.conf b/includes/organizr-conf/custom/organizr.conf index a5643b4d..47357211 100644 --- a/includes/organizr-conf/custom/organizr.conf +++ b/includes/organizr-conf/custom/organizr.conf @@ -115,10 +115,10 @@ location /tautulli/ { proxy_redirect off; } -location /ombi { +location /ombi/ { auth_request /auth-4; add_header X-Frame-Options "SAMEORIGIN"; - proxy_pass https://127.0.0.1:5000/ombi/; + proxy_pass https://192.168.31.27:3579/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; diff --git a/install/ombi.sh b/install/ombi.sh new file mode 100644 index 00000000..6b6d60c8 --- /dev/null +++ b/install/ombi.sh @@ -0,0 +1,28 @@ +echo '{"pkgs":["mono","ca_root_nss","unzip","sqlite3","nano"]}' > /tmp/pkg.json +iocage create -n "ombi" -p /tmp/pkg.json -r 11.3-RELEASE interfaces="vnet0:bridge31" ip4_addr="vnet0|192.168.31.27/24" defaultrouter="192.168.31.1" vnet="on" allow_raw_sockets="1" boot="on" +rm /tmp/pkg.json +iocage fstab -a ombi /mnt/tank/apps/ombi /config nullfs rw 0 0 +iocage exec ombi ln -s /usr/local/bin/mono /usr/bin/mono +iocage exec ombi "fetch https://github.com/tidusjar/Ombi/releases/download/v2.2.1/Ombi.zip -o /usr/local/share" +iocage exec ombi "unzip -d /usr/local/share /usr/local/share/Ombi.zip" +iocage exec ombi mv /usr/local/share/Release /usr/local/share/ombi +iocage exec ombi rm /usr/local/share/Ombi.zip + +if [ -f "/config/Ombi.sqlite" ]; +then + echo "Ombi.sqlite exist." +else + echo "Ombi.sqlite does not exist, creating..." >&2 + iocage exec ombi sqlite3 /config/Ombi.sqlite "create table aTable(field1 int); drop table aTable;" + iocage exec ombi mkdir -p /config/Backups +fi + +iocage exec ombi ln -s /config/Ombi.sqlite /usr/local/share/ombi/Ombi.sqlite +iocage exec ombi ln -s /config/Backups /usr/local/share/ombi/Backups +iocage exec ombi "pw user add ombi -c ombi -u 819 -d /nonexistent -s /usr/bin/nologin" +iocage exec ombi chown -R ombi:ombi /usr/local/share/ombi /config +iocage exec ombi mkdir /usr/local/etc/rc.d +cp ../includes/ombi-conf/ombi.rc /mnt/tank/iocage/jails/ombi/root/usr/local/etc/rc.d/ombi +iocage exec ombi chmod u+x /usr/local/etc/rc.d/ombi +iocage exec ombi sysrc ombi_enable=YES +iocage exec ombi service ombi start \ No newline at end of file