Setting up Gitlab-CI to deploy your PHP & HTML (or any other ‘static’ site) is quite simple, but poorly documented. After a few weeks of fiddling around I found the following solution. I’d love to hear everyone’s feedback.
- Your webserver must have root access (to install the runner).
- Your site/codebase should be rather small and not too complex.
- This example uses rsync to move/sync two folders, so sites that can self-update their DB like wordpress should be OK, but I have not tested it.
- We’re going to use rsync to move/sync two folders, so sites that self-manage media content, like wordpress, will lose that media content. You will need to tweak the rsync script to handle this yourself.
- A gitlab install or repo you have permission to add runners to.
- These instructions are for Linux (Ubuntu 14.04 specifically) but they should be applicable to any OS supported by the runner.
Continue reading “How to deploy PHP/HTML website with Gitlab CI”