pass IP during runtime

This commit is contained in:
LinuxSquare 2024-11-15 21:25:53 +01:00
parent e9bfe7dee2
commit 198867d383
3 changed files with 4 additions and 5 deletions

View file

@ -4,7 +4,6 @@ SHARE_DIR=$(PREFIX)/share
APP_TIMEZONE=$(shell readlink /etc/localtime | awk -F'/' '{print $$(NF-1)"/"$$(NF)}')
MYSQL_PASSWORD=$(shell head /dev/urandom | tr -dc 'A-Za-z0-9!?,.$%&+-:<=>@_' | head -c32)
MYSQL_ROOT_PASSWORD=$(shell head /dev/urandom | tr -dc 'A-Za-z0-9!?,.$%&+-:<=>@_' | head -c32)
HOST_ACTIVE_IP=$(shell ip a | grep "state UP" -A2 | grep inet | awk '{$$1=$$1};1 {split($$2,a,"/"); print a[1]} ')
install: install-compose
@ -13,7 +12,6 @@ install-compose:
sed -i "s|%APP_TIMEZONE%|$(APP_TIMEZONE)|g" "$(DESTDIR)$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh"
sed -i "s|%MYSQL_PASSWORD%|$(MYSQL_PASSWORD)|g" "$(DESTDIR)$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh"
sed -i "s|%MYSQL_ROOT_PASSWORD%|$(MYSQL_ROOT_PASSWORD)|g" "$(DESTDIR)$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh"
sed -i "s|%HOST_ACTIVE_IP%|$(HOST_ACTIVE_IP)|g" "$(DESTDIR)$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh"
install-service:
install -vDm 755 pterodactyl-panel-compose.initd.in "$(DESTDIR)/etc/init.d/pterodactyl-panel-compose"

View file

@ -5,10 +5,11 @@ description="Pterodactyl Panel Containerized"
supervisor="supervise-daemon"
command="/usr/share/pterodactyl-panel/pterodactyl-panel.sh"
command_args="start"
command_args="start $(ip a | grep "state UP" -A2 | grep inet | awk '{$1=$1};1 {split($2,a,"/"); print a[1]}')"
command_user="pterodactyl"
depend() {
need net
after podman
need podman
}

View file

@ -4,7 +4,7 @@ start() {
printf '%s' database,var,nginx,certs,logs | xargs -d, mkdir 2> /dev/null || true
podman run --rm -d --name "pterodactyl-db" -p 3306:3306 -v ./database:/var/lib/mysql -e MYSQL_DATABASE="panel" -e MYSQL_USER="pterodactyl" -e MYSQL_PASSWORD="%MYSQL_PASSWORD%" -e MYSQL_ROOT_PASSWORD="%MYSQL_ROOT_PASSWORD%" --userns=keep-id:uid=999,gid=999 docker.io/mariadb:10.5 --default-authentication-plugin=mysql_native_password
podman run --rm -d --name "pterodactyl-cache" -p 6379:6379 docker.io/redis:alpine
podman run --rm -d --name "pterodactyl-panel" -p 80:80 -p 443:443 -v ./var:/app/var -v ./nginx:/etc/nginx/http.d -v ./certs:/etc/letsencrypt -v ./logs:/app/storage/logs -e DB_PASSWORD="%MYSQL_PASSWORD%" -e APP_ENV="production" -e APP_ENVIRONMENT_ONLY="false" -e CACHE_DRIVER="redis" -e SESSION_DRIVER="redis" -e QUEUE_DRIVER="redis" -e REDIS_HOST="%HOST_ACTIVE_IP%" -e DB_HOST="%HOST_ACTIVE_IP%" -e DB_PORT="3306" -e TRUSTED_PROXIES="*" -e APP_TIMEZONE="%APP_TIMEZONE%" -e APP_SERVICE_AUTHOR="mail@example.com" ghcr.io/pterodactyl/panel:v%VERSION%
podman run --rm -d --name "pterodactyl-panel" -p 80:80 -p 443:443 -v ./var:/app/var -v ./nginx:/etc/nginx/http.d -v ./certs:/etc/letsencrypt -v ./logs:/app/storage/logs -e DB_PASSWORD="%MYSQL_PASSWORD%" -e APP_ENV="production" -e APP_ENVIRONMENT_ONLY="false" -e CACHE_DRIVER="redis" -e SESSION_DRIVER="redis" -e QUEUE_DRIVER="redis" -e REDIS_HOST="$1" -e DB_HOST="$1" -e DB_PORT="3306" -e TRUSTED_PROXIES="*" -e APP_TIMEZONE="%APP_TIMEZONE%" -e APP_SERVICE_AUTHOR="mail@example.com" ghcr.io/pterodactyl/panel:v%VERSION%
}
stop() {
@ -12,4 +12,4 @@ stop() {
podman container stop pterodactyl-cache
podman container stop pterodactyl-panel
}
$1
$1 $2