Updating Yii2 in Production Site

I have a Dev environment, and a live productions environment.

I can easily update the Dev using composer, but how do you update the Production? It there a way to trigger the update via a command through the site itself, or is it I update the Dev and synch all the files? Or another approach? Just curious what is best practice for this?

Normally vendor is not uploaded with project only composer file so whatever changes are made to vendor is done by running composer commands on production.

This is on a shared hosting that I have no control on. I will do some reading about composer, I thought it needed to be installed locally, which is something I cannot do in this case.

Also, when I’m talking about updating, I’m talking about updating Yii itself, the core application. How to keep Yii current on a production server outside of my management. So basically I have files, cpanel, ftp access. (I will investigate composer further - hopefully that is the answer)

If this is the case then update vendor locally and upload files on production. If you have git access on hosting then you can setup the actions (Web Hook what it is called i guess) that will auto update the code when you push to the repository.

Best practice is what described in installation guide.

  • Have your project in Version Control Repository.
  • Ignore vendor and runtime folders.
  • Run composer to make sure 3rd parties are update to date in both dev and production.
  • Write and run DB migration if you want to sync db.
  • No advice to write auto-update scripts you have to keep monitoring changes in framework in case you have to do some post-upgrade changes.

Best of luck.