From 40e7c092f06d3d5c30c9b30e826cd704190e3cda Mon Sep 17 00:00:00 2001 From: 404invalid-user Date: Tue, 19 Nov 2024 19:49:21 +0000 Subject: [PATCH 1/4] added .env file support added env file support using the homebox docs --- install/homebox-install.sh | 28 +++++++++++++++++++++++++++- json/homebox.json | 7 ++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/install/homebox-install.sh b/install/homebox-install.sh index f0d1c8cd630..ea029e1387e 100644 --- a/install/homebox-install.sh +++ b/install/homebox-install.sh @@ -29,6 +29,10 @@ chmod +x /opt/homebox echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" msg_ok "Installed Homebox" +msg_info "Creating Blank ENV File" +touch /opt/.env +msg_info "Created Blank ENV File" + msg_info "Creating Service" cat </etc/systemd/system/homebox.service [Unit] @@ -37,7 +41,29 @@ After=network.target [Service] WorkingDirectory=/opt -ExecStart=/opt/homebox +ExecStart=/opt/homebox \\ + --mode/\$HBOX_MODE \\ + --web-port/\$HBOX_WEB_PORT \\ + --web-host/\$HBOX_WEB_HOST \\ + --web-max-upload-size/\$HBOX_WEB_MAX_UPLOAD_SIZE \\ + --storage-data/\$HBOX_STORAGE_DATA \\ + --storage-sqlite-url/\$HBOX_STORAGE_SQLITE_URL \\ + --log-level/\$HBOX_LOG_LEVEL \\ + --log-format/\$HBOX_LOG_FORMAT \\ + --mailer-host/\$HBOX_MAILER_HOST \\ + --mailer-port/\$HBOX_MAILER_PORT \\ + --mailer-username/\$HBOX_MAILER_USERNAME \\ + --mailer-password/\$HBOX_MAILER_PASSWORD \\ + --mailer-from/\$HBOX_MAILER_FROM \\ + --swagger-host/\$HBOX_SWAGGER_HOST \\ + --swagger-scheme/\$HBOX_SWAGGER_SCHEME \\ + --demo/\$HBOX_DEMO \\ + --debug-enabled/\$HBOX_DEBUG_ENABLED \\ + --debug-port/\$HBOX_DEBUG_PORT \\ + --options-allow-registration/\$HBOX_OPTIONS_ALLOW_REGISTRATION \\ + --options-auto-increment-asset-id/\$HBOX_OPTIONS_AUTO_INCREMENT_ASSET_ID \\ + --options-currency-config/\$HBOX_OPTIONS_CURRENCY_CONFIG +EnvironmentFile=/opt/.env Restart=on-failure [Install] diff --git a/json/homebox.json b/json/homebox.json index d75856ab513..fe4e82aca3c 100644 --- a/json/homebox.json +++ b/json/homebox.json @@ -30,5 +30,10 @@ "username": null, "password": null }, - "notes": [] + "notes": [ + { + "text": "env file location: `/opt/.env`", + "type": "warning" + } + ] } \ No newline at end of file From f3a7b70e1cbdbb22b9f12d24856a0e65f4aa307b Mon Sep 17 00:00:00 2001 From: 404invalid-user Date: Wed, 20 Nov 2024 14:21:42 +0000 Subject: [PATCH 2/4] Changed homebox note from warning to info --- json/homebox.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json/homebox.json b/json/homebox.json index fe4e82aca3c..cc55634db66 100644 --- a/json/homebox.json +++ b/json/homebox.json @@ -33,7 +33,7 @@ "notes": [ { "text": "env file location: `/opt/.env`", - "type": "warning" + "type": "info" } ] -} \ No newline at end of file +} From a850bfba3335216a6349b4d6851c3b268b27f1d9 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:13:07 +0100 Subject: [PATCH 3/4] Homebox-Install: Add .env Support --- install/homebox-install.sh | 73 ++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 26 deletions(-) diff --git a/install/homebox-install.sh b/install/homebox-install.sh index ea029e1387e..6dfe9a68a19 100644 --- a/install/homebox-install.sh +++ b/install/homebox-install.sh @@ -26,13 +26,55 @@ msg_info "Installing Homebox" RELEASE=$(curl -s https://api.github.com/repos/sysadminsmedia/homebox/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') wget -qO- https://github.com/sysadminsmedia/homebox/releases/download/${RELEASE}/homebox_Linux_x86_64.tar.gz | tar -xzf - -C /opt chmod +x /opt/homebox +cat </opt/.env +# Application mode +# HBOX_MODE=production # Can be one of: development, production + +# Web server settings +HBOX_WEB_PORT=7745 # Port to run the web server on +HBOX_WEB_HOST=0.0.0.0 # Host to run the web server on (use 0.0.0.0 for all interfaces) + +# File upload settings +HBOX_WEB_MAX_UPLOAD_SIZE=10 # Maximum file upload size supported in MB + +# HTTP timeout settings +HBOX_WEB_READ_TIMEOUT=10 # Read timeout of HTTP server (seconds) +HBOX_WEB_WRITE_TIMEOUT=10 # Write timeout of HTTP server (seconds) +HBOX_WEB_IDLE_TIMEOUT=30 # Idle timeout of HTTP server (seconds) + +# Storage settings +HBOX_STORAGE_DATA=/data/ # Path to the data directory +HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_fk=1 # SQLite database URL + +# Logging settings +HBOX_LOG_LEVEL=info # Log level (trace, debug, info, warn, error, critical) +HBOX_LOG_FORMAT=text # Log format (text or json) + +# Mailer settings +# HBOX_MAILER_HOST=email-smtp.example.com # Email host to use +# HBOX_MAILER_PORT=587 # Email port to use +# HBOX_MAILER_USERNAME=your_email@example.com # Email user to use +# HBOX_MAILER_PASSWORD=your_password # Email password to use +# HBOX_MAILER_FROM=your_email@example.com # Email from address to use + +# Swagger settings +HBOX_SWAGGER_HOST=localhost:7745 # Swagger host to use +HBOX_SWAGGER_SCHEME=http # Swagger schema to use (http or https) + +# Application options +HBOX_OPTIONS_ALLOW_REGISTRATION=true # Allow users to register themselves +HBOX_OPTIONS_AUTO_INCREMENT_ASSET_ID=true # Auto increment asset_id for new items + +# Debug settings +# HBOX_DEBUG_ENABLED=false # Enable or disable debugging +# HBOX_DEBUG_PORT=4000 # Debug port + +# Demo settings +# HBOX_DEMO=true # Enable demo mode (optional) +EOF echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" msg_ok "Installed Homebox" -msg_info "Creating Blank ENV File" -touch /opt/.env -msg_info "Created Blank ENV File" - msg_info "Creating Service" cat </etc/systemd/system/homebox.service [Unit] @@ -41,28 +83,7 @@ After=network.target [Service] WorkingDirectory=/opt -ExecStart=/opt/homebox \\ - --mode/\$HBOX_MODE \\ - --web-port/\$HBOX_WEB_PORT \\ - --web-host/\$HBOX_WEB_HOST \\ - --web-max-upload-size/\$HBOX_WEB_MAX_UPLOAD_SIZE \\ - --storage-data/\$HBOX_STORAGE_DATA \\ - --storage-sqlite-url/\$HBOX_STORAGE_SQLITE_URL \\ - --log-level/\$HBOX_LOG_LEVEL \\ - --log-format/\$HBOX_LOG_FORMAT \\ - --mailer-host/\$HBOX_MAILER_HOST \\ - --mailer-port/\$HBOX_MAILER_PORT \\ - --mailer-username/\$HBOX_MAILER_USERNAME \\ - --mailer-password/\$HBOX_MAILER_PASSWORD \\ - --mailer-from/\$HBOX_MAILER_FROM \\ - --swagger-host/\$HBOX_SWAGGER_HOST \\ - --swagger-scheme/\$HBOX_SWAGGER_SCHEME \\ - --demo/\$HBOX_DEMO \\ - --debug-enabled/\$HBOX_DEBUG_ENABLED \\ - --debug-port/\$HBOX_DEBUG_PORT \\ - --options-allow-registration/\$HBOX_OPTIONS_ALLOW_REGISTRATION \\ - --options-auto-increment-asset-id/\$HBOX_OPTIONS_AUTO_INCREMENT_ASSET_ID \\ - --options-currency-config/\$HBOX_OPTIONS_CURRENCY_CONFIG +ExecStart=/opt/homebox EnvironmentFile=/opt/.env Restart=on-failure From 744576fa4f5344cfe7abe0ab73cd61dec700beec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Gj=C3=B8by=20Thom?= <34199185+havardthom@users.noreply.github.com> Date: Thu, 21 Nov 2024 22:47:30 +0100 Subject: [PATCH 4/4] Update homebox-install.sh --- install/homebox-install.sh | 48 ++++---------------------------------- 1 file changed, 4 insertions(+), 44 deletions(-) diff --git a/install/homebox-install.sh b/install/homebox-install.sh index 6dfe9a68a19..6548e76073c 100644 --- a/install/homebox-install.sh +++ b/install/homebox-install.sh @@ -27,50 +27,10 @@ RELEASE=$(curl -s https://api.github.com/repos/sysadminsmedia/homebox/releases/l wget -qO- https://github.com/sysadminsmedia/homebox/releases/download/${RELEASE}/homebox_Linux_x86_64.tar.gz | tar -xzf - -C /opt chmod +x /opt/homebox cat </opt/.env -# Application mode -# HBOX_MODE=production # Can be one of: development, production - -# Web server settings -HBOX_WEB_PORT=7745 # Port to run the web server on -HBOX_WEB_HOST=0.0.0.0 # Host to run the web server on (use 0.0.0.0 for all interfaces) - -# File upload settings -HBOX_WEB_MAX_UPLOAD_SIZE=10 # Maximum file upload size supported in MB - -# HTTP timeout settings -HBOX_WEB_READ_TIMEOUT=10 # Read timeout of HTTP server (seconds) -HBOX_WEB_WRITE_TIMEOUT=10 # Write timeout of HTTP server (seconds) -HBOX_WEB_IDLE_TIMEOUT=30 # Idle timeout of HTTP server (seconds) - -# Storage settings -HBOX_STORAGE_DATA=/data/ # Path to the data directory -HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_fk=1 # SQLite database URL - -# Logging settings -HBOX_LOG_LEVEL=info # Log level (trace, debug, info, warn, error, critical) -HBOX_LOG_FORMAT=text # Log format (text or json) - -# Mailer settings -# HBOX_MAILER_HOST=email-smtp.example.com # Email host to use -# HBOX_MAILER_PORT=587 # Email port to use -# HBOX_MAILER_USERNAME=your_email@example.com # Email user to use -# HBOX_MAILER_PASSWORD=your_password # Email password to use -# HBOX_MAILER_FROM=your_email@example.com # Email from address to use - -# Swagger settings -HBOX_SWAGGER_HOST=localhost:7745 # Swagger host to use -HBOX_SWAGGER_SCHEME=http # Swagger schema to use (http or https) - -# Application options -HBOX_OPTIONS_ALLOW_REGISTRATION=true # Allow users to register themselves -HBOX_OPTIONS_AUTO_INCREMENT_ASSET_ID=true # Auto increment asset_id for new items - -# Debug settings -# HBOX_DEBUG_ENABLED=false # Enable or disable debugging -# HBOX_DEBUG_PORT=4000 # Debug port - -# Demo settings -# HBOX_DEMO=true # Enable demo mode (optional) +# For possible environment variables check here: https://homebox.software/en/configure-homebox +HBOX_MODE=production +HBOX_WEB_PORT=7745 +HBOX_WEB_HOST=0.0.0.0 EOF echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" msg_ok "Installed Homebox"