vitodeploy / vito

The Ultimate Server Management Tool
https://vitodeploy.com
GNU Affero General Public License v3.0
1.21k stars 184 forks source link

Deployment Script skipping commands #41

Closed Afan417 closed 8 months ago

Afan417 commented 1 year ago

My deployment script sometimes runs through all the commands fine, sometimes it only does half or 1 and 2 then stops/gets stuck, not sure if this a Vito issue or maybe a limitation on PHP's configuration or what, looking for any help here.

Here's my deployment script:

git pull origin main

composer install

npm install
npm run build

php artisan optimize:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
saeedvaziry commented 1 year ago

I would first check the logs of the deployments. Most probably your cloned repo has some changes that doesn't allow the 'git pull' command to be executed

Afan417 commented 1 year ago

Git pull works okay, after it finishes let's say composer install it won't go to the next line, in this case npm install, and just get's stuck "Deploying" status.

Sometimes it will not skip npm install, but it will get stuck at npm run build, it's weird.

If I run the script lines 1 by 1 and click deploy it works fine, but that's kinda annoying to do everytime.

saeedvaziry commented 1 year ago

Looks like a streaming problem when the commands are generating a long output.

Try to add --silent to your npm command to not generate long outputs.

Afan417 commented 1 year ago

I tried, still did not work. It skips commands, it should wait and install the first command then go to the next line sequentially in order.

Could this be a PHP limitation, maybe I have to edit something in php.ini?

Here's how my deployment script looks now:

composer install

npm install --silent
npm run build --silent

php artisan optimize:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear

php artisan route:cache
php artisan statamic:stache:warm
php artisan queue:restart
php artisan statamic:search:update --all
php artisan statamic:static:clear
php artisan statamic:static:warm
php artisan statamic:assets:generate-presets --queue

Here's the output, it only ran 3 commands and stopped:

Screenshot 2023-09-07 at 16 09 12

saeedvaziry commented 1 year ago

It's weird a bit. I will try to reproduce the issue

harmlessprince commented 1 year ago

Could this be a case of resources, maybe due to lack of memory

saeedvaziry commented 1 year ago

@harmlessprince it could be. I would recommend at least 1GB memory

harmlessprince commented 1 year ago

@saeedvaziry that is right, if one is running npm or node installation you might need more.

1gb is fare for composer related installations