Skip to content

Commit

Permalink
Removed SFTP Daemon; Added DB Check to Panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
ccarney16 committed Jun 5, 2020
1 parent f3f5617 commit a271e06
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 44 deletions.
2 changes: 1 addition & 1 deletion bin/dev
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export PANEL_VERSION
export DAEMON_VERSION

# Just pass everything to compose
docker-compose -f docker-compose.panel.yml -f docker-compose.daemon.yml -f ./manifest/docker-compose.dev.yml $@
docker-compose -f docker-compose.yml -f ./manifest/docker-compose.dev.yml $@
30 changes: 24 additions & 6 deletions bin/init
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enable_service_panel=""
enable_service_node=""
enable_service_db=""
enable_service_le=""
enable_sftp_daemon=""


#Database Options
Expand All @@ -37,6 +38,8 @@ function _return_help {
echo " --enable-db - adds mysql database"
echo " --enable-daemon - adds daemon"
echo " --enable-letsencrypt - adds letsencrypt"
echo " --db-address"
echo " --daemon-dir"
echo ""
}

Expand All @@ -54,6 +57,7 @@ function build_config {
combine_args=$combine_args" ./manifest/compose/db.yml"
fi
if [ "$enable_service_le" == "x" ]; then
echo "enabled"
if [ "$le_panel" == "true" ]; then
combine_args=$combine_args" ./manifest/compose/le.panel.yml"
else
Expand All @@ -62,7 +66,16 @@ function build_config {
fi

IFS=" "
bin/yq merge -a ${combine_args} > docker-compose.yml
bin/yq merge -a ${combine_args} | bin/yq read --stripComments - > docker-compose.yml

# Modifiers for compose file
if [ ! "$node_directory" == "" ] && [ "$enable_service_node" == "x" ]; then
bin/yq write -i docker-compose.yml "services.daemon.volumes[0]" "$node_directory:$node_directory"
fi

if [ ! "$database_ip_address" == "" ] && [ "$enable_service_db" == "x" ]; then
bin/yq write -i docker-compose.yml "services.mysql.ports[0]" "$database_ip_address:3306"
fi

if ! [ -d "conf.d" ]; then
mkdir conf.d
Expand All @@ -80,11 +93,6 @@ if [[ -z "$_COMPOSE_EXE" ]]; then
exit 2
fi

if [ -e "docker-compose.yml" ]; then
echo "docker-compose.yml already exists. Please delete or change this file before running this script."
exit
fi

cd "$(dirname $0)/../"

# Split our arguements into seperate sections
Expand All @@ -96,6 +104,7 @@ for ((i=1; i<=$#; i++)); do
_return_help
exit
;;
# Enable Services
--enable-daemon) # Enables wings
enable_service_node="x"
;;
Expand All @@ -108,6 +117,15 @@ for ((i=1; i<=$#; i++)); do
--enable-letsencrypt) # Enable Let's Encrypt
enable_service_le="x"
;;
# Modify Certain runtime options
--daemon-dir)
((i++))
node_directory="${!i}"
;;
--db-address)
((i++))
database_ip_address="${!i}"
;;
esac
else
_command+=("${!i}")
Expand Down
4 changes: 4 additions & 0 deletions manifest/compose/daemon.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: '2.1'
services:
daemon:
##
# --Pterodactyl Daemon--
# This service provides the wings runtime.
##
image: ccarney16/pterodactyl-daemon:latest
ports:
- 2022:2022
Expand Down
11 changes: 10 additions & 1 deletion manifest/compose/db.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
###
# Optional ProjectDependencies for Pterodactyl
# Optional Project Dependencies for Pterodactyl
#
# This compose file provides the required dependencies for
# Pterodactyl, such as MariaDB and Redis.
##
version: '2.1'
services:
##
# --MariaDB--
# Required for the control panel to work.
# Stores Server/User information
##
mysql:
image: mariadb:10.4
env_file: ./conf.d/mariadb.env
restart: always
volumes:
- ./data/db:/var/lib/mysql
##
# --Redis--
# Handles Session Data
##
redis:
image: redis:alpine
restart: always
19 changes: 7 additions & 12 deletions manifest/compose/panel.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
###
# Pterodactyl Panel docker-compose file
#
# This File contains the main panel runtime along with
# workers, to enable this file, add the filename to
# "COMPOSE_FILE" within .env
###
version: '2.1'
services:

##
# --Pterodactyl Panel--
# This is the container that provides the main web interface.
Expand All @@ -21,14 +13,12 @@ services:
restart: always
volumes:
- ./data/panel:/data

# Enable Let's Encrypt Support
- ./conf.d/letsencrypt:/etc/letsencrypt:ro
- ./conf.d/webroot/.well-known:/var/www/html/public/.well-known:ro
- ./conf.d/certs:/etc/certs:ro

##
# --Worker and Cron tasks--
# --Worker--
# These are required for schedules and other misc tasks to
# function correctly.
##
Expand All @@ -39,10 +29,15 @@ services:
restart: always
volumes_from:
- panel
##
# --Cron--
# These are required for schedules and other misc tasks to
# function correctly.
##
cron:
command: p:cron
env_file: ./conf.d/panel.env
image: ccarney16/pterodactyl-panel:latest
restart: always
volumes_from:
volumes_from:
- panel
3 changes: 2 additions & 1 deletion manifest/panel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ RUN \
RUN \
yarn install --production; \
yarn add cross-env; \
yarn run build:production;
yarn run build:production; \
rm -rf node_modules;


# Final Production phase of the controller
Expand Down
25 changes: 19 additions & 6 deletions manifest/panel/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ function init {
cat .storage.tmpl | while read line; do
mkdir -p "/data/${line}"
done
chown -R nginx:nginx /data/storage
fi

if [ ! -d /data/cache ]; then
mkdir -p /data/cache
chown -R nginx:nginx /data/cache
fi

chown -R nginx:nginx /data/

# destroy links (or files) and recreate them
rm -rf storage
ln -s /data/storage storage
Expand All @@ -34,9 +34,22 @@ function init {
# Runs the initial configuration on every startup
function startServer {

printf "Pre-start: Waiting for database connection..."
i=0
until [ nc -z -v -w30 $DB_HOST $DB_PORT ]; do
printf "."
# wait for 5 seconds before check again
sleep 5
((i++))
if ((i=5)); then
echo "Database Connection Timeout (Is MySQL Running?)"
exit
fi
done

# Initial setup
if [ ! -e /data/pterodactyl.conf ]; then
echo "Running first time setup..."
echo "Setup: Running first time setup..."

# Generate base template
touch /data/pterodactyl.conf
Expand All @@ -53,12 +66,12 @@ function startServer {
sleep 5

echo ""
echo "Generating key..."
echo "Setup: Generating key..."
sleep 1
php artisan key:generate --force --no-interaction

echo ""
echo "Creating & seeding database..."
echo "Setup: Creating & seeding database..."
sleep 1
php artisan migrate --force
php artisan db:seed --force
Expand All @@ -79,7 +92,7 @@ function startServer {
envsubst '${SSL_CERT},${SSL_CERT_KEY}' \
< /etc/nginx/templates/https.conf > /etc/nginx/conf.d/default.conf
else
echo "[Warning] Disabling HTTPS"
echo "Warning: Disabling HTTPS"
cat /etc/nginx/templates/http.conf > /etc/nginx/conf.d/default.conf
fi

Expand Down
17 changes: 0 additions & 17 deletions manifest/sftp/Dockerfile

This file was deleted.

0 comments on commit a271e06

Please sign in to comment.