Homebox#
See also
Homebox is a free and open source inventory and organization system.
Installation#
follow the Docker instructions
create the jobs directories. See reference
mkdir -p /home/jobs/scripts/by-user/root/docker/homebox cd /home/jobs/scripts/by-user/root/docker/homebox
create a
Docker compose file
version: "3.4" services: homebox: image: ghcr.io/hay-kot/homebox:v0.10.3 container_name: homebox restart: always environment: - HBOX_LOG_LEVEL=info - HBOX_LOG_FORMAT=text - HBOX_WEB_MAX_UPLOAD_SIZE=10 - HBOX_MAILER_HOST=${MAILER_FQDN} - HBOX_MAILER_PORT=465 - HBOX_MAILER_USERNAME=homebox - HBOX_MAILER_PASSWORD=${MAILER_PASSWORD} - HBOX_MAILER_FROM=Homebox <homebox@${FQDN}> volumes: - ${DATA_PATH}:/data/ ports: - 127.0.0.1:4014:7745 volumes: homebox-data: driver: local
Note
Replace
MAILER_FQDN
,MAILER_PASSWORD
, andDATA_PATH
with appropriate values.create a
Systemd unit file
. See also the Docker compose services section[Unit] Requires=docker.service Requires=network-online.target After=docker.service After=network-online.target ## Run ## docker-compose up --detach --force-recreate ## to reload configuration. [Service] # https://community.hetzner.com/tutorials/docker-compose-as-systemd-service Type=simple WorkingDirectory=/home/jobs/scripts/by-user/root/docker/homebox ExecStart=/usr/bin/docker-compose up --remove-orphans ExecStop=/usr/bin/docker-compose down --remove-orphans Restart=always [Install] WantedBy=multi-user.target
fix the permissions
chmod 700 /home/jobs/scripts/by-user/root/docker/homebox chmod 700 -R /home/jobs/services/by-user/root
run the deploy script
add a block by creating a new
Apache virtual host
. ReplaceHOMEBOX_FQDN
with the appropriate domain and include this file from the Apache configuration########### # Homebox # ########### <IfModule mod_ssl.c> <VirtualHost *:80> ServerName ${HOMEBOX_FQDN} # Force https. UseCanonicalName on RewriteEngine on RewriteCond %{SERVER_NAME} =${HOMEBOX_FQDN} # Ignore rewrite rules for 127.0.0.1 RewriteCond %{HTTP_HOST} !=127.0.0.1 RewriteCond %{REMOTE_ADDR} !=127.0.0.1 RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> </IfModule> <IfModule mod_ssl.c> <VirtualHost *:443> UseCanonicalName on Keepalive On RewriteEngine on ServerName ${HOMEBOX_FQDN} SSLCompression off ProxyRequests Off ProxyPreserveHost On RequestHeader set X-Forwarded-Proto "https" RequestHeader set X-Forwarded-Port "443" # Keep Homebox private <Proxy *> # Localhost. Require ip 127.0.0.1 Require ip 192.168.0. # Docker containers. Require ip 172.16. </Proxy> ProxyPass / http://127.0.0.1:4014/ ProxyPassReverse / http://127.0.0.1:4014/ # if <HTTP connection> == 'Upgrade' and <HTTP connection name> == 'websocket': # rewite all URLS to 'wss://...` and proxy them RewriteCond %{HTTP:Connection} Upgrade [NC] RewriteCond %{HTTP:Upgrade} websocket [NC] RewriteRule /(.*) ws://127.0.0.1:4014/$1 [P,L] Include /etc/letsencrypt/options-ssl-apache.conf SSLCertificateFile /etc/letsencrypt/live/${HOMEBOX_FQDN}/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/${HOMEBOX_FQDN}/privkey.pem </VirtualHost> </IfModule>
restart Apache
systemctl restart apache
Footnotes