Jail: book

one time
zfs create ship/book
cd /mnt/ship/book
git clone https://github.com/janeczku/calibre-web.git

# data/calibre is the dataset of calibre libraries
# ship/book is the dataset for calibre-web databases

create jail
export JAIL=book
export JAILHOSTNAME=book
export JAILDOMAIN=ahlawat.com
export JAILIP=57
export JAILUSER=X
export JAILUSERID=1000
export JAILUSERVNC=false

/root/FreeBSD/jails/create.sh $JAIL $JAILHOSTNAME $JAILDOMAIN $JAILIP $JAILUSER $JAILUSERID $JAILUSERVNC

iocage exec $JAIL "mkdir /data"
iocage fstab -a $JAIL /mnt/ship/$JAIL /data nullfs rw 0 0
iocage exec $JAIL "mkdir /mnt/books"
iocage fstab -a $JAIL /mnt/data/calibre /mnt/books nullfs rw 0 0
iocage fstab -l $JAIL

iocage exec $JAIL "pkg install -y py39-pip py39-sqlite3 py39-ldap rust libxml2 libxslt"

iocage exec $JAIL "pip install calibreweb flask-simpleldap"

iocage exec $JAIL "mkdir -p /usr/local/etc/rc.d"
iocage exec $JAIL "cp /mnt/config/cps /usr/local/etc/rc.d"
iocage exec $JAIL "chmod 555 /usr/local/etc/rc.d/cps"

iocage exec $JAIL "sysrc cpsserver_enable=YES"
iocage exec $JAIL "service cps start"


Notes:

calibre-web

To add a new library instance:

  • stop cps server
  • modify /usr/loca/etc/rc.d/cps
  • backup cps to /mnt/config
  • cp existing /data/big to /data/newlibrary
  • start single new instance with newlibrary
  • modify port config for new port
  • start cps service
  • modify haproxy
  • modify dns
Archived Notes:
binding only to tcp6
[root@book ~]# netstat -an
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address          Foreign Address        (state)
tcp6       0      0 *.444                  *.*                    LISTEN
tcp6       0      0 *.445                  *.*                    LISTEN
tcp6       0      0 *.443                  *.*                    LISTEN
tcp4       0      0 *.22                   *.*                    LISTEN
tcp6       0      0 *.22                   *.*                    LISTEN
Active UNIX domain sockets
Address          Type   Recv-Q Send-Q            Inode             Conn             Refs          Nextref Addr
fffff80044c2fe10 dgram       0      0                0 fffff80034e652d0                0 fffff80044c2f870
fffff80044c2f870 dgram       0      0                0 fffff80034e652d0                0                0
fffff80034e652d0 dgram       0      0 fffff80d81be8760                0 fffff80044c2fe10                0 /var/run/logpriv
fffff80034e653c0 dgram       0      0 fffff80d81be8938                0                0                0 /var/run/log
[root@book ~]#

edited - [root@book /data/calibre-web/cps]# nano -w server.py

OLD
    def start_gevent(self):
        try:
            ssl_args = dict()
            if web.ub.config.get_config_certfile() and web.ub.config.get_config_keyfile():
                ssl_args = {"certfile": web.ub.config.get_config_certfile(),
                            "keyfile": web.ub.config.get_config_keyfile()}
#            if os.name == 'nt':
                self.wsgiserver= WSGIServer(('0.0.0.0', web.ub.config.config_port), web.app, spawn=Pool(), **ssl_args)
#            else:
#                self.wsgiserver = WSGIServer(('', web.ub.config.config_port), web.app, spawn=Pool(), **ssl_args)
            self.wsgiserver.serve_forever()

Showcased here is a capital and operational cost effective approach, using minimal server and networking hardware with multiple virtualized applications for Home and Business. This solution template can be easily scaled out and adapted for larger Enterprise deployments.
drop by the diyIT Matrix public room at #diyit:matrix.ahlawat.com
if you have any IT questions/feedback or to request pro bono consulting for a nonprofit

message me privately at @sharad:matrix.ahlawat.com
or email me at - sharad@ahlawat.com - pgpkey: 68DD6B89
Networking and Security Technologist.
EngineerĀ andĀ an avid Programmer.

https://sharad.ahlawat.com
strive to learn and pass on the knowledge to the next generation
one day humanity will understand the meaning of life and hopefully it will be more than ASCII 42 = "*" regex for whatever you want it to be,
and destiny is more than just a roll of a pair of dice with 42 dots (Lets nail down Quantum Entanglement)

May you Live Long (Intelligently) and Prosper and work on technology that matters.
© 2024 Sharad Ahlawat

No personal identifying data is collected or any form of analytics/metrics reported to a third-party by this website.