Commit 7d33dd3e authored by Cameron Carney's avatar Cameron Carney

Initial Commit

parents
/data
/db
FROM alpine:edge
MAINTAINER Cameron Carney <ccarney16@live.com>
ENV PANEL_VERSION=v0.6.0-rc.1
ENV STARTUP_TIMEOUT=15
ENV CONFIG_FILE=/data/pterodactyl.conf
ENV LOG_DIR=/data/logs/
WORKDIR /var/www/html
RUN \
echo http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
&& echo http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \
&& echo http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories \
&& apk update \
&& apk add curl gettext nginx php7 php7 php7-bcmath php7-common php7-dom php7-fpm php7-gd \
php7-memcached php7-mbstring php7-openssl php7-pdo php7-phar php7-json php7-pdo_mysql \
php7-session php7-tokenizer php7-ctype php7-zlib php7-zip supervisor \
&& mkdir -p /var/www/html /run/nginx
RUN curl -Lo "${PANEL_VERSION}.tar.gz" https://github.com/Pterodactyl/Panel/archive/${PANEL_VERSION}.tar.gz \
&& tar --strip-components=1 -xzvf ${PANEL_VERSION}.tar.gz \
&& rm "${PANEL_VERSION}.tar.gz" \
&& chmod -R 777 storage/* bootstrap/cache \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer install --ansi --no-dev \
&& chown nginx:nginx * -R
COPY ./manifest /
VOLUME ["/data"]
# Expose HTTP and HTTPS ports
EXPOSE 80 443
ENTRYPOINT ["/bin/ash", "/entrypoint.sh"]
CMD ["p:start"]
version: '2'
services:
##
# Panel Cache
##
cache:
image: memcached:1.4-alpine
##
# If you want to encrypt your connection, it is recommended to remove comments and add a cronjob.
# On initial setup, run "docker-compose run --rm certbot certonly --webroot -w /le-webroot
# -d <domain>" to recieve a certificate
##
# certbot:
# command: renew
# image: certbot/certbot:v1.13.0
# volumes:
# - ./certs:/etc/letsencrypt
##
# If you rely on another MySQL/MariaDB instance, this can be safely removed.
# Make sure to remove the dependency from the panel
##
mysql:
environment:
- "MYSQL_ROOT_PASSWORD=apassword"
- "MYSQL_DATABASE=pterodactyl"
- "MYSQL_USER=ptero"
- "MYSQL_PASSWORD=pterodbpass"
volumes:
- ./db:/var/lib/mysql
image: mariadb:10.0
##
# The main service.
# Ensure that all variables/data is correct.
##
panel:
container_name: pterodactyl-panel
depends_on:
- cache
- mysql
environment:
- PANEL_URL=localhost
# SSL Encryption, useful if you dont run behind a reverse proxy
- SSL=false
- SSL_CERT=/certs/live/localhost/fullchain.pem
- SSL_CERT_KEY=/certs/live/localhost/privkey.pem
- SSL_LE_WEBROOT=/certs/.webroot/ # Webroot for Let's Encrypt
# Panel Variables, These are only needed when doing initial setup.
# When doing migration, the container will attempt to get the environment
# variables from the .env file.
- TIMEZONE=UTC
- CACHE_DRIVER=memcached
- MEMCACHED_HOST=cache
- MEMCACHED_PORT=11211
- DB_HOST=mysql
- DB_PORT=3306
- DB_DATABASE=pterodactyl
- DB_USERNAME=ptero
- DB_PASSWORD=pterodbpass
- MAIL_DRIVER=mail
- MAIL_EMAIL=admin@localhost
- MAIL_FROM_NAME=Test Panel
- USER_EMAIL=admin@pterodactyl.io
- USER_PASS=PlsCh@ng3M3
- USER_IS_ADMIN=true
image: quay.io/ccarney/pterodactyl-panel:v0.6.0-rc.1
ports:
- 80:80
- 443:443
restart: always
volumes:
- ./data:/data
# - ./certs:/certs
##
# PLACEHOLDER
# --------------------------
# If you plan on running the daemon on the same machine, uncomment the section below
##
# daemon:
# image: quay.io/parkervcp/pterodactyl-daemon:something
#!/bin/sh
###
# /entrypoint.sh - Manages the startup of the pterodactyl panel
###
set -e
# Runs the initial configuration on every startup
function init {
if [[ -z "${PANEL_URL}" ]]; then
echo "Missing environment variable 'PANEL_URL'! Please resolve it now and start the container back up..."
exit 1;
fi
echo "Starting Pterodactyl ${PANEL_VERSION} in ${STARTUP_TIMEOUT} seconds..."
sleep ${STARTUP_TIMEOUT}
# Checks if we have SSL enabled or not, and updates the configuration to what is desired.
if [ "${SSL}" == "true" ]; then
echo "Enabling SSL"
envsubst '${PANEL_URL},${SSL_CERT},${SSL_CERT_KEY}' \
< /etc/nginx/templates/https.conf.tmpl > /etc/nginx/conf.d/default.conf
else
echo "Disabling SSL"
envsubst '${PANEL_URL}' \
< /etc/nginx/templates/http.conf.tmpl > /etc/nginx/conf.d/default.conf
fi
initConfig
}
function initConfig {
# Might looks like overkill, however we should optimize and clear the config cache
php artisan optimize
php artisan config:cache
# Always destroy .env on startup
rm .env -rf
ln -s "${CONFIG_FILE}" .env
if [ ! -e "${CONFIG_FILE}" ] || [ ! -s "${CONFIG_FILE}" ]; then
echo "Missing Configuration file, Creating..."
cp .env.example "${CONFIG_FILE}"
php artisan key:generate --force
updateConfiguration
fi
}
# Updates a configuration using variables from the .env file and shell variables
function updateConfiguration {
php artisan pterodactyl:env -n \
--url=${PANEL_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}"
php artisan migrate --force
php artisan db:seed --force
}
# Adds a new user to pterodactyl
function addUser {
php artisan pterodactyl:user
}
## Start ##
case "$1" in
p:start)
init
exec supervisord --nodaemon
;;
p:update)
initConfig
updateConfiguration
;;
*)
initConfig
echo -e "No internal command specified, executing as shell command...\n"
exec $@
;;
esac
\ No newline at end of file
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