Re-add post-{de}install, init.d, remove docker-compose.yml, add pterodactyl-panel.sh
This commit is contained in:
parent
b6922677cf
commit
e9bfe7dee2
7 changed files with 61 additions and 64 deletions
9
APKBUILD
9
APKBUILD
|
@ -1,18 +1,19 @@
|
||||||
# Maintainer: LinuxSquare <linuxsquare@noveria.org>
|
# Maintainer: LinuxSquare <linuxsquare@noveria.org>
|
||||||
pkgname=pterodactyl-panel-compose
|
pkgname=pterodactyl-panel-compose
|
||||||
pkgver=1.11.9
|
pkgver=1.11.9
|
||||||
pkgrel=1
|
pkgrel=0
|
||||||
pkgdesc="The Pterodactyl Panel"
|
pkgdesc="The Pterodactyl Panel"
|
||||||
arch="x86_64"
|
arch="x86_64"
|
||||||
url="https://pterodactyl.io/"
|
url="https://pterodactyl.io/"
|
||||||
license="MIT"
|
license="MIT"
|
||||||
optdepends="podman docker" # Install either podman or docker
|
optdepends="podman docker" # Install either podman or docker
|
||||||
makedepends="go"
|
makedepends="go"
|
||||||
|
install="$pkgname.post-install $pkgname.post-deinstall"
|
||||||
options="!check"
|
options="!check"
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
DESTDIR="$pkgdir" make install
|
DESTDIR="$pkgdir" make install
|
||||||
local compose_path=$(find $pkgdir -name docker-compose.yml -exec dirname {} \; | sed "s|$pkgdir||")
|
local compose_path=$(find $pkgdir -name pterodactyl-panel.sh -exec dirname {} \; | sed "s|$pkgdir||")
|
||||||
sed -i "s|%VERSION%|$pkgver|" "${pkgdir}${compose_path}/docker-compose.yml"
|
sed -i "s|%VERSION%|$pkgver|" "${pkgdir}${compose_path}/pterodactyl-panel.sh"
|
||||||
chown -R 2000:2000 "${pkgdir}${compose_path}"
|
chown -R 1337:1337 "${pkgdir}${compose_path}"
|
||||||
}
|
}
|
||||||
|
|
17
Makefile
17
Makefile
|
@ -1,15 +1,22 @@
|
||||||
PODMAN_DIR=/opt/podman
|
PREFIX ?= /usr
|
||||||
|
SHARE_DIR=$(PREFIX)/share
|
||||||
|
|
||||||
APP_TIMEZONE=$(shell readlink /etc/localtime | awk -F'/' '{print $$(NF-1)"/"$$(NF)}')
|
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_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)
|
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
|
install: install-compose
|
||||||
|
|
||||||
install-compose:
|
install-compose:
|
||||||
install -vDm 755 docker-compose.yml.in "$(DESTDIR)$(PODMAN_DIR)/pterodactyl-panel/docker-compose.yml"
|
install -vDm 755 pterodactyl-panel.sh.in "$(DESTDIR)$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh"
|
||||||
sed -i "s|%APP_TIMEZONE%|$(APP_TIMEZONE)|g" "$(DESTDIR)$(PODMAN_DIR)/pterodactyl-panel/docker-compose.yml"
|
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)$(PODMAN_DIR)/pterodactyl-panel/docker-compose.yml"
|
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)$(PODMAN_DIR)/pterodactyl-panel/docker-compose.yml"
|
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"
|
||||||
|
sed -i "s|%COMPOSEPATH%|$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh|g" "$(DESTDIR)/etc/init.d/pterodactyl-panel-compose"
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
services:
|
|
||||||
database:
|
|
||||||
image: docker.io/mariadb:10.5
|
|
||||||
restart: always
|
|
||||||
command: --default-authentication-plugin=mysql_native_password
|
|
||||||
volumes:
|
|
||||||
- "./database:/var/lib/mysql"
|
|
||||||
environment:
|
|
||||||
MYSQL_DATABASE: "panel"
|
|
||||||
MYSQL_USER: "pterodactyl"
|
|
||||||
MYSQL_PASSWORD: "%MYSQL_PASSWORD%"
|
|
||||||
MYSQL_ROOT_PASSWORD: "%MYSQL_ROOT_PASSWORD%"
|
|
||||||
x-podman:
|
|
||||||
uidmaps:
|
|
||||||
- 0:0:1
|
|
||||||
- 999:1337:1
|
|
||||||
gidmaps:
|
|
||||||
- 0:0:1
|
|
||||||
- 999:1337:1
|
|
||||||
cache:
|
|
||||||
image: docker.io/redis:alpine
|
|
||||||
restart: always
|
|
||||||
panel:
|
|
||||||
image: ghcr.io/pterodactyl/panel:v%VERSION%
|
|
||||||
restart: always
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
- "443:443"
|
|
||||||
links:
|
|
||||||
- database
|
|
||||||
- cache
|
|
||||||
volumes:
|
|
||||||
- "./var:/app/var/"
|
|
||||||
- "./nginx:/etc/nginx/http.d/"
|
|
||||||
- "./certs:/etc/letsencrypt/"
|
|
||||||
- "./logs:/app/storage/logs"
|
|
||||||
environment:
|
|
||||||
DB_PASSWORD: "%MYSQL_PASSWORD%"
|
|
||||||
APP_ENV: "production"
|
|
||||||
APP_ENVIRONMENT_ONLY: "false"
|
|
||||||
CACHE_DRIVER: "redis"
|
|
||||||
SESSION_DRIVER: "redis"
|
|
||||||
QUEUE_DRIVER: "redis"
|
|
||||||
REDIS_HOST: "cache"
|
|
||||||
DB_HOST: "database"
|
|
||||||
DB_PORT: "3306"
|
|
||||||
RECAPTCHA_ENABLED: "false"
|
|
||||||
TRUSTED_PROXIES: "*"
|
|
||||||
APP_TIMEZONE: "%APP_TIMEZONE%"
|
|
||||||
APP_SERVICE_AUTHOR: "mail@example.com"
|
|
||||||
networks:
|
|
||||||
default:
|
|
||||||
ipam:
|
|
||||||
config:
|
|
||||||
- subnet: 172.20.0.0/16
|
|
20
pterodactyl-panel-compose.initd.in
Normal file
20
pterodactyl-panel-compose.initd.in
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
name=$RC_SVCNAME
|
||||||
|
description="Pterodactyl Panel Containerized"
|
||||||
|
supervisor="supervise-daemon"
|
||||||
|
|
||||||
|
command="/usr/share/pterodactyl-panel/pterodactyl-panel.sh"
|
||||||
|
command_args="start"
|
||||||
|
command_user="pterodactyl"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
after podman
|
||||||
|
need podman
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Stopping $RC_SVCNAME"
|
||||||
|
/usr/share/pterodactyl-panel/pterodactyl-panel.sh stop
|
||||||
|
eend $?
|
||||||
|
}
|
3
pterodactyl-panel-compose.post-deinstall
Normal file
3
pterodactyl-panel-compose.post-deinstall
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
deluser pterodactyl 2>/dev/null
|
6
pterodactyl-panel-compose.post-install
Normal file
6
pterodactyl-panel-compose.post-install
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
addgroup -S -g 1337 pterodactyl 2>/dev/null
|
||||||
|
adduser -S -h /home/pterodactyl -D -u 1337 -s /bin/bash -G pterodactyl pterodactyl 2>/dev/null
|
||||||
|
|
||||||
|
exit 0
|
15
pterodactyl-panel.sh.in
Executable file
15
pterodactyl-panel.sh.in
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
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%
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
podman container stop pterodactyl-db
|
||||||
|
podman container stop pterodactyl-cache
|
||||||
|
podman container stop pterodactyl-panel
|
||||||
|
}
|
||||||
|
$1
|
Loading…
Reference in a new issue