I
I
Ilya2018-09-01 15:02:19
Continuous Integration
Ilya, 2018-09-01 15:02:19

CI/CD for Wordpress via Gitlab?

Hi everybody.
I am very interested in the issue of setting up the gitlab-ci.yml file for Wordpress projects, with the possibility of subsequent deployment to the server via ssh.
I'd love to see some examples of the file.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
O. J, 2018-09-03
@OrlovEvgeny

fortunately gitlab-ci is a great CI solution, and unfortunately a rather controversial CD.
For deploying php projects, it is best to use deployer.org ,
An example of the simplest implementation for wp link
Further, if you want, deploy and rollback can be described without problems through gitlab-ci.yml

deploy to prodution:
  stage: deploy
  script:
  - dep deploy prod --branch=master
  only:
  - master
  when: manual

But jenkins is the best for this.

I
Ilya Evseev, 2020-01-17
@IlyaEvseev

We use an internal self-written bash solution for Wordpress CI / CD, with a gradual transition to ansible.
The .gitlab-ci.yml in the project looks something like this:

stages:
 - test
 - demo
 - prod

variables:
  GIT_STRATEGY: none

test_stage:
  stage: test
  only: [test]
  tags: [test]
  script: deploy-wordpress-site

demo_stage:
  stage: demo
  only: [demo]
  tags: [demo]
  script: deploy-wordpress-site

prod_stage:
  stage: prod
  tags: [prod]
  only: [prod]
  script: deploy-wordpress-site

Plus, there are a couple of scripts on dev servers that developers use to fix the state of the database for commit and deployment.
The main stumbling block is that if data is added to the database and files to disk in production, it is important not to overwrite them with a deployment.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question