Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant new script #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ We are here using shell provisioner. The Vagrant Shell provisioner allows you to

> Latest available version of Virtualbox and Vagrant server should be installed on the server. Run *vagrant -v* to check vagrant version.

> Dowload a Vagrant box for Ubuntu 18.04 and add its path in the Vagrantfile. A Vagrantfile sample is added in this project. Mention path to the Vagrant box in *config.vm.box*.
> Dowload a Vagrant box for Ubuntu 20.04 and add its path in the Vagrantfile. A Vagrantfile sample is added in this project. Mention path to the Vagrant box in *config.vm.box*.

> Mention Vagrant username, password and IP address in their respective fields.

Expand All @@ -26,21 +26,23 @@ We are here using shell provisioner. The Vagrant Shell provisioner allows you to
Enable shell provisioning by defining function in Vagrantfile. A qloapps.sh bash script is placed parallel to the Vagrantfile. Configure your Vagrantfile by mentioning box name, IP address, vagrant user and vagrant password and add
*config.vm.provision "shell", path: "qloapps.sh"* as shown in Vagrantfile.

Now open qloapps.sh file and set the *domain name, database host and database name* in their respective variables. Take a note that *mysql root password* will be randomly generated here which you can check in a log file located at */var/log/check.log* after shell provisioning is completed. *Don't forget to remove /var/log/check.log file after noting down mysql root password.*
Now open qloapps.sh file and set the *domain name, database host and database name* in their respective variables. Take a note that *mysql root password* will be randomly generated here which you can check in a log file located at */var/log/check.log* after shell provisioning is completed.

*Don't forget to remove /var/log/check.log file after noting down mysql root password.*

In our architecture, we are using:

> Ubuntu 18.04
> Ubuntu 20.04

> Apache2

> PHP-7.2
> PHP-7.4

> Mysql-5.7
> Mysql-8.0

> Database user: root

> Qloapps installation path: /var/www/html/hotelcommerce
> Qloapps installation path: /home/your_username_here/www/QloApps


After finishing the script,
Expand All @@ -61,6 +63,10 @@ After finishing the script,

After successfull installation, hit the url http://your-server-name and begin with the installation.

*Note: After installation don't forget to remove /home/your_username_here/www/Qloapps/install/
use this command to remove -- > rm -rf /home/qloapps/www/QloApps/install/
*

## GETTING SUPPORT

If you have any issues, contact us at [email protected] or raise ticket at https://webkul.uvdesk.com/
Expand Down
51 changes: 26 additions & 25 deletions qloapps.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
# VAGRANT PROVISIONING SCRIPT FOR QLOAPPS
# AUTHOR: Alankrit Srivastava
# AUTHOR: Anuj Mishra
# Webkul Software Pvt. Limited.
# Operating System: Ubuntu 18.04
# Operating System: Ubuntu 20.04

##########################################################################################################
# This block contains variables to be defined by user. Before running this script, you must ensure that: #
Expand All @@ -14,15 +14,16 @@
# throw errors and destroy configuration for first user. #
##########################################################################################################

domain_name= ## mention the domain name
# Manually set the user to 'qloapps'
user="your_username_here" # Define the user manually

database_host="" ## mention database host.
domain_name="your_domain_here" ## mention the domain name

database_name="" ## mention database name

mysql_root_password=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1` ## randomly generated database
database_host="localhost" ## mention database host.

database_name="qloapps" ## mention database name

mysql_root_password=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1` ## randomly generated database

database_Connectivity() {
echo "CHECKING DATABASE HOST CONNECTIVITY"
Expand All @@ -46,7 +47,6 @@ echo "DATABASE $database_name IS FREE TO BE USED"
fi
}


lamp_Installation() {
##update server
apt-get update \
Expand All @@ -57,19 +57,19 @@ apt-get update \
&& apt-get update \
&& apt-get install -y software-properties-common \
&& apt-get install -y language-pack-en-base \
&& LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php \
&& LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive add-apt-repository -y ppa:ondrej/php \
&& apt-get update \
&& apt-get -y install php7.2 php7.2-curl php7.2-intl php7.2-gd php7.2-dom php7.2-iconv php7.2-xsl php7.2-mbstring php7.2-ctype php7.2-zip php7.2-pdo php7.2-xml php7.2-bz2 php7.2-calendar php7.2-exif php7.2-fileinfo php7.2-json php7.2-mysqli php7.2-mysql php7.2-posix php7.2-tokenizer php7.2-xmlwriter php7.2-xmlreader php7.2-phar php7.2-soap php7.2-mysql php7.2-fpm php7.2-bcmath libapache2-mod-php7.2 \
&& sed -i -e"s/^memory_limit\s*=\s*128M/memory_limit = 512M/" /etc/php/7.2/apache2/php.ini \
&& echo "date.timezone = Asia/Kolkata" >> /etc/php/7.2/apache2/php.ini \
&& sed -i -e"s/^upload_max_filesize\s*=\s*2M/upload_max_filesize = 16M/" /etc/php/7.2/apache2/php.ini \
&& sed -i -e"s/^max_execution_time\s*=\s*30/max_execution_time = 500/" /etc/php/7.2/apache2/php.ini
&& apt-get -y install php7.4 php7.4-curl php7.4-intl php7.4-gd php7.4-dom php7.4-iconv php7.4-xsl php7.4-mbstring php7.4-ctype php7.4-zip php7.4-pdo php7.4-xml php7.4-bz2 php7.4-calendar php7.4-exif php7.4-fileinfo php7.4-json php7.4-mysqli php7.4-mysql php7.4-posix php7.4-tokenizer php7.4-xmlwriter php7.4-xmlreader php7.4-phar php7.4-soap php7.4-fpm php7.4-bcmath libapache2-mod-php7.4 \
&& sed -i -e"s/^memory_limit\s*=\s*128M/memory_limit = 512M/" /etc/php/7.4/apache2/php.ini \
&& echo "date.timezone = Asia/Kolkata" >> /etc/php/7.4/apache2/php.ini \
&& sed -i -e"s/^upload_max_filesize\s*=\s*2M/upload_max_filesize = 16M/" /etc/php/7.4/apache2/php.ini \
&& sed -i -e"s/^max_execution_time\s*=\s*30/max_execution_time = 500/" /etc/php/7.4/apache2/php.ini

##install mysql-server=5.7
##install mysql-server=8.0
export DEBIAN_FRONTEND="noninteractive"
echo "mysql-server-5.7 mysql-server/root_password password $mysql_root_password" | debconf-set-selections
echo "mysql-server-5.7 mysql-server/root_password_again password $mysql_root_password" | debconf-set-selections
apt-get -y install mysql-server-5.7
echo "mysql-server-8.0 mysql-server/root_password password $mysql_root_password" | debconf-set-selections
echo "mysql-server-8.0 mysql-server/root_password_again password $mysql_root_password" | debconf-set-selections
apt-get -y install mysql-server
sleep 4
database_Connectivity
sleep 2
Expand All @@ -88,8 +88,8 @@ touch /etc/apache2/sites-enabled/qloapps.conf
cat <<EOF >> /etc/apache2/sites-enabled/qloapps.conf
<VirtualHost *:80>
ServerName $domain_name
DocumentRoot /var/www/html/hotelcommerce
<Directory /var/www/html/hotelcommerce>
DocumentRoot /home/${user}/www/QloApps
<Directory /home/>
Options FollowSymLinks
Require all granted
AllowOverride all
Expand All @@ -101,15 +101,16 @@ CustomLog /var/log/apache2/access.log combined
</VirtualHost>
EOF
}

mkdir -p /home/${user}/www/
qloapps_Download() {
apt-get install -y git
cd /var/www/html/ && git clone https://github.com/webkul/hotelcommerce.git
cd /home/${user}/www/ && git clone -b v1.6.1 https://github.com/Qloapps/QloApps.git

##ownership and permissions
find /var/www/html/ -type f -exec chmod 644 {} \;
find /var/www/html/ -type d -exec chmod 755 {} \;
chown -R www-data:www-data /var/www/html/
find /home/${user}/www/ -type f -exec chmod 644 {} \;
find /home/${user}/www/ -type d -exec chmod 755 {} \;
echo "changing ownership /home/${user}/www/ "
chown -R www-data:www-data /home/${user}

##restart servers
/etc/init.d/apache2 restart
Expand Down