Deployment steps for the stage.meditherapie.sg website

From PheonixSolutions
Jump to navigation Jump to search

1. Take a backup of the Website code and db with the below commands

mv  /home/meditherapie/public_html/stage.meditherapie.sg /home/meditherapie/public_html/stage.meditherapie.sg-bk-DD-MM-YYYY
cd /home/meditherapie/public_html/stage.meditherapie.sg-bk-DD-MM-YYYY
mysqldump meditherapie_theme > meditherapie_theme-new.sql

Note: Kindly check the DB name and dump the DB with the above command

To get the db name:

cat /home/meditherapie/public_html/stage.meditherapie.sg-DD-MM-YYYY/app/etc/env.php

2. Download the code along with the db from the repository below.

cd /home/meditherapie/public_html/
git clone --branch develop --single-branch https://git.pheonixsolutions.com/pheonix-software/meditherapie.git

3. Rename the downloaded folder to stage.meditherapie.sg in the document root.

 mv /home/meditherapie/public_html/meditherapie /home/meditherapie/public_html/stage.meditherapie.sg

4. Do composer install to get the vendor folder in the document root path.

Note: Before installing the composer, Check the composer version, it should be 2.7.7

cd /home/meditherapie/public_html/stage.meditherapie.sg
composer install

5. Copy .htaccess and /home/meditherapie/public_html/stage.meditherapie.sg-DD-MM-YYYY/app/etc/env.php files from the backup that is done in step 1.

6. Restore the DB on the DB which is mentioned in the env.php file

cd /home/meditherapie/public_html/stage.meditherapie.sg
sed -i 's/mageto/meditherapie_theme/g' meditherapie_new.sql
mysql meditherapie_theme < meditherapie_new.sql

Note: Before restoring, check the DB name in the backup file which we got from GitLab and update the DB name in the file

7. Empty the files under the pub/static folder.

   rm /home/meditherapie/public_html/stage.meditherapie.sg/pub/static

8. Run this deployment command to rebuild the static folder.

cd /home/meditherapie/public_html/stage.meditherapie.sg
COMPOSER_MEMORY_LIMIT=-1 php -d memory_limit=-1 bin/magento setup:static-content:deploy -f

9. Verify ownership and permission and clear/flush cache.

chown -R meditherapie:meditherapie /home/meditherapie/public_html/stage.meditherapie.sg
chmod -R 777 /home/meditherapie/public_html/stage.meditherapie.sg/pub
chmod -R 777 /home/meditherapie/public_html/stage.meditherapie.sg/generated
chmod -R 777 /home/meditherapie/public_html/stage.meditherapie.sg/var
chmod -R 777 /home/meditherapie/public_html/stage.meditherapie.sg/app/etc


10. Update secure and unsecure URL.

php bin/magento config:set web/unsecure/base_url https://stage.meditherapie.sg/
php bin/magento config:set web/secure/base_url https://stage.meditherapie.sg/

If we change any thing, We need run the below commands

php bin/magento cache:clean
php bin/magento cache:flush

11. Check the functionality of the site