Commit 5af466f9 authored by Cameron Carney's avatar Cameron Carney

Updated entrypoint script

parent 7a1d2642
...@@ -14,7 +14,7 @@ RUN \ ...@@ -14,7 +14,7 @@ RUN \
&& echo http://nl.alpinelinux.org/alpine/edge/testing >> /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 \ && echo http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories \
&& apk update \ && apk update \
&& apk add curl fcron gettext nginx php7 php7 php7-bcmath php7-common php7-dom php7-fpm php7-gd \ && 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-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 \ php7-session php7-tokenizer php7-ctype php7-zlib php7-zip supervisor \
&& mkdir -p /var/www/html /run/nginx && mkdir -p /var/www/html /run/nginx
......
...@@ -16,6 +16,10 @@ __This is the full list of environment variables.___ ...@@ -16,6 +16,10 @@ __This is the full list of environment variables.___
#### WebServer Variables #### #### WebServer Variables ####
--- ---
__*General Webserver Options*__
* *UPLOAD_LIMIT*: Limit the size a user is allowed to upload through the webserver (default 100mb)
__*Security Options*__
* *SSL*: <True/False> Enables or Disables SSL. * *SSL*: <True/False> Enables or Disables SSL.
* *SSL_CERT*: Location for the SSL Certificate. * *SSL_CERT*: Location for the SSL Certificate.
* *SSL_CERT_KEY*: Location of the private key. * *SSL_CERT_KEY*: Location of the private key.
...@@ -29,14 +33,14 @@ __This is the full list of environment variables.___ ...@@ -29,14 +33,14 @@ __This is the full list of environment variables.___
* *CACHE_DRIVER*: * *CACHE_DRIVER*:
__*Database Options*__
* *DB_HOST*: * *DB_HOST*:
* *DB_PORT*: * *DB_PORT*:
* *DB_DATABASE*: * *DB_DATABASE*:
* *DB_USERNAME*: * *DB_USERNAME*:
* *DB_PASSWORD*: * *DB_PASSWORD*:
__*Mailing Options*__
* *MAIL_DRIVER*: * *MAIL_DRIVER*:
* *MAIL_EMAIL*: * *MAIL_EMAIL*:
* *MAIL_FROM_NAME*: * *MAIL_FROM_NAME*:
......
...@@ -3,30 +3,45 @@ __A Free and Open Source Agnostic Game Panel__ ...@@ -3,30 +3,45 @@ __A Free and Open Source Agnostic Game Panel__
### Usage ### ### Usage ###
--- ---
Docker: `docker run --name=pterodactyl-panel -p 80:80 -p 443:443 --env-file=./.env quay.io/ccarney/pterodactyl-panel:v0.6.0-rc.1` Docker:
It is recommended to create a environment file and run the following command:
`docker run --name=pterodactyl-panel -p 80:80 -p 443:443 --env-file=./.env quay.io/ccarney/pterodactyl-panel:v0.6.0-rc.1`
__or__ __or__
Docker Compose: `docker-compose up` Docker Compose:
Edit the environment section within docker-compose.yml then run `docker-compose up`
Please refer to ENVIRIONMENT.md for more information regarding environment variables. Please refer to ENVIRIONMENT.md for more information regarding environment variables.
### Docker Compose ### ### Docker Compose ###
--- ---
This repo provides a template docker-compose.yml file for easier deployment for the panel. It is highly recommended to use over straight up Docker. This repo provides a template docker-compose.yml file for easier deployment for the panel. It is highly recommended to use over straight up Docker.
### Updating ### ### Updating ###
--- ---
__Minor Revisions & Configuration Changes:__ __Minor Revisions & Configuration Changes:__
Docker: `docker run --rm -v <root>:/data --env-file=./.env quay.io/ccarney/pterodactyl-panel:v0.6.0 p:update` Docker:
It is recommended to create a environment file and run the following command: `docker run --rm -v <root>:/data --env-file=./.env quay.io/ccarney/pterodactyl-panel:v0.6.0 p:update`
Docker Compose:
Docker Compose: `docker-compose run --rm panel p:update` Edit the environment section within docker-compose.yml then run `docker-compose run --rm panel p:update`
__From v0.5.x to v0.6.x:__ __From v0.5.x to v0.6.x:__
*TBA...* *TBA...*
### Entrypoint Commands ###
* p:start - Starts the panel webserver and requirements (We don't provide Memcached!).
* p:update - Updates the panel config using environment variables on runtime.
### SSL Encryption ### ### SSL Encryption ###
--- ---
...@@ -34,4 +49,14 @@ SSL Encryption is an optional but recommended feature. Automatic SSL is provided ...@@ -34,4 +49,14 @@ SSL Encryption is an optional but recommended feature. Automatic SSL is provided
### Contributing ### ### Contributing ###
--- ---
All issues regarding Pterodactyl Panel/Node are to be reported to https://github.com/Pterodactyl/Panel/issues. All issues regarding Pterodactyl Panel/Node are to be reported to https://github.com/Pterodactyl/Panel/issues.
\ No newline at end of file
### Useful Links ###
Pterodactyl Project:
https://pterodactyl.io
https://docs.pterodactyl.io
https://github.com/Pterodactyl
\ No newline at end of file
##
# Pterodactyl Panel Docker Setup by ccarney
##
version: '2' version: '2'
services: services:
...@@ -56,6 +59,7 @@ services: ...@@ -56,6 +59,7 @@ services:
- CACHE_DRIVER=memcached - CACHE_DRIVER=memcached
# Rely on an external source so we can put the panel container down when updates are needed
- MEMCACHED_HOST=cache - MEMCACHED_HOST=cache
- MEMCACHED_PORT=11211 - MEMCACHED_PORT=11211
...@@ -67,7 +71,7 @@ services: ...@@ -67,7 +71,7 @@ services:
- MAIL_DRIVER=mail - MAIL_DRIVER=mail
- MAIL_EMAIL=admin@localhost - MAIL_EMAIL=admin@localhost
- MAIL_FROM_NAME=Test Panel - MAIL_FROM_NAME=Zyphinia Panel
image: quay.io/ccarney/pterodactyl-panel:v0.6.0-rc.1 image: quay.io/ccarney/pterodactyl-panel:v0.6.0-rc.1
ports: ports:
- 80:80 - 80:80
......
#!/bin/sh #!/bin/sh
### ###
# /entrypoint.sh - Manages the startup of the pterodactyl panel # /entrypoint.sh - Manages the startup of pterodactyl panel
### ###
set -e set -e
# Runs the initial configuration on every startup # Prep Container for usage
function init { function init {
# Create the storage directory
if [ ! -d ${STORAGE_DIR} ]; then
cp ./storage.template ${STORAGE_DIR} -pr
fi
rm -rf ./storage
ln -s ${STORAGE_DIR} ./storage
# 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..."
cp .env.example "${CONFIG_FILE}"
php artisan optimize
php artisan config:cache
php artisan key:generate --force
updateConfiguration
fi
php artisan optimize
php artisan config:cache
}
# Runs the initial configuration on every startup
function initServer {
if [[ -z "${PANEL_URL}" ]]; then if [[ -z "${PANEL_URL}" ]]; then
echo "Missing environment variable 'PANEL_URL'! Please resolve it now and start the container back up..." echo "Missing environment variable 'PANEL_URL'! Please resolve it now and start the container back up..."
exit 1; exit 1;
...@@ -16,8 +47,8 @@ function init { ...@@ -16,8 +47,8 @@ function init {
echo "Starting Pterodactyl ${PANEL_VERSION} in ${STARTUP_TIMEOUT} seconds..." echo "Starting Pterodactyl ${PANEL_VERSION} in ${STARTUP_TIMEOUT} seconds..."
sleep ${STARTUP_TIMEOUT} sleep ${STARTUP_TIMEOUT}
# Since Nginx does not support URL's, lets just pull the domain out of the URL
export DOMAIN_NAME="$(echo $PANEL_URL | awk -F/ '{print $3}')" export DOMAIN_NAME="$(echo $PANEL_URL | awk -F/ '{print $3}')"
# Checks if we have SSL enabled or not, and updates the configuration to what is desired. # Checks if we have SSL enabled or not, and updates the configuration to what is desired.
if [ "${SSL}" == "true" ]; then if [ "${SSL}" == "true" ]; then
...@@ -31,43 +62,11 @@ function init { ...@@ -31,43 +62,11 @@ function init {
envsubst '${DOMAIN_NAME}' \ envsubst '${DOMAIN_NAME}' \
< /etc/nginx/templates/http.conf.tmpl > /etc/nginx/conf.d/default.conf < /etc/nginx/templates/http.conf.tmpl > /etc/nginx/conf.d/default.conf
fi fi
initConfig
}
# Build the config only
function initConfig {
# Create the storage directory
if [ ! -d ${STORAGE_DIR} ]; then
cp ./storage.template ${STORAGE_DIR} -pr
fi
rm -rf ./storage
ln -s ${STORAGE_DIR} ./storage
# 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 # Updates a configuration using variables from the .env file and shell variables
function updateConfiguration { function updateConfiguration {
# Might looks like overkill, however we should optimize and clear the config cache
php artisan optimize
php artisan config:cache
php artisan pterodactyl:env -n \ php artisan pterodactyl:env -n \
--url="${PANEL_URL}" \ --url="${PANEL_URL}" \
--dbhost="${DB_HOST}" \ --dbhost="${DB_HOST}" \
...@@ -94,27 +93,19 @@ function updateConfiguration { ...@@ -94,27 +93,19 @@ function updateConfiguration {
php artisan db:seed --force php artisan db:seed --force
} }
# Adds a new user to pterodactyl
function addUser {
php artisan pterodactyl:user
}
## Start ## ## Start ##
init
case "$1" in case "$1" in
p:start) p:start)
init initServer
exec supervisord --nodaemon exec supervisord --nodaemon
;; ;;
p:update) p:update)
initConfig
updateConfiguration updateConfiguration
;; ;;
*) *)
initConfig
echo -e "No internal command specified, executing as shell command...\n" echo -e "No internal command specified, executing as shell command...\n"
exec $@ exec $@
;; ;;
......
* * * * * php /var/www/html/pterodactyl/artisan schedule:run >> /dev/null 2>&1
[program:cron]
command=/usr/sbin/crond -f -l 0
autostart=true
autorestart=true
priority=10
stdout_events_enabled=true
stderr_events_enabled=true
\ 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