1
0
Fork 0

Rework install script

This commit is contained in:
Michael Nguyen 2018-02-17 21:59:12 -08:00
parent 4cd3fc727c
commit 82b3895e00
3 changed files with 33 additions and 50 deletions

View file

@ -1,4 +1,3 @@
# https://duckduckgo.com/?q=Parameter+must+be+an+array+or+an+object+that+implements+Countable&t=canonical&ia=web
FROM php:7.2-fpm-alpine FROM php:7.2-fpm-alpine
# Set up all the dependencies for the PHP container. # Set up all the dependencies for the PHP container.
@ -31,12 +30,13 @@ RUN curl -Lo panel.tar.gz https://github.com/Pterodactyl/Panel/releases/download
RUN tar --strip-components=1 -xzvf panel.tar.gz RUN tar --strip-components=1 -xzvf panel.tar.gz
RUN cp .env.example .env RUN cp .env.example .env
RUN composer install --no-dev RUN composer install --no-dev
COPY install.sh /var/www/html/pterodactyl/install
RUN chmod -R 755 storage/* bootstrap/cache RUN chmod -R 755 storage/* bootstrap/cache
# Copy the remaining configuration files. # Copy the remaining configuration files.
USER root:root USER root:root
RUN mkdir -p /var/log/pterodactyl RUN mkdir -p /var/log/pterodactyl
COPY install.sh /usr/local/bin/install
RUN chmod +x /usr/local/bin/install
COPY schedule /var/spoon/cron/crontabs/schedule COPY schedule /var/spoon/cron/crontabs/schedule
COPY supervisord.conf /etc/supervisor/supervisord.conf COPY supervisord.conf /etc/supervisor/supervisord.conf
COPY www.conf /usr/local/etc/php-fpm.d/www.conf COPY www.conf /usr/local/etc/php-fpm.d/www.conf

View file

@ -1,46 +1,41 @@
#!/bin/ash #!/bin/ash
if [ ! -f .env ]; then
echo ".env not detected. Setting up environment." ##
# This is an install script to quickly set up Pterodactyl Panel. Do NOT use on an
# already configured environment, or things can go horribly wrong!
##
if [ "$(whoami)" != "pterodactyl" ]; then
echo "Rerunning script as webserver user."
exec su -c /usr/local/bin/install pterodactyl
fi
echo "Are you sure you want to continue the install script? (Y/n)"
read -n1 run
if [ "$run" = "Y" ]; then
echo "Running install script."
echo "Waiting 15 seconds for MariaDB to be ready." echo "Waiting 15 seconds for MariaDB to be ready."
sleep 15 sleep 15
cp .env.example .env
printf "\n\nREDIS_HOST=redis\n\nTRUSTED_PROXIES=*" >> .env echo "Adding additional parameters to .env file."
printf "\n\nTRUSTED_PROXIES=*" >> .env
php artisan key:generate --force php artisan key:generate --force
php artisan p:environment:setup --author="$author" --url="$url" --timezone="$timezone" \
--cache=redis --session=redis --queue=redis --redis-host=redis --redis-pass="" --redis-port="6379" --disable-settings-ui echo "Running configuration scripts."
php artisan p:environment:setup --cache=redis --session=redis --queue=redis \
--redis-host=redis --redis-pass="" --redis-port=6379
php artisan p:environment:database --host=db --port=3306 --database=pterodactyl \ php artisan p:environment:database --host=db --port=3306 --database=pterodactyl \
--username=pterodactyl --password=pterodactyl --username=pterodactyl --password=pterodactyl
case "$driver" in php artisan p:environment:mail
mail)
php artisan p:environment:mail --driver="$driver" --email="$panel_email" --from="$from" \ echo "Running migrations."
--encryption="$encryption"
;;
mandrill)
php artisan p:environment:mail --driver="$driver" --email="$panel_email" --from="$from" \
--encryption="$encryption" --password="$email_password"
;;
postmark)
php artisan p:environment:mail --driver="$driver" --email="$panel_email" --from="$from" \
--encryption="$encryption" --username="$email_username"
;;
mailgun)
php artisan p:environment:mail --driver="$driver" --email="$panel_email" --from="$from" \
--encryption="$encryption" --host="$host" --password="$email_password"
;;
smtp)
php artisan p:environment:mail --driver="$driver" --email="$panel_email" --from="$from" \
--encryption="$encryption" --host="$host" --port="$port" --username="$email_username" \
--password="$email_password"
;;
esac
php artisan migrate --force php artisan migrate --force
php artisan db:seed --force php artisan db:seed --force
php artisan p:user:make --email="$admin_email" --username="$admin_username" \
--name-first="$admin_first" --name-last="$admin_last" --password="$admin_password" \ echo "Running user creation script."
--admin=1 php artisan p:user:make --admin=1
echo "Setup complete."
echo "Setup complete. Please restart the container to load changes."
else else
echo ".env detected. Stopping install script." echo "Exiting."
echo "Waiting 5 seconds for supervisord."
sleep 5
fi fi

View file

@ -8,18 +8,6 @@ autostart=true
autorestart=true autorestart=true
user=root user=root
[program:install]
process_name=%(program_name)s
command=./install
autostart=true
autorestart=false
exitcodes=0
user=pterodactyl
directory=/var/www/html/pterodactyl
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
[program:laravel-worker] [program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/pterodactyl/artisan queue:work database --queue=high,standard,low --sleep=3 --tries=3 command=php /var/www/html/pterodactyl/artisan queue:work database --queue=high,standard,low --sleep=3 --tries=3