Can you please share your experience of the best way to deploy a Yii developed application?
I have not been able to find any good documentation of how to package a Yii developed app, give it a version number and move it to a production environment.
For example, I recently deployed my application by first deleting all files/folders in the root directory and then replaced them with the new files/folders. Is this really the way to go about, or can you please guide me in the right direction?
You have to read Yii book like
through those book you will obtain a lot of experience, there are a lot of things in Yii framework, so there in no way to tell you by a list or documentation how to create web application with Yii
Maybe I didn’t understand what exactly you mean.
Also what do you mean in your last paragraph?
The first step is to get a version control system setup to manage your code and track your revisions over time.
All of the version control systems provide a way to have a main development trunk and branches in which you develop features. You can tag the versions through the software and it will keep track of your history so it is easy to publish changelogs.
There are many articles out there on how to use these systems (more than one right answer). For a single developer project you may just work on your main trunk entirely and not use feature branches. Keep it simple.
I would recommend setting up at least 2 or maybe 3 environments:
Development: Where you work and implement new features. Probably a windows box running WAMP/XAMPP
Staging/Test/QA: Where you test out your code on a server resembling your production box (probably linux server)
Production: Live site.
Most VCS (version control systems) also provide a means to move code to your server if you are tired of manually moving code around.
I use version control together with an update script.
The version control makes sure that I can revert to previous version if needed. The only tricky part can be with database migrations which require the migration php to migrate down but generally that is not where the functionnal impact is.
The update script follows these steps:
Log the datetime and start notice to a log file (to keep track of when the site was upgraded).
Update the site files on the server;
Update Yii framework files on the server.
Reset access rights on directories (and files) - sometime the revision control systems sets them to undesired values.
Touch a file used to determine the seed for the assets (this makes sure that the assets are located on a different Url after a site update which avoids issues with user cache).
Clear the caches (apc & varnish).
Log datetime and end notice to a log file.
In the above one could add a step to put the site in maintenance, add revision tagging before doing an update, … ; stuff I did when I worked on ASIC development.