Commit bf07f715 authored by Cameron Carney's avatar Cameron Carney

revamped data volume; using docker-compose for variables at runtime.

parent 2691e563
......@@ -3,8 +3,7 @@ FROM alpine:3.6
MAINTAINER Cameron Carney <ccarney16@live.com>
ENV CONFIG_FILE=/data/pterodactyl.conf \
STARTUP_TIMEOUT=15 \
STORAGE_DIR=/data/storage \
STARTUP_TIMEOUT=5 \
PANEL_VERSION=v0.6.3
WORKDIR /var/www/html
......@@ -23,7 +22,7 @@ RUN \
&& chmod -R 755 storage/* bootstrap/cache \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer install --ansi --no-dev \
&& mv ./storage storage.template \
&& mv ./storage storage.tmpl \
&& chown nginx:nginx * -R
COPY ./manifest /
......
# Pterodactyl Panel Dockerfile #
__A Free and Open Source Agnostic Game Panel__
__Welcome to the Testing Branch, this branch is highly unstable and will change often.__
https://github.com/ccarney16/pterodactyl-panel-dockerfile
### Usage ###
......
......@@ -73,7 +73,7 @@ services:
- MAIL_DRIVER=mail
- MAIL_FROM=admin@localhost
- MAIL_FROM_NAME="Pterodactyl Panel"
image: quay.io/ccarney/pterodactyl-panel:v0.6.3
image: quay.io/ccarney/pterodactyl-panel:testing
ports:
- 80:80
- 443:443
......
......@@ -4,45 +4,58 @@
# /entrypoint.sh - Manages the startup of pterodactyl panel
###
set -e
# Prep Container for usage
function init {
# Create the storage directory
if [ ! -d ${STORAGE_DIR} ]; then
cp ./storage.template ${STORAGE_DIR} -pr
# Create the storage/cache directory
if [ ! -d /data/storage ]; then
cp -pr storage.tmpl /data/storage
fi
if [ ! -d /data/cache ]; then
mkdir -p /data/cache
chown -R nginx:nginx /data/cache
fi
# Remove symlink if it exists
rm -rf ./storage
ln -s ${STORAGE_DIR} ./storage
# destroy links and recreate them
rm -rf storage
ln -s /data/storage storage
rm -rf bootstrap/cache
ln -s /data/cache bootstrap/cache
# Always destroy .env symlink on startup
rm .env -rf
ln -s "${CONFIG_FILE}" .env
if [ ! -e "${CONFIG_FILE}" ] || [ ! -s "${CONFIG_FILE}" ]; then
echo "Missing Configuration file, Creating..."
# Initial setup
if [ ! -e "${CONFIG_FILE}" ]; then
echo "Running first time setup..."
cp .env.example "${CONFIG_FILE}"
cp -pr .env.example ${CONFIG_FILE}
php artisan optimize
sleep 5
# Clean out everything
php artisan config:cache
php artisan optimize
echo ""
echo "Generating key..."
sleep 1
php artisan key:generate --force
updateConfiguration
migrate
dbseed
fi
php artisan optimize
php artisan config:cache
echo ""
echo "Creating & seeding database..."
sleep 1
php artisan migrate --force
php artisan db:seed --force
php artisan config:cache
php artisan optimize
fi
}
# Runs the initial configuration on every startup
function initServer {
function startServer {
if [[ -z "${APP_URL}" ]]; then
echo "Missing environment variable 'APP_URL'! Please resolve it now and start the container back up..."
exit 1;
......@@ -71,56 +84,19 @@ function initServer {
envsubst '${DOMAIN_NAME}' \
< /etc/nginx/templates/http.conf.tmpl > /etc/nginx/conf.d/default.conf
fi
}
# Updates a configuration using variables from the .env file and shell variables
function updateConfiguration {
php artisan pterodactyl:env -n \
--url="${APP_URL}" \
--dbhost="${DB_HOST}" \
--dbport="${DB_PORT}" \
--dbname="${DB_DATABASE}" \
--dbuser="${DB_USERNAME}" \
--dbpass="${DB_PASSWORD}" \
--driver="${CACHE_DRIVER}" \
--session-driver="database" \
--queue-driver="database" \
--timezone="${TIMEZONE}"
php artisan pterodactyl:mail -n \
--driver="${MAIL_DRIVER}" \
--email="${MAIL_FROM}" \
--host="${MAIL_HOST}" \
--port="${MAIL_PORT}" \
--username="${MAIL_USERNAME}" \
--password="${MAIL_PASSWORD}" \
--from-name="${MAIL_FROM_NAME}"
}
function migrate {
php artisan migrate --force
}
function dbseed {
php artisan db:seed --force
exec supervisord --nodaemon
}
## Start ##
init
case "$1" in
case "${1}" in
p:start)
initServer
exec supervisord --nodaemon
;;
p:update)
updateConfiguration
startServer
;;
*)
echo -e "No internal command specified, executing as shell command...\n"
exec $@
exec ${@}
;;
esac
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment