diff --git a/Helper/serverInstall.sh b/Helper/serverInstall.sh index b2c3da8..1b8a65e 100644 --- a/Helper/serverInstall.sh +++ b/Helper/serverInstall.sh @@ -6,10 +6,10 @@ # For every user .bash_profile/.bashrc -export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> /var/www/html/backup/bash/$(date "+%Y-%m-%d").log; fi' +export PROMPT_COMMAND='echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> /var/www/html/backup/bash/$(date "+%d").log' apt-get update - +apt-get upgrade apt-get install git snapd ufw software-properties-common # Security @@ -57,8 +57,8 @@ CREATE USER 'demo'@'%' IDENTIFIED BY 'orange'; CREATE DATABASE jingga COMMENT 'Main application database'; CREATE DATABASE demo COMMENT 'Demo application database'; -GRANT ALL PRIVILEGES ON jingga TO 'jingga'@'%'; -GRANT ALL PRIVILEGES ON demo TO 'demo'@'%'; +GRANT ALL PRIVILEGES ON jingga.* TO 'jingga'@'%'; +GRANT ALL PRIVILEGES ON demo.* TO 'demo'@'%'; FLUSH PRIVILEGES; @@ -70,6 +70,7 @@ cat << EOF > /etc/apache2/sites-available/000-default.conf DocumentRoot /var/www/html/jingga ServerName jingga.app ServerAlias www.jingga.app + ServerAlias api.jingga.app SetEnv OMS_STRIPE_SECRET 1 SetEnv OMS_STRIPE_PUBLIC 2 @@ -85,7 +86,9 @@ cat << EOF > /etc/apache2/sites-available/000-default.conf ErrorLog \${APACHE_LOG_DIR}/error.log CustomLog \${APACHE_LOG_DIR}/access.log combined +EOF +cat << EOF > /etc/apache2/sites-available/000-shop.conf ServerAdmin info@jingga.app DocumentRoot /var/www/html/jingga @@ -107,7 +110,9 @@ cat << EOF > /etc/apache2/sites-available/000-default.conf ErrorLog \${APACHE_LOG_DIR}/error.log CustomLog \${APACHE_LOG_DIR}/access.log combined +EOF +cat << EOF > /etc/apache2/sites-available/000-demo.conf ServerAdmin info@jingga.app DocumentRoot /var/www/html/jingga_demo @@ -127,7 +132,9 @@ cat << EOF > /etc/apache2/sites-available/000-default.conf ErrorLog \${APACHE_LOG_DIR}/error.log CustomLog \${APACHE_LOG_DIR}/access.log combined +EOF +cat << EOF > /etc/apache2/sites-available/000-services.conf ServerAdmin info@jingga.app DocumentRoot /var/www/html/jingga @@ -149,7 +156,9 @@ cat << EOF > /etc/apache2/sites-available/000-default.conf ErrorLog \${APACHE_LOG_DIR}/error.log CustomLog \${APACHE_LOG_DIR}/access.log combined +EOF +cat << EOF > /etc/apache2/sites-available/000-software.conf ServerAdmin info@jingga.app DocumentRoot /var/www/html/jingga @@ -170,28 +179,9 @@ cat << EOF > /etc/apache2/sites-available/000-default.conf ErrorLog \${APACHE_LOG_DIR}/error.log CustomLog \${APACHE_LOG_DIR}/access.log combined +EOF - - ServerAdmin info@jingga.app - DocumentRoot /var/www/html/jingga - ServerName jingga.shop - ServerAlias www.jingga.shop - - SetEnv OMS_STRIPE_SECRET 1 - SetEnv OMS_STRIPE_PUBLIC 2 - SetEnv OMS_STRIPE_WEBHOOK 3 - SetEnv OMS_PRIVATE_KEY_I 4 - - - Options Indexes FollowSymLinks - AllowOverride All - Require all granted - - - ErrorLog \${APACHE_LOG_DIR}/error.log - CustomLog \${APACHE_LOG_DIR}/access.log combined - - +cat << EOF > /etc/apache2/sites-available/000-systems.conf ServerAdmin info@jingga.app DocumentRoot /var/www/html/jingga @@ -212,7 +202,9 @@ cat << EOF > /etc/apache2/sites-available/000-default.conf ErrorLog \${APACHE_LOG_DIR}/error.log CustomLog \${APACHE_LOG_DIR}/access.log combined +EOF +cat << EOF > /etc/apache2/sites-available/000-solutions.conf ServerAdmin info@jingga.app DocumentRoot /var/www/html/jingga @@ -493,8 +485,38 @@ cat << EOF > /etc/apache2/sites-available/001-wiki.conf EOF +cat << EOF > /etc/apache2/sites-available/002-gaming.conf + + ServerAdmin info@jingga.app + DocumentRoot /var/www/html/tmrank + ServerName tmrank.jingga.app + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + + ErrorLog \${APACHE_LOG_DIR}/error.log + CustomLog \${APACHE_LOG_DIR}/access.log combined + +EOF + sudo -u www-data mkdir /var/www/html/jingga sudo -u www-data mkdir /var/www/html/jingga_demo +sudo -u www-data mkdir /var/www/html/tmrank +chown -R www-data /var/www + +mkdir -p /var/www/html/backup/bash + +chmod -R 777 + +a2ensite 000-demo.conf +a2ensite 000-shop.conf +a2ensite 000-services.conf +a2ensite 000-software.conf +a2ensite 000-systems.conf +a2ensite 000-solutions.conf a2ensite 001-orw.conf a2ensite 001-invoicing.conf @@ -503,6 +525,8 @@ a2ensite 001-contract.conf a2ensite 001-support.conf a2ensite 001-wiki.conf +a2ensite 002-gaming.conf + systemctl reload apache2 systemctl restart apache2 @@ -542,10 +566,14 @@ apt install code ############################################################### cd /var/www/html/jingga -git clone --recurse-submodules https://github.com/Karaka-Management/Karaka.git . -git clone --recurse-submodules https://github.com/Karaka-Management/privateSetup.git +sudo -u www-data git clone --recurse-submodules https://github.com/Karaka-Management/Karaka.git . +sudo -u www-data git clone --recurse-submodules https://github.com/Karaka-Management/privateSetup.git + +sudo -u www-data git submodule foreach "git checkout develop || true" cd /var/www/html/jingga_demo -git clone --recurse-submodules https://github.com/Karaka-Management/Karaka.git . -git clone --recurse-submodules https://github.com/Karaka-Management/demoSetup.git +sudo -u www-data git clone --recurse-submodules https://github.com/Karaka-Management/Karaka.git . +sudo -u www-data git clone --recurse-submodules https://github.com/Karaka-Management/demoSetup.git +sudo -u www-data git submodule foreach "git checkout develop || true" +chown -R www-data /var/www \ No newline at end of file