F NOTE:
Ex-These are all instructions or one of the ways to setup the system, be vigilant
while running the commands, ask yourself why, google the why and understand-
> this will help you learn things and not just do them, take your time, these are not going
to be repeated till you face a big issue, someone spent a lot of time in making this file as
it is now so no hurry, understand why you are doing what you are doing :-
-> PHP -> 5.6
-> Laravel -> 4.2
-> MongoDb -> 3.2 or 3.4
These three version should be same for our three modules (api, droom-transactional-
website, droom-php-admin) so if during installation of some other program, they ask for
upgrade in any of these please choose No and proceed with best available version that
can comply with these two.
System Setup may give you a hard time, so be active, google actively about errors till git
clone instructions, after that actively ask your colleagues.
For Debugging any issues after git clone or after once your system starts working fine:
1. logs in app/storage/logs ->
A. Droom_exception-> logs basic exception
B. Droom_detail_exception -> logs detailed exception with tail behind it (use
when there is not much in exception logs)
C. Laravel.log -> \Log::info() => these logs that are applied to debug the code
manually can be found in laravel.log file.
D. App/config/app.php => set debug -> true for printing the error on screen in
case there is nothing in exception logs.
E. Check DB connections,
F. Run composer dump autoload in case your changes aren’t reflecting or
when you have taken a fresh pull or whenever you have an error saying
XYZ class not found.
Install JAVA
sudo apt-get install default-jdk
sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
sudo apt-get install oracle-java14-installer
sudo update-alternatives --config java
sudo nano /etc/environment
JAVA_HOME="/usr/lib/jvm/java-14-oracle"
source /etc/environmentl
Install LAMP stack
Install Apache
sudo apt-get update
sudo apt-get install apache2mysql
https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-
ubuntu-18-04
For ubuntu 20.04: https://linuxhint.com/install_apache_web_server_ubuntu/
If apache server shows error while starting “(98)Address already in use: AH00072: make_sock:
could not bind to address [::]:80” then use this link:
https://unix.stackexchange.com/questions/244531/kill-process-running-on-port-80
Install PHP
sudo apt-get purge 'php*'
sudo add-apt-repository ppa:ondrej/ php
sudo apt-get update
sudo apt-get install php5.6
sudo apt-get install php5.6-dev
sudo apt-get install php5.6 php5.6-mysql php5.6-mbstring php5.6-mcrypt php5.6-bcmath
php5.6-xml
Php7.4-zip php7.4-gd are required additionally to all above in php7.4 version for website
Install MySql
(For installing mysql 5.6 on ubuntu 20 ->
https://gist.github.com/vinodpandey/1a4b5b8228f9a000ca236820185fc3bc)
sudo apt-get purge 'mysql*'
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'
sudo apt-get update
sudo apt install mysql-server-5.6 mysql-client-5.6
For UBUNTU 20.04
https://gist.github.com/vinodpandey/1a4b5b8228f9a000ca236820185fc3bc
Binary can be downloaded from official website first and then can be installed
from post download steps of above link
v_installation gives error : “Error: Can’t connect to local MySQL server through socket
‘/var/run/mysqld/mysqld.sock’”, then run => sudo /etc/init.d/mysql start)
In ubuntu 20.04
https://askubuntu.com/questions/1029634/install-mysql-5-6-on-ubuntu-18-04-lts/
1030987#1030987
Install Redis
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install tcl8.5
If tcl8.5 is showing this error: Package 'tcl8.5' has no installation candidate
https://unix.stackexchange.com/quest ions/685728/installation-of-core-emulator-tcl8-5-not-
installing
cd /tmp
wget http://download.redis.io/releases/redis-stable.tar.gz
tar xzf redis-stable.tar.gz
cd redis-stable
;-
https://www.digitalocean.com/community/tutorials/how-to-install-redis-from-source-on-ubuntu-
18-04
cd utils/
sudo ./install_server.sh
Port : 6379
Config file : /etc/redis/6379.conf
Log file : /var/log/redis_6379.logs
Data dir : /var/lib/redis79
Executable : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Install MongoDB
( If there is some issue with 3.2 Please Install 3.4 and not the lower version )
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse" |
sudo apt-get update
sudo apt-get install -y mongodb
Check version => mongod --version for mongodb version, mon
(After installing, If the mongod service fails to start run these commands:
1.) sudo chown -R mongodb:mongodb /var/lib/mongodb
2.) sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
)
(if starting the mongodb service gives the error : Failed to start mongod.service: Unit
mongod.service not found. Try running this => )
Install ElasticSearch
sudo apt-get update
sudo apt-get install openjdk-7-jre
java -version
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y install oracle-java8-installer
java -version
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" >
/etc/apt/sources.list.d/elastic-7.x.list'
sudo apt update
sudo apt install elasticsearch
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service
Install Composer
sudo apt-get update
sudo apt-get install curl php5.6-cli git
(In the above command php5-cli may not get installed because of the error : php5-cli has no
installation candidates, try installing php5.6-cli instead)
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --
filename=composer
Install Git
sudo apt install git
Clone Git
sudo git clone https://github.com/droomlabs/api.git /var/www/html/api
sudo git clone https://github.com/droomlabs/droom-website.git /var/www/html/droom-website
sudo git clone https://github.com/droomlabs/droom-php-admin.git /var/www/html/php-admin
SETUP LARAVEL
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-laravel-with-
lemp-on-ubuntu-18-04
Final Setup after cloning
apps and storage: config for api to api/app/config and storage to api/app/storage
Setp 1:
sudo nano /etc/hosts => copy hosts here
\etc\hosts file add your urls
127.0.0.1 localhost local.api.in local.matrix.droom.in local.droom.in local.secure.droom.in
Step2:
Set up virtual hosts
sudo nano /etc/apache2/sites-available/local.api.in.conf
sudo nano /etc/apache2/sites-available/local.drm.in.conf
sudo nano /etc/apache2/sites-available/local.secure.droom.in.conf
sudo nano /etc/apache2/sites-available/local.matrix.droom.in.conf
sudo a2ensite local.api.in.conf
sudo a2ensite local.drm.in.conf
sudo a2ensite local.matrix.droom.in.conf
sudo a2ensite local.secure.droom.in.conf
sudo a2enmod rewrite
sudo service apache2 restart
Drive link for relevant files -> (working mongo dump + sql dump just for relevant tables of ops
module + all the conf files and .env.local.php files for all three + recent config and storage
folders of all three)
For env files -> copy it to respective repo, remove the repository name from the start of the file
https://drive.google.com/drive/u/4/folders/1Rdi9aphN1OV1iFRPq97sOTQ6TEqtSI8j
conf files for sites-available config in apache => check directory in these files
make conf files in sites available
sudo a2ensite local.api.in.conf
check / and mongo connector credentials in .env.local.php file + app/config/database.php file
(also this is the cause when you get errors related to connector)
Step 3:
composer update
composer dumpautoload ( also everytime when new classfile is created)
For this Errror:
Problem 1
- Root composer.json requires ruler/ruler dev-master, found ruler/ruler[dev-main, v0.1.0, ...,
v0.4.0] but it does not match the constraint. Perhaps dev-master was renamed to dev-
main?
Change: "ruler/ruler": "0.3.1", in composer.json
(install php5.6-curl before hand or composer will show error, ignore if already installed)
errors in connector.php(can be solved by enabling pdo_mysql extension),
mongoclient(mongodb), return(T_RETURN) by copying the file itself instead of content, etc.
For error: Class 'Redis' not found,
sudo apt f php5.6-redis
sudo apt install php7.4-redis
register in /etc/hosts,
make conf files in sites available, a2ensite
sudo apt-get install php-mongo
add extension “extension of redis pdo etc.” in /etc/php/5.6/apache2/php.ini
echo 'extension=/usr/lib/php/20131226/redis.so'
‘echo 'extension=/usr/lib/php/20131226/igbinary.so'
php artisan ide-helper:generate.
sudo service apache2 restart
testing:
admin id : [email protected]
password: 123456
has in db for 123456:: e10adc3949ba59abbe56e057f20f883eu
composer dump-autoload
php artisan optimize
sudo a2enmod rewrite
this if apache is showing such url not found
if site is unable to reach and entry is there in etc/hosts then check your .env.local.php and
permissions to it
mysql -u root -p cscart < droom.sql
in project dir
git status
sudo gedit .git/config -> file=false
git status
sudo git pull origin master/production => (api, transactional -> production, php-admin => master)
Dev server credentials:
'MYSQL_HOST' => '13.232.224.2',
'MYSQL_DATABASE' => 'cscart',
'MYSQL_USERNAME' => 'root',
'MYSQL_PASSWORD' => 'profsnapeisdon',
'MONGODB_HOST' => '13.232.224.2',
'MONGODB_DATABASE' => 'droom',
'MONGODB_USERNAME' => 'root',
'MONGODB_PASSWORD' => 'profsnapeisdon',
mysql -u root -p
create database cscart;
exit;
To check db importing process
Sudo -i
Cd /var/lib/mysql/cscart
ls -ltrh
check env.local.php and app/config/database.php if error is related to sql
connection timeout, check the url, username, password
Migrate -> database update
sudo php artisan migrate --path='folder address' --env=local keep the db name same
make a different folder than migrate and copy the needed file into that then execute the
command
devsearch.droom.in issue
guzzlehttp GuzzleHttp\\Ring\\Exception\\ConnectException cant resolve host
solution : add the specified hostname to /etc/hosts
composer update
INSTALL RABBITMQ
sudo -i
echo "deb http://www.rabbitmq.com/debian/ testing main" >>
/etc/apt/sources.list
curl http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key
add -
sudo apt-get install rabbitmq-server
mongodb
make db- use droom;
make user - db.createUser(
{ user: "root", pwd: "profsnapeisdon", roles:[{role: "userAdminAnyDatabase" , db:"admin"}]})
mongo error, can't connect to localhost at port 27017
sudo lsof -t -i:27017
RAbbitmq error, status code 75
error in /var/log/rabbitmq/startup_log which says:
{error_logger,{{2018,10,3},{13,14,18}},“Cookie file
/var/lib/rabbitmq/.erlang.cookie must be accessible by owner only”,[]}
I thought it would be better to let rabbitmq create a fresh file, so the solution applied was to
remove the erlang cookie file:rm /var/lib/rabbitmq/.erlang.cookie
sudo systemctl restart rabbitmq-server
Standard Errors and standard solutions : (Keep adding here so that
team will be helped by your findings as well)
During System Setup => use google or this file, some errors are mentioned
above for finding more, when something takes you more than 3 hours ask one of
your team mate.
After System Setup =>
MongoClient not found
https://www.php.net/manual/en/mongodb.installation.pecl.php
In case of soft 404, ,Use this
<Directory /var/www/droom/api>
AllowOverride All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteCond %{REQUEST_URI} !^/static
RewriteCond %{REQUEST_URI} !^/uploads
RewriteCond %{REQUEST_URI} !^/photos
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [L]
</IfModule>
</Directory>
AFTER GIT CLONE:
1. git clone repository
2. replace config and storage folders from inside the app
=> go to parent directory, change permission to 777 (for eg. sudo chmod -R 777 api)
3. composer update
4. while starting any work => checkout to production, take fresh pull on production, checkout -b 'Your
Branch', start working,
5. while commiting git status to see list of files modified, git diff 'filename' that you want to change,
check whether changes are only the ones that you wanted
6. git add filename to add file for commiting
once all the files that you want to commit have been added, git commit -m "branch_name | a one liner
about the commit"
7. git push origin branch_name
8. check your commited changes by compare/branchname ahead of repo's github address on which you
pushed
While Using Dev Server:
1. to Restart Mongo DB (can’t connect to dev1.droom.in:27017)=>
sudo mongod -f /etc/mongod.conf
2. (can’t connect to dev1.droom.in:9200) to restart elastic search =>
sudo /etc/init.d/elasticsearch start
3. Listing On web:
in cmp_listings collection -> quantity_available >0, status = 'active',
is_quicksell = 0
take listing from production mongo via command on dev server
sudo php artisan command:CropListingPhotos --env=development
sudo php artisan command:newImportElastic partial --lid=1518047552 --
env=development
=>when payment button in not visible, check url it should be the secure one
=> after choosing payment_method, page gets stuck=> rabbitmq-server is not setup
Having Problems in starting to code =>
https://blog.usejournal.com/how-a-googler-solves-coding-problems-ec5d59e73ec5
Basic Conventions before making your branch ready
for code review
( please add here, need a lot of help in this section )
1. Remove Unused statements, functions, variables.
2. Naming of new functions, variables should make code readable to everyone, not the
other way round.
3. Indentation, spacing, blank lines (only in the lines that you are changing or else it will
show a very high number of changed lines which makes it harder to review the exact
changes brought).
4. Consistent return from a function (i.e. data returned by a function should be symmetrical
in every scenario)
5. Exception Handling.
-> always keep .env.local.php and .env.php
Host -
> dev1.droom.in
Password
profsnapeisdon
Dbname -> sql -> cscart
Mongo- > droom
Positive Flow On Open Source for Ticket
1. Open -> team lead or senior resource will provide dev commit on the ticket when
developer has understood the requirement
2. Dev committed -> dev will provide the ETA on ticket + branch and repo before starting to
code, this time is for planning the execution, then dev can move ticket to in_progress.
3. Dev In Progress -> dev will complete code and unit testing, attach test scenarios and
relevant docs for testing and launch purpose. In case of big changes, a release plan
should also be made. Once finished with all this, dev will comment all final commits from
github on the ticket and move this to in code review.
4. In Code Review -> concerned person will review the code and may suggest changes, in
case of failure (to Reopened) in case of success (to Ready For QA)
5. Ready For QA -> From here on flow transfers to QA team and after they will finish
testing with all bugs fixed, ticket moves to In Pm Signoff
6. In PM Signoff -> PM will provide signoff on functionality after verifying
7. Approval pending -> by Eewar or any senior QA member
8. Smoke Deploy Pending -> devops will take over now
9. Smoke Deployed -> QA will verify changes on smoke server for sanity
10. Prod Deploy Pending -> ready for deployment, Devops will take over
11. Prod Deployed -> Congratulations on your first Step, Welcome to Droom.
Ubuntu Issues
1. Unable to fix, you have held broken packages
https://stackoverflow.com/questions/23035310/ubuntu-unable-to-correct-
problems-you-have-held-broken-packages
2. The following signatures couldn't be verified because the public key is not
available: NO_PUBKEY 6B73A36E6026DFCA
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys key_id_as_in_error