Continuous Integration / Deployment
We have multiple solutions for a CI / CD workflow. A legacy one based on Jenkins, this one is still used for older projects or when a VPN connection is required. And one based on Buddy. Buddy is used for almost all of our new projects. It is based on docker and has a really intuitive UI.
It is also possible to import pipelines via yaml files into buddy. What follows are the two most used pipelines for recent Flynt projects.
Linting
For every project we set up a linting pipeline in Buddy. Click on import in the Buddy project and upload this snippet as a .yml
file
- pipeline: "Lint"
trigger_mode: "ON_EVERY_PUSH"
ref_name: "refs/heads/*"
ref_type: "WILDCARD"
trigger_condition: "ALWAYS"
actions:
- action: "Execute: npm run lint"
type: "BUILD"
docker_image_name: "library/alpine"
docker_image_tag: "3.9"
execute_commands:
- "cd theme"
- "npm i"
- "composer install"
- "npm run lint"
setup_commands:
- "apk add --no-cache --virtual .osDeps \\"
- " git \\"
- " openssh-client \\"
- " rsync \\"
- " curl \\"
- " ca-certificates \\"
- " vim"
- "apk add --no-cache --virtual .runDeps \\"
- " mysql-client \\"
- " php7 \\"
- " nodejs \\"
- " nodejs-npm \\"
- " composer"
- "apk add --no-cache --virtual .phpPackages \\"
- " php7-json \\"
- " php7-zlib \\"
- " php7-xml \\"
- " php7-pdo \\"
- " php7-phar \\"
- " php7-openssl \\"
- " php7-pdo_mysql \\"
- " php7-mysqli \\"
- " php7-session \\"
- " php7-gd \\"
- " php7-iconv \\"
- " php7-mcrypt \\"
- " php7-curl \\"
- " php7-opcache \\"
- " php7-ctype \\"
- " php7-apcu \\"
- " php7-intl \\"
- " php7-bcmath \\"
- " php7-mbstring \\"
- " php7-dom \\"
- " php7-xmlreader \\"
- " php7-soap \\"
- " php7-xmlwriter \\"
- " php7-simplexml \\"
- " php7-tokenizer && \\"
- " ln -fs /etc/php7 /etc/php && \\"
- " ln -fs /usr/bin/php7 /usr/bin/php && \\"
- " ln -fs /usr/lib/php7 /usr/lib/php"
- "curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \\"
- " chmod +x wp-cli.phar && \\"
- " mv wp-cli.phar /usr/bin/wp"
shell: "SH"
trigger_condition: "ALWAYS"
Deployment
Deployments are done with a zero downtime approach. That means during deployment, all built project files will be uploaded to the remote server via rsync
to a temporary / cache folder. Once the files are uploaded, symlinks are created for shared files and folders that should persist between different deployments and that only live on the remote environment. Once this step is completed, the content of the cache folder is copied into a releases folder with the git commit hash as the folder name. As the last step, this subfolder of the releases folder is symlinked to the docroot of the webserver.
The following .yml
file can be imported into Buddy. To complete the import, the following pipeline variables need to be set via the Buddy web ui.
TODO: add yaml file
Technical requirements for web server
We have defined the minimal technical requirements for the web server in our AGB.