Sandbox CI/CD Environments for Everyone
by Leonid Makarov Chief Architect @ FFW “Can not reproduce!” What to do? Why Docker
https://www.slideshare.net/LeonidMakarov2/docksal-better-than-vms ★ Containers are more efficient, if you have several projects you to work on ★ Images, not fragile provisioning at runtime ★ It is easier to extend containers based configuration in a reproducible way ★ Containers are more portable (CI reuse) Compose + Containers + Conventions = Docksal
+ + Docksal.yml is Compose
★ No new YML dialect you need to learn ★ Fully Docker Compose compatible Docksal branded containers
➔ Three project services ◆ ◆ ◆ ➔ Additional stock services ◆ Solr ◆ Varnish ➔ Boilerplate projects for ◆ Drupal 8, Drupal 7 ◆ Hugo ◆ Wordpress ◆ Gatsby JS ◆ Magento ◆ Grav CMS ◆ Laravel Change what you like
★ Create custom automation in BASH, Node or PHP ★ Full power and flexibility of Docker Compose ★ Seamlessly extend our stock Docker images on the project level with your Dockerfile ★ Create and publish addons github.com/docksal/addons Automation
Why write documentation when you can write code? Initialize project with the environment in one line
fin init
All-in-one:
➔ Create containers ➔ Run project automation: move files, initialize settings, import database, compile css, run drush... Almost everything comes from nothing
Initialize from ground zero
fin run-cli composer create-project ... You require more automation
Create as many commands as you need
fin clear-cache
fin build-theme
fin collect --minerals Reuse automation to create sandboxes
Initialize sandboxes using the same
fin init What sandboxes are for?
★ ★ ★ ★ What you need for sandboxes Repository setup
➔ Git repository ➔ Accessible from your future Sandboxes server ➔ Public repo or Authentication by SSH key Sandboxes server setup
➔ Linux box (AWS, Digitalocean, custom...) ➔ Ubuntu Linux* + Other distributions are supported with manual network setup ➔ Docksal ➔ SSH keys setup ➔ Create builds folder
★ Installing Docksal on DigitalOcean example https://bit.ly/2Kf8dg6 CircleCI setup
Full working example config.yml is in docksal/drupal8 project
https://github.com/docksal/drupal8/blob/feature/circleci/.circleci/config.yml CircleCI setup
jobs: build: ... docker: - image: docksal/ci-agent:edge-php
https://github.com/docksal/drupal8/blob/feature/circleci/.circleci/config.yml CircleCI setup steps:
... - run: name: Initialize sandbox command: | build-init build-exec "fin init" ... Build status notifications Bonus for CI enthusiasts Automatic sandbox memory and space cleanup
PROJECT_INACTIVITY_TIMEOUT - defines the timeout of inactivity after which the project stack will be stopped (e.g. 0.5h)
PROJECT_DANGLING_TIMEOUT - defines the timeout of inactivity after which the project stack and code base will be entirely wiped out from the host (e.g. 168h).
PROJECTS_ROOT - directory where all projects are stored (on CI server defaults to /home/ubuntu/builds). Required for PROJECT_DANGLING_TIMEOUT Automatic sandbox memory and space cleanup
$ cat /home/ubuntu/.docksal/docksal.env DOCKSAL_UUID=xxxx-xxxx-xxxx-xxxx CI=true PROJECT_INACTIVITY_TIMEOUT="0.5h" PROJECT_DANGLING_TIMEOUT="168h" PROJECTS_ROOT="/home/ubuntu/builds" Thank you! Chat gitter.im/docksal Blog blog.docksal.io Twitter @docksalio Q&A
Leonid Makarov
BADCamp 2018