Installer
This commit is contained in:
parent
bef4bc2198
commit
37b600195c
23
README.md
23
README.md
@ -1,24 +1,3 @@
|
||||
# Master
|
||||
|
||||
Add to ```repositories```
|
||||
```
|
||||
"ga.master": {
|
||||
"type": "git",
|
||||
"url": "https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-OctoberPlugins.git"
|
||||
},
|
||||
"ga.graphql": {
|
||||
"type": "git",
|
||||
"url": "https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-GraphQL.git"
|
||||
},
|
||||
"ga.schooling": {
|
||||
"type": "git",
|
||||
"url": "https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-Schooling.git"
|
||||
},
|
||||
"ga.fleet": {
|
||||
"type": "git",
|
||||
"url": "https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-Fleet.git"
|
||||
}
|
||||
```
|
||||
|
||||
Require
|
||||
```"germanairlinesva/master": "dev-master"```
|
||||
Run ```installer/installer.sh``` to install on a fresh Ubuntu 20.04
|
||||
46
installer/ga_install.sh
Normal file
46
installer/ga_install.sh
Normal file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
repos="{
|
||||
\"ga.master\": {
|
||||
\"type\": \"git\",
|
||||
\"url\": \"https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-OctoberPlugins.git\"
|
||||
},
|
||||
\"ga.graphql\": {
|
||||
\"type\": \"git\",
|
||||
\"url\": \"https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-GraphQL.git\"
|
||||
},
|
||||
\"ga.schooling\": {
|
||||
\"type\": \"git\",
|
||||
\"url\": \"https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-Schooling.git\"
|
||||
},
|
||||
\"ga.fleet\": {
|
||||
\"type\": \"git\",
|
||||
\"url\": \"https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-Fleet.git\"
|
||||
}
|
||||
}"
|
||||
require="{
|
||||
\"germanairlinesva/master\": \"dev-master\"
|
||||
}"
|
||||
tmp=$(mktemp)
|
||||
|
||||
cd /var/www/ga
|
||||
|
||||
whiptail --msgbox "Adding repositories and require" 7 35
|
||||
cp composer.json composer.json.bak
|
||||
jq ".require += $require | .repositories += $repos" composer.json > "$tmp" && mv "$tmp" composer.json
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not add GermanAirlines specific repositories and require"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
whiptail --msgbox "Updating dependecies and migrating" 7 38
|
||||
composer update
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not install GermanAirlines plugins"
|
||||
exit 1
|
||||
fi
|
||||
php artisan october:migrate
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not migrate GermanAirlines plugins"
|
||||
exit 1
|
||||
fi
|
||||
8
installer/ga_install_prereq.sh
Normal file
8
installer/ga_install_prereq.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
whiptail --msgbox "Installing GA Prerequisites" 7 31
|
||||
apt install npm git jq
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not install GermanAirlines specific prerequisites"
|
||||
exit 1
|
||||
fi
|
||||
47
installer/ga_setup.sh
Normal file
47
installer/ga_setup.sh
Normal file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
tmp=$(mktemp)
|
||||
|
||||
cd /var/www/ga
|
||||
|
||||
whiptail --msgbox "Configuring broadcaster and lighthouse" 7 44
|
||||
cp .env .env.bak
|
||||
awk '/BROADCAST_DRIVER/{sub(/=.*/, "=redis"); print "LIGHTHOUSE_BROADCASTER=echo"; print "LIGHTHOUSE_CACHE_TTL=200"}{print $0}' .env > "$tmp" && mv "$tmp" .env
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not set GermanAirlines specific env variables"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd config
|
||||
|
||||
whiptail --msgbox "Adding BROADCAST_DRIVER env" 7 31
|
||||
cp broadcasting.php broadcasting.php.bak
|
||||
sed "s/'default' => 'pusher',/'default' => env('BROADCAST_DRIVER', 'pusher'),/" broadcasting.php > "$tmp" && mv "$tmp" broadcasting.php
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not patch broadcasting config"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
whiptail --msgbox "Linking graphs directory" 7 28
|
||||
mkdir graphql
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not add graphql directory"
|
||||
exit 1
|
||||
fi
|
||||
cd graphql
|
||||
ln -s ../plugins/germanairlinesva/graphql/graphs
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not link graphs directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
whiptail --msgbox "Setting ownership" 7 21
|
||||
chown www-data -R .
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not set ownership to www-data"
|
||||
exit 1
|
||||
fi
|
||||
36
installer/install.sh
Normal file
36
installer/install.sh
Normal file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
./october_install_prereq.sh
|
||||
if [ $? != 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
whiptail --msgbox "Generating databases" 7 24
|
||||
mysql < ./october_db_setup.sql
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not create databases"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./october_setup.sh
|
||||
if [ $? != 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./ga_install_prereq.sh
|
||||
if [ $? != 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
./ga_install.sh
|
||||
if [ $? != 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
./ga_setup.sh
|
||||
if [ $? != 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./laravel-echo-server-install.sh
|
||||
if [ $? != 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
13
installer/laravel-echo-server-install.sh
Normal file
13
installer/laravel-echo-server-install.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
whiptail --msgbox "Installing laravel-echo-server" 7 34
|
||||
npm i -g laravel-echo-server
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not install laravel-echo-server"
|
||||
exit 1
|
||||
fi
|
||||
laravel-echo-server init
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not initialize laravel-echo-server"
|
||||
exit 1
|
||||
fi
|
||||
9
installer/october_db_setup.sql
Normal file
9
installer/october_db_setup.sql
Normal file
@ -0,0 +1,9 @@
|
||||
create database october;
|
||||
create database germanairlinesva_fleet;
|
||||
create database germanairlinesva_schooling;
|
||||
|
||||
create user 'october'@'localhost' identified by '1582';
|
||||
|
||||
grant all on *.* to 'october'@'localhost';
|
||||
|
||||
flush privileges;
|
||||
63
installer/october_install_prereq.sh
Normal file
63
installer/october_install_prereq.sh
Normal file
@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
tmp=$(mktemp)
|
||||
|
||||
whiptail --msgbox "Installing LAMP + Redis" 7 27
|
||||
apt install apache2 libapache2-mod-php php mysql-server mysql-client php-mysql redis php-redis php-ctype php-curl php-xml php-fileinfo php-gd php-json php-mbstring php-zip
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mapt failed to run"
|
||||
exit 1
|
||||
fi
|
||||
a2enmod rewrite
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not enable mod_rewrite"
|
||||
exit 1
|
||||
fi
|
||||
systemctl restart apache2
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not restart apache2"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
whiptail --msgbox "Enabling overwrites for host" 7 32
|
||||
cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak
|
||||
awk '/<Directory \/var\/www\/>/{f=1}f{sub(/None/, "All")}/<\/Directory>/{f=0}{print $0}' /etc/apache2/apache2.conf > "$tmp" && mv "$tmp" /etc/apache2/apache2.conf
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not modify apache2 con exit 1
|
||||
fig"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
whiptail --msgbox "Secure MySQL Installation" 7 29
|
||||
mysql_secure_installation
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not secure MySQL installation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
whiptail --msgbox "Installing Composer" 7 23
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not download composer setup"
|
||||
exit 1
|
||||
fi
|
||||
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not verify composer setup"
|
||||
exit 1
|
||||
fi
|
||||
php composer-setup.php
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not run composer setup"
|
||||
exit 1
|
||||
fi
|
||||
php -r "unlink('composer-setup.php');"
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not remove composer setup"
|
||||
exit 1
|
||||
fi
|
||||
mv composer.phar /usr/local/bin/composer
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not install composer"
|
||||
exit 1
|
||||
fi
|
||||
24
installer/october_setup.sh
Normal file
24
installer/october_setup.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /var/www
|
||||
|
||||
whiptail --msgbox "Fetching October" 7 20
|
||||
composer create-project october/october ga
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not create project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ga
|
||||
|
||||
whiptail --msgbox "Installing October" 7 22
|
||||
php artisan october:install
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not install october"
|
||||
exit 1
|
||||
fi
|
||||
php artisan october:migrate
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\033[0;31mCould not run migration"
|
||||
exit 1
|
||||
fi
|
||||
25
installer/subtest.htm
Normal file
25
installer/subtest.htm
Normal file
@ -0,0 +1,25 @@
|
||||
title = "SubTest"
|
||||
layout = "default"
|
||||
url = "/subtest"
|
||||
==
|
||||
<?php
|
||||
function RandomString($len = 10) {
|
||||
$characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$randstring = '';
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$randstring .= $characters[rand(0, strlen($characters) - 1)];
|
||||
}
|
||||
return $randstring;
|
||||
}
|
||||
function onStart() {
|
||||
$ac = new GermanAirlinesVa\Fleet\Models\Aircraft();
|
||||
$ac->aircraft_type_id = 1;
|
||||
$ac->home_airport_id = 1;
|
||||
$ac->registration = "D-".$this->RandomString(4);
|
||||
$ac->name = $this->RandomString();
|
||||
$ac->save();
|
||||
|
||||
\Nuwave\Lighthouse\Execution\Utils\Subscription::broadcast('aircraft', $ac);
|
||||
}
|
||||
?>
|
||||
==
|
||||
Loading…
x
Reference in New Issue
Block a user