Set up ops.babycentral.co TEST environment
##
1. Create domain name, database, database user and ftp user on PLESK
[https://silly-kirch.165-22-56-189.plesk.page\
](https://silly-kirch.165-22-56-189.plesk.page)Please ask Naveen or Teddy to access PLESK
Create domain for example[ https://dev02.babycentral.co/](https://dev02.babycentral.co/)
Database example, just to be more consistent with the domain name.\
DB Name: dev02\bbc\
DB Login: dev02\bbc\
DB Password: \[HARD-TO-GUESS PASSWORD]
Create FTP/SSH user account for this domain
##
2. Clone Repository from Gitlab
Clone repo from Gitlab (Before cloning you need to be authenticated on GitLab)
git clone git@gitlab.com:clari/babycentral3.git
If you don't have access/account on GitLab please ask Clarissa to add/authorise your email address on GitLab then go to[ Create account](https://gitlab.com/users/sign\up) on Gitlab\
Generate SSH Key and add to Gitlab\
Use the same SSH/FTP created in Step 1 to login\
$ ssh-keygen -o -t rsa
$ cat \~/.ssh/id\rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDy2uy+bSyi6xPQCuLO15jEDyVbdFkPRVjdm3w/YzdxOkfMchofnhpjl9GChvc1PL/nAQmP6iuVZaSmM/XE5UrGAVtqIndF6/njSOxYciqlQw6XqFYNZx+/Sa40jiAHLk8tF30fBL1mVEaTDcFuXtyeLVupOHG2GEXzUTgPLDA4ljkvrvtV2L0ZgdzbHHH1tdehoLsWhEOU6qjoRIPA+RruxqCp6ug+HTsTAWyQ9ezVtNDbjIoLxnc1xEpTRFYPQ9Lp1l0tJ94iqfpWZJ8RWoyhYfC9WLtavXGOzTXC2tsfTj4NXGgVBXFf7Y4wxom3oDR/UiiU0ih4vS5PKNRYolhP fervent-goldberg\41f8ir2t0qd@silly-kirch.165-22-56-189.plesk.page
\-sh-4.2$\
Copy SSH Key and add to Gitlab. How to add[ Add SSH Key\
](https://gitlab.com/-/profile/keys)Ctrl C then Ctrl V
##
3. Copy other essential files from source(Live) site
Note that the directory has to be completely empty for this to work (use command ls -a to see all hidden files)
Copy ./config.php file from live and
update directory paths and database credentials\
// CHANGE THE PATH
define('DIR\APPLICATION', '/mnt/bbc/babycent/public\html/catalog/');
define('DIR\SYSTEM', '/mnt/bbc/babycent/public\html/system/');
define('DIR\LANGUAGE', '/mnt/bbc/babycent/public\html/catalog/language/');
.....
\
//CHANGE DATABASE CREDENTIALS
define('DB\DRIVER', 'mysqli');
define('DB\HOSTNAME', 'localhost');
define('DB\USERNAME', 'babycent\babyoc');
define('DB\PASSWORD', 'y0NG$uY^7=l=');
define('DB\DATABASE', 'babycent\babyoc');
Change definition of “TEST\SITE” to 1 (define('TEST\SITE', 1)
define('TEST\SITE', 0);\
Algolia credentials do not need to be changed
Copy .htaccess file from live (source site)
Copy ./panel/config.php file from live and update directory paths and database credentials (mandrill api key can stay the same)
Copy entire directory “catalog/language” from live (source) to target site\
(use following command line to zip)\
zip -r language\folder.zip language/
##
4. Create directories and apply folder permission (755)
system/cache
vqmod/vqcache/
vqmod/logs/
system/logs/
sitemaps
min
##
5. Run Composer
run ‘composer update’ from the command line (in public\html folder) to update composer dependencies
##
6. Install Mr Clary minify
Follow instructions here:
https://github.com/mrclay/minify/blob/master/docs/Install.wiki.md
\
i.e.
cd /path/to/public\html
git clone https://github.com/mrclay/minify.git min
cd min
composer install --no-dev
###
In the /min directory,
Find the config.php file and set min\enableStatic to true ($min\enableStatic = true;)
find the groupsConfig.php file and replace with a copy from live
Please make sure new folder name with some numbers that is cache folder in min/static/ must have writable permission and folder can be accessible/owns by system user.
You can change cache folder permission using “chmod” linux command.
You can change ownership of folder using “chown” linux command.
##
7. Images (not needed)
If you want images to show on the test site, copy the “image” directory from live
##
8. Database setup(export/import)
Use the same SSH/FTP created in Step 1 to login
1. From command line, take a dump of the database
mysqldump --no-tablespaces -u user -p dbname > db\backup\file.sql
Since the new development site will be installed in a new server please download the .sql file (via FTP) then upload it to the root directory of the new server before importing with the mysql command below.
2. Upload/Import sql file to DB server\
mysql -u root -p dbname < db\backup\file.sql\
If the above command renders a user privilege error. Modify the .sql file and remove all occurrence of DEFINER='user@xxx.xxx.xxx.xxx'
\