diff options
Diffstat (limited to 'linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst')
| -rwxr-xr-x | linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst b/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst new file mode 100755 index 0000000..19eec59 --- /dev/null +++ b/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst @@ -0,0 +1,47 @@ +#!/bin/bash + +# Stop on error +set -e + +if [ "$1" == "configure" ] && [ -z "$2" ]; then + # Code here executes only during package install (but not during upgrade) + + # Create a system user + # -r: System user + # -s /sbin/nologin: Prevent the user from logging into the system interactively + # -d /var/lib/fs-spring-boot-kamal: Set home directory of user + # fs-spring-boot-kamal: Username + useradd -r -s /sbin/nologin -d /var/lib/fs-spring-boot-kamal fs-spring-boot-kamal || true + +fi + +# Set directory ownership and permissions - Application jar file not to be read by other system users +chown -R root:fs-spring-boot-kamal /opt/fs-spring-boot-kamal +chmod 750 /opt/fs-spring-boot-kamal +chmod 750 /opt/fs-spring-boot-kamal/app +chmod 640 /opt/fs-spring-boot-kamal/app/fs-spring-boot-kamal.jar + +# Set directory ownership and permissions - Config files not to be read by other system users +chown -R root:fs-spring-boot-kamal /etc/fs-spring-boot-kamal +chmod 750 /etc/fs-spring-boot-kamal +chmod 640 /etc/fs-spring-boot-kamal/application.yaml +chmod 640 /etc/fs-spring-boot-kamal/environment.env + +# Reload systemd service configurations +systemctl daemon-reload + +# Enable service as boot time +#systemctl enable fs-spring-boot-kamal + +# Restart service +#systemctl restart fs-spring-boot-kamal + +echo "[INFO] fs-spring-boot-kamal service installed." +echo "[INFO] Update /etc/fs-spring-boot-kamal/application.yaml to update the configuration." +echo "[INFO] By default, TCP port 8085 is used by the installed server." +echo "[INFO] To enable service start at boot time:" +echo "[INFO] systemctl enable fs-spring-boot-kamal" +echo "[INFO] To start the service if not running:" +echo "[INFO] systemctl start fs-spring-boot-kamal" +echo "[INFO] To allow access from remote systems, you may have to enable firewall for example by running:" +echo "[INFO] ufw allow 8085/tcp" |
