add better install

This commit is contained in:
liberodark 2019-01-02 13:43:15 +01:00
parent bac12488de
commit 370c3a0507
2 changed files with 51 additions and 7 deletions

31
conf/.env.example Normal file
View file

@ -0,0 +1,31 @@
APP_ENV=production
APP_DEBUG=false
APP_KEY=
APP_THEME=pterodactyl
APP_TIMEZONE=America/New_York
APP_CLEAR_TASKLOG=720
APP_DELETE_MINUTES=10
APP_ENVIRONMENT_ONLY=true
LOG_CHANNEL=daily
APP_LOCALE=en
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=__DB_NAME__
DB_USERNAME=__DB_USER__
DB_PASSWORD=__DB_PASS__
HASHIDS_SALT=
HASHIDS_LENGTH=8
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM=no-reply@example.com
QUEUE_HIGH=high
QUEUE_STANDARD=standard
QUEUE_LOW=low

View file

@ -147,11 +147,16 @@ ynh_system_user_create $app
### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script ### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script ### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
db_name=$(ynh_sanitize_dbid $app) #db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name #ynh_app_setting_set $app db_name $db_name
ynh_mysql_setup_db $db_name $db_name #ynh_mysql_setup_db $db_name $db_name
#ynh_mysql_execute_as_root <<< "GRANT ALL PRIVILEGES ON $db_name.* TO '$app'@'localhost' WITH GRANT OPTION;FLUSH PRIVILEGES;" #ynh_mysql_execute_as_root <<< "GRANT ALL PRIVILEGES ON $db_name.* TO '$app'@'localhost' WITH GRANT OPTION;FLUSH PRIVILEGES;"
db_user=$app
db_name=$app
db_pass=$(ynh_string_random 20)
ynh_app_setting_set $app db_pass $db_pass
#============================================== #==============================================
# INSTALL Composer # INSTALL Composer
#============================================== #==============================================
@ -160,16 +165,25 @@ ynh_mysql_setup_db $db_name $db_name
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php php composer-setup.php --install-dir=/usr/bin --filename=composer
php -r "unlink('composer-setup.php');" php -r "unlink('composer-setup.php');"
#=================================================
# MODIFY A CONFIG FILE
#=================================================
# Main config File
ynh_replace_string "__DB_USER__" "$db_user" "../conf/.env.example"
ynh_replace_string "__DB_NAME__" "$db_name" "../conf/.env.example"
ynh_replace_string "__DB_PASS__" "$db_pass" "../conf/.env.example"
cp -a ../conf/.env.example $final_path/.env
#============================================== #==============================================
# INSTALL Pterodactyl # INSTALL Pterodactyl
#============================================== #==============================================
cd /var/www/pterodactyl cd $final_path
chmod -R 755 storage/* bootstrap/cache/ chmod -R 755 storage/* bootstrap/cache/
cp .env.example .env
composer install --no-dev --optimize-autoloader composer install --no-dev --optimize-autoloader
php artisan key:generate --force php artisan key:generate --force
php artisan p:environment:setup php artisan p:environment:setup
@ -220,7 +234,6 @@ cp -a ../conf/pteroq.service /etc/systemd/system/pteroq.service
# Set permissions to app files # Set permissions to app files
#chown -R root: /etc/loolwsd #chown -R root: /etc/loolwsd
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================