Beak cleanup; remove the need for mutagen

This commit is contained in:
DaneEveritt 2022-06-18 11:26:07 -04:00
parent 7580767215
commit 33d8397cc2
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
3 changed files with 52 additions and 42 deletions

66
beak
View File

@ -1,26 +1,54 @@
#!/usr/bin/env bash
# If the environment file for the Panel exists we want to source it so
# that any environment variables defined within that are passed along to
# additional commands we may call here.
if [ -f ./code/panel/.env ]; then
source ./code/panel/.env
fi
export WWWUSER=${WWWUSER:-$UID}
export WWWGROUP=${WWWGROUP:-$(id -g)}
if [ "$1" == "app" ]; then
if [ "$2" == "" ]; then
docker compose exec -u pterodactyl app bash
elif [ "$2" == "root" ]; then
docker compose exec -u root app bash
else
echo "./beak.sh app [root]"
exit 1
fi
elif [ "$1" == "wings" ]; then
docker compose exec -u root wings bash
elif [ "$1" == "up" ]; then
shift
mutagen-compose up $@
elif [ "$1" == "down" ]; then
shift
mutagen-compose down $@
if ! docker compose &>/dev/null; then
DOCKER_COMPOSE=(docker-compose)
else
echo "./beak.sh <up|down|wings|app> [root]"
exit 1
DOCKER_COMPOSE=(docker compose)
fi
ARGS=()
PEXEC=(exec -u pterodactyl app)
# Handle SSH into the container for the Panel.
if [ "$1" == "app" ]; then
shift 1
CONTAINER_USER=pterodactyl
if [ "$1" == "root" ]; then
CONTAINER_USER=root
fi
ARGS+=(exec -u "$CONTAINER_USER" app bash)
# Boot into the wings instance.
elif [ "$1" == "wings" ]; then
shift 1
"${DOCKER_COMPOSE[@]}" exec -u root wings bash
# Start an artisan instance within the container.
elif [ "$1" == "artisan" ]; then
shift 1
ARGS+=("${PEXEC[@]}" php artisan "$@")
# Handle tinker commands.
elif [ "$1" == "tinker" ]; then
shift 1
ARGS+=("${PEXEC[@]}" php artisan tinker)
elif [ "$1" == "serve" ]; then
shift 1
ARGS+=("${PEXEC[@]}" yarn run serve "$@")
else
ARGS+=("$@")
fi
"${DOCKER_COMPOSE[@]}" "${ARGS[@]}"

View File

@ -9,15 +9,15 @@ fi
if [ -d "/etc/php/mods-available" ]; then
if [ -d "/etc/php/mods-available/cli" ]; then
ln -s /etc/php/mods-available/cli/* /etc/php/8.1/cli/conf.d
ln -sf /etc/php/mods-available/cli/* /etc/php/8.1/cli/conf.d
fi
if [ -d "/etc/php/mods-available/fpm" ]; then
ln -s /etc/php/mods-available/fpm/* /etc/php/8.1/fpm/conf.d
ln -sf /etc/php/mods-available/fpm/* /etc/php/8.1/fpm/conf.d
fi
find /etc/php/mods-available/. -maxdepth 1 -type f -print0 | while read -d $'\0' file
do
ln -s "$file" /etc/php/8.1/cli/conf.d/
ln -s "$file" /etc/php/8.1/fpm/conf.d/
ln -sf "$file" /etc/php/8.1/cli/conf.d/
ln -sf "$file" /etc/php/8.1/fpm/conf.d/
done
fi

View File

@ -31,7 +31,7 @@ services:
aliases:
- pterodactyl.test
volumes:
- panel_code:/var/www/html
- ./code/panel:/var/www/html
- ./docker/certificates:/etc/certs:ro
- ./docker/php:/etc/php/mods-available:ro
labels:
@ -140,27 +140,9 @@ networks:
driver: bridge
volumes:
panel_code:
mysql:
driver: local
minio:
driver: local
go_modules:
driver: local
x-mutagen:
sync:
defaults:
permissions:
defaultOwner: "id:${WWWUSER:-$$(id -u)}"
defaultGroup: "id:33"
defaultFileMode: 0644
defaultDirectoryMode: 0755
code:
alpha: "./code/panel"
beta: "volume://panel_code"
mode: "two-way-resolved"
ignore:
vcs: true
paths:
- ".idea"