Accelerate your PHP deployment using TeamCity
I use TeamCity for my CI needs, I love how easy it is to use and how it reduces the amount of boilerplating.
One thing I didn't like was how long it took to run, copying over 3000 files totalling 12MB, which was taking close to 20 minutes. That isn't an ideal amount time to have a website down, so I started to think of ways to speed up my deployment job.
The solution is actually pretty simple, and I don't know why I never considered it before.
The solution was compressing the contents I wanted to push up to my server and then extract it on the server
tar -czvf website.tar.gz public_html config vendor
once the compressed folder is on the server I extract the contents
tar -xzvf website.tar.gz
I knew this was going to be faster but I was besides myself on just how much faster. I took a screenshot that shows the duration for a job that ran the regular way and the way with the compressed folder.
the regular method of uploading a file 1 at a time took 13 minutes, doing it the compressed way, 26 seconds!
26 seconds! I did not expect it to be that fast. I highly recommend compressing your contents.
I would not only recommend this for PHP projects but even for projects that are compiled. I don't have any data to show for that case, but I'd think it would benefit from only needing to be uploaded once.