I got PicApport, a nice self-hosted private photo and video opensource server with gallery and photo management, to run in a FreeNAS Jail, but could not get it to run as a service.
Installation of PicApport, in a freenas jail (11.3):
1 - Created a jail in my favorite pool (say "MyPool" for the exemple)
using Freenas wizard and igb1 interface / vnet0 avec BPF (Berkeley Packet Filter)
In Jail properties, checked that mount_fdescfs is checked.
2 - Mounted the volume containing photos from the wizard
3 - Installed pkg (system will guide when I simply entered pkg at command line)
4 - Installed, using pkg install, whatever packages I am used to work with ; sudo, nano, etc …
5 - Installed java14 :
Pkg install openjdk14 (or any other version that you want after version 8)
At the end of iava installation, the script sends a message to mount the volumes fdesc and proc,
Either manually (I could not get it to work):
sudo mount -t fdescfs fdesc /dev/fd
sudo mount -t procfs proc /proc
Or through fstab file:
starting from host shell edited /mnt/"MyPool"/iocage/jails/PicApport/fstab added the following at the end:
fdesc /mnt/"MyPool"/iocage/jails/PicApport/root/dev/fd fdescfs rw 0 0
proc /mnt/"MyPool"/iocage/jails/PicApport/root/proc procfs rw 0 0
6 - Installed PicApport from the jail shell:
6.1 - Created directories:
mkdir /opt
mkdir /opt/picapport
mkdir /opt/picapport/.picapport
6.2 - copied the files from PicApport site (https://www.picapport.de)
copied picapport-headless.jar to /opt/picapport/.
copied picapport.properties to /opt/picapport/.picapport/.
No need to copy picapport and StartPicApport.sh files, they won't work with FreeBSD.
6.3 Made rc.d script file /etc/rc.d/picapport with the following contents:
(this is an adaptation to freeBSD of the picapport provided startup files, and from an exemple of java daemon startup script for unify in FreeBSD)
#!/bin/sh
# Filename : picapport
# $FreeeBSD releng/11.3/etc/rc.d/sshd 303770 2016-08-05 15:32:35Z des $
# Version : 2.0
# Date : 20.09.2016
# Copyright : (c) 2016 Contecon Software GmbH
# Description : starting script for starting PicApport as a daemon
# History : 20.08.2015 - Initial version
# 20.09.2016 - revised
# 18.05.2020 - New FreeBSD version
### BEGIN INIT INFO
# Provides: $picapport
# Required: $remote_fs $syslog
# Default-Start: 2
# Default-Stop: 1
# Short-Description: PicApport Server
#
# Add the following line to /etc/rc.conf to enable `picapport':
#
# picapport_enable="YES"
### END INIT INFO Version 01
. /etc/rc.subr
name="picapport"
desc="picapport Daemon"
rcvar="picapport_enable"
load_rc_config ${name}
: ${picapport_enable:=NO}
: ${picapport_user:=root}
: ${picapport_group:=wheel}
: ${picapport_chdir:=/opt/picapport/.picapport}
: ${picapport_javaflags:="-Xms512m -Xmx1024m -Duser.home=/opt/picapport"}
pidfile="/var/run/${name}.pid"
procname=/usr/local/bin/java
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} /usr/local/bin/java ${picapport_javaflags} -jar /opt/picapport/picapport-headless.jar start"
start_precmd=picapport_prestart # to be debugged
picapport_prestart()
{
if [ ! -e /var/run/picapport ] ; then
install -d -o picapport -g picapport /var/run/picapport;
fi
}
run_rc_command "$1"
Saved it as /etc/rc.d/picapport
7 - Edited /etc/rc.conf adding
# Enable PicApport
Picapport_enable="YES"
8 - Edited /opt/picapport/.picapport/picapport.properties to adapt the line robot.root.0.path= to my photos library directory,
9 - Restarted the jail,
10 - Enjoyed the application !
The application is running, can find it in /var/run.
I can connect to my server using most web browsers (did not find a browser of Apple IOS9.3 to work). The pictures in the gallery may seem to show a little more noise than the originals, depending of the web browser I am using. PicApport seems to have many options and features that I have not yet explored.
The application seems to run fine with this, but I expected to have picapport behave as a service, and in spite of all my attempts, i could not get picapport to answer to 'service picapport status'. I am far from being knowledgeable in FreeBSD scripting and if someone could help me fix this issue, that would close the subject of a completely clean PicApport installation in a FreeBSD jail.
Installation of PicApport, in a freenas jail (11.3):
1 - Created a jail in my favorite pool (say "MyPool" for the exemple)
using Freenas wizard and igb1 interface / vnet0 avec BPF (Berkeley Packet Filter)
In Jail properties, checked that mount_fdescfs is checked.
2 - Mounted the volume containing photos from the wizard
3 - Installed pkg (system will guide when I simply entered pkg at command line)
4 - Installed, using pkg install, whatever packages I am used to work with ; sudo, nano, etc …
5 - Installed java14 :
Pkg install openjdk14 (or any other version that you want after version 8)
At the end of iava installation, the script sends a message to mount the volumes fdesc and proc,
Either manually (I could not get it to work):
sudo mount -t fdescfs fdesc /dev/fd
sudo mount -t procfs proc /proc
Or through fstab file:
starting from host shell edited /mnt/"MyPool"/iocage/jails/PicApport/fstab added the following at the end:
fdesc /mnt/"MyPool"/iocage/jails/PicApport/root/dev/fd fdescfs rw 0 0
proc /mnt/"MyPool"/iocage/jails/PicApport/root/proc procfs rw 0 0
6 - Installed PicApport from the jail shell:
6.1 - Created directories:
mkdir /opt
mkdir /opt/picapport
mkdir /opt/picapport/.picapport
6.2 - copied the files from PicApport site (https://www.picapport.de)
copied picapport-headless.jar to /opt/picapport/.
copied picapport.properties to /opt/picapport/.picapport/.
No need to copy picapport and StartPicApport.sh files, they won't work with FreeBSD.
6.3 Made rc.d script file /etc/rc.d/picapport with the following contents:
(this is an adaptation to freeBSD of the picapport provided startup files, and from an exemple of java daemon startup script for unify in FreeBSD)
#!/bin/sh
# Filename : picapport
# $FreeeBSD releng/11.3/etc/rc.d/sshd 303770 2016-08-05 15:32:35Z des $
# Version : 2.0
# Date : 20.09.2016
# Copyright : (c) 2016 Contecon Software GmbH
# Description : starting script for starting PicApport as a daemon
# History : 20.08.2015 - Initial version
# 20.09.2016 - revised
# 18.05.2020 - New FreeBSD version
### BEGIN INIT INFO
# Provides: $picapport
# Required: $remote_fs $syslog
# Default-Start: 2
# Default-Stop: 1
# Short-Description: PicApport Server
#
# Add the following line to /etc/rc.conf to enable `picapport':
#
# picapport_enable="YES"
### END INIT INFO Version 01
. /etc/rc.subr
name="picapport"
desc="picapport Daemon"
rcvar="picapport_enable"
load_rc_config ${name}
: ${picapport_enable:=NO}
: ${picapport_user:=root}
: ${picapport_group:=wheel}
: ${picapport_chdir:=/opt/picapport/.picapport}
: ${picapport_javaflags:="-Xms512m -Xmx1024m -Duser.home=/opt/picapport"}
pidfile="/var/run/${name}.pid"
procname=/usr/local/bin/java
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} /usr/local/bin/java ${picapport_javaflags} -jar /opt/picapport/picapport-headless.jar start"
start_precmd=picapport_prestart # to be debugged
picapport_prestart()
{
if [ ! -e /var/run/picapport ] ; then
install -d -o picapport -g picapport /var/run/picapport;
fi
}
run_rc_command "$1"
Saved it as /etc/rc.d/picapport
7 - Edited /etc/rc.conf adding
# Enable PicApport
Picapport_enable="YES"
8 - Edited /opt/picapport/.picapport/picapport.properties to adapt the line robot.root.0.path= to my photos library directory,
9 - Restarted the jail,
10 - Enjoyed the application !
The application is running, can find it in /var/run.
I can connect to my server using most web browsers (did not find a browser of Apple IOS9.3 to work). The pictures in the gallery may seem to show a little more noise than the originals, depending of the web browser I am using. PicApport seems to have many options and features that I have not yet explored.
The application seems to run fine with this, but I expected to have picapport behave as a service, and in spite of all my attempts, i could not get picapport to answer to 'service picapport status'. I am far from being knowledgeable in FreeBSD scripting and if someone could help me fix this issue, that would close the subject of a completely clean PicApport installation in a FreeBSD jail.