Update - Server

This documents outlines the update process of the server-side code.

cPanel

To update the script on cPanel, we have made an easy to follow video available in our YouTube channel on https://bit.ly/muly-cpanel-update link.

If you are using cPanel, you can follow below steps to safely update server side code.

  1. Create a backup folder outside your installation e.g., in /home/xxx.

  2. Move .env file and storage folder into the backup folder.

  3. Delete rest files inside your installation and cleanup.

  4. Upload new contents of server folder from update archive into your installation folder.

  5. Delete the default storage folder and .env file from newly uploaded update.

  6. Restore original .env file and storage from backup into your installation.

  7. Run below commands (using Terminal in cPanel) inside your installation folder to update database and cache:

    php artisan config:cache
    php artisan migrate
    php artisan storage:link

LAMP or LEMP

Firstly, create a ZIP archive of the contents of server folder (excluding the parent folder itself). Then upload the created archive to your server using below command:

scp server.zip root@yourapp.com:/var/www/update.zip

Then SSH into the server and apply the update as follows:

ssh root@yourapp.com
# change to folder which contains update.zip
cd /var/www

# delete any previous update residuals
rm -rf old

# extract updates.zip to "updated" folder and prepare
unzip update.zip -d updated
rm updated/.env
cat html/.env > updated/.env
cd updated
php artisan config:cache
php artisan migrate

# change back to original folder
cd /var/www

# stop supervisor (if using background job queue)
sudo systemctl stop supervisor

# restore original "storage" folder and swap live code
rm -rf updated/storage
mv html/storage updated/storage
mv html old
mv updated html
cd html
php artisan config:cache
php artisan storage:link

# fix permissions on new files
chown -R www-data:www-data bootstrap/cache storage .env
chmod -R 755 bootstrap/cache storage
chmod -R 664 .env

# start supervisor again (if using background job queue)
sudo systemctl start supervisor

Last updated