WordPress Continuous Deployment
Blog & Docker & GIT

Wordpress Continuous Deployment

December 30, 2018

I guess you have already heard about some currently hot topics: DevOps, Continuous deployment, Continuous integration, … Well, I am not gonna talk about it in general. I just want to show you my approach of WordPress continuous deployment, that consist of using continuous deployment technique on the WordPress development. Let’s say you have the following setup: You are developing a WP site locally on a docker container, but you also have an online hosting, where the client can see the changes of development before production time.

Check this out to see my docker containers for wordpress development

Before start using WordPress continuous deployment technique, I had to publish all of the changes manually if I want to show some progress to the client. It can get pretty annoying, if you have to do it multiple times a day. To avoid that, a lot of WP developers work directly on a hosting environment (which is accessible to everybody). It’s not my favorite setup, because of the following downsides:

  • Also if you are using an IDE with automatic file upload on Ctrl+S shortcut, you can sometimes press F5 and the changed files are not there yet
  • The client may take a look at the site in development at the moment that you are facing an issue, that can result in an ugly error.

To avoid that and have the advantage of a local development environment where you can debug without any hurry, I turned to WordPress continuous deployment approach. I manly use bitbucket as my git repository, so I decided to take a look at it’s Pipelines service. It’s an excellent service, that uses Docker containers to build solution / perform unit tests on it / and in our case deploy the solution files. They allow you to run any Docker image that can be be downloaded from any Docker repositories available on the internet and execute any command that you define in the yml file. Basically after any commit (on the defined branch) Bitbucket pipelines will bring to life a Docker container – that you define in the bitbucket-pipelines.yml file in the root folder of the git repository – and place you in the directory (in my case: /opt/atlassian/pipelines/agent/build) where will be already located all yours latest repository files (brought to you by Docker volumes). Then there is up to you what will you do. In my scenario, I will push all the changed files to the FTP server. You can see my Docker yml file below:

image: wordpress:latest

   - step:
   - composer
   - apt-get update
   - apt-get -qq install git-ftp 
   - git config git-ftp.url $FTPADDRESS
   - git config git-ftp.user $USERNAME
   - git config git-ftp.password $PASS
   - git ftp push
   #- git ftp init  #this needs to be run the first time

As you can see in the script section you can write write any bash command you want. In my example, I first re-synchronize the package index files from their sources and than install git-ftp and then define the parameters to access the FTP server. There are no actual username, password or ftp-address visible, because I am using system variables $FTPADDRESS, $USERNAME, $PASS that you can define in the bitbucket docker editor interface (visible in the image below).


Wordpress continuous deployment on Bitbucket - environment variables


Once everything is ready and you push a new commit to the bitbucket git repository, you can go to the repository pipelines tabs and watch what is going on the docker container in real time. As you can see in the image below.

Wordpress continuous deployment on Bitbucket

Important: Before start using git ftp push, you first need to initialize it with git ftp init. The init parameter will create a file on the FTP server, containing the git hash of the current commit that is uploaded to on this FTP (WEB) server.

It may sound complicated at first sight and not worth it’s time – this was one of my thought at first to – but at the and of the day it will save you a lot of time. Give it a try. My (or similar) approach of WordPress continuous deployment will be a life saver.


Follow deanpodgornik on

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *