Slide 1

Slide 1 text

Leveraging Gitlab and DDEV Open-source tools to manage 100s of sites

Slide 2

Slide 2 text

We are 1xINTERNET International team of 65 employees From all corners of the world: South America, North America, Asia and Europe Over 18 different languages Offices in Frankfurt (Headquarters), Berlin, Reykjavik and Conil de la Frontera Founded in 2013

Slide 3

Slide 3 text

João Ventura ● From Faro, Portugal ● Living near Darmstadt, Germany ● Developing with Drupal since 4.7 ● Senior Back-end Developer at 1xINTERNET ● Co-organizer of Drupal Dev Days Lisbon 2018 ● In orga team of Drupal Europe ● Scuba instructor [email protected] @jcnventura

Slide 4

Slide 4 text

Devops team (in 2022) ● Stefan Weber 󰎈/󰎧 (🏠: 󰎲) ● João Ventura 󰐨 (🏠: 󰎲) ● Denis Dmitriiev 󰑒 (🏠: 󰑒 -> 󰎲) ● Francisco 'Curro' Sánchez 󰎼 (🏠: 󰎼) Only 3 when this talk was first submitted. ● 1 Drupal 6 multi-site 🙈 ● Several Drupal 7 legacy projects 😎 ● A few Drupal 8 projects waiting to be migrated 💰 ● Multiple Drupal 9 projects 😊

Slide 5

Slide 5 text

Objectives ● Keep our developers/project managers happy ○ Hopefully, keep clients happy as well ● Best tools to enable colleagues to focus on productive work ● Leverage project commonality ● DevOps should be invisible

Slide 6

Slide 6 text

Why GitLab? Before: ● Code version: Bitbucket ● Issues: Jira ● CI: Jenkins After: ● Self-hosted community edition of GitLab Commits link to issues, which link to MRs. Webhooks allow us to use /spend to trigger time-tracking.

Slide 7

Slide 7 text

Onboarding developers ● Local setup ○ Representative environment? ● docker-compose.yml in each project ○ Project switching Long setup times (~1d) Runs on my machine…

Slide 8

Slide 8 text

Local development environment tools ● Lando ● DDEV (our choice) ● Docksal ● Launchpad, Lagoon, … If your company uses DDEV, please sponsor: https://github.com/sponsors/rfay

Slide 9

Slide 9 text

DDEV use Project onboarding is fast (1-2 hours) ● git pull ● ddev start ● ddev drush sql-sync @test @self ● drush sfp-en test (custom command) Need to keep everyone at similar tool level.

Slide 10

Slide 10 text

Deploying ● Hosting environments we support ○ 1xHosting ○ Acquia ○ Pantheon ○ AWS ○ … ● Drupal ○ 7 ○ 8 ○ 9 ○ … ● Environments ○ Test ○ Stage ○ Production

Slide 11

Slide 11 text

Keep it simple

Slide 12

Slide 12 text

Example: creating a project $ composer create-project dxp/core-composer-project ddd2022example --remove-vcs --ignore-platform-reqs --repository-url= $ cd ddd2022example $ ddev config --project-name="ddd2022example" --php-version="8.1" --mariadb-version="10.4” $ ddev get drud/ddev-elasticsearch $ mv web/sites/default/settings.local.php.example web/sites/default/settings.local.php $ pushd themes/custom/granite && ./build.sh dev && popd $ drush site-install xi_profile -y --site-name=DDD2022 [email protected]

Slide 13

Slide 13 text

Contents of the project skeleton ├ .gitignore <- ignore all files added by composer ├ .gitlab-ci.yml.example <- example of .gitlab-ci file ├── composer.json <- based on drupal/recommended-project ├── drush │ ├── Commands │ │ ├── PolicyCommands.php <- prevents sql-sync to overwrite @live │ │ └── StageFileProxyCommands.php <- drush sfp-en @test │ ├── drush.yml <- sets cache tables to structure-only, etc. │ └── sites │ └── self.site.yml.example <- example of @live @stage @test ├── phpcs.xml.dist <- PHP code standards ├── README.md <- Instructions on skeleton use └── web └── sites └── default ├── services.yml <- sets cookie_lifetime to 0 because of persistent_login ├── services.yml.example <- example with debug on └── settings.local.php.example <- example of local settings (config_split, env indicator, etc.)

Slide 14

Slide 14 text

Example project .gitlab-ci.yml (1xHosting) stages: - install - deploy include: - project: '1xinternet/gitlab-ci-common' file: 'gitlab-ci-d8.yml' composer_install: stage: install script: - composer install deploy_to_live: stage: deploy extends: .drupal8_deploy variables: env: live create_backup: "true" environment: url: https://www.example.com only: - main https://gitlab.com/1xinternet/gitlab-ci-common

Slide 15

Slide 15 text

Show and tell

Slide 16

Slide 16 text

GitLab CI 💖 Composer ● GitLab provides integrated composer packagist ○ { "type": "composer", "url": "https://gitlab.example.com/api/v4/group/42/-/packages/composer/"}, ● Automatic creation of packages via CI: script: - version=$([[ -z "$CI_COMMIT_TAG" ]] && echo "branch=$CI_COMMIT_REF_NAME" || echo "tag=$CI_COMMIT_TAG") - 'curl --header "Job-Token: ${CI_JOB_TOKEN}" --data $version https://gitlab.example.com/api/v4/projects/${CI_PROJECT_ID}/packages/composer' ● Private repos will require read-only token in composer.json

Slide 17

Slide 17 text

GitLab + Tugboat = 😍 ● Tugboat is a product by Lullabot that integrates with GitHub, Gitlab or BitBucket ● Base preview for each site using Stage File Proxy module and sanitized daily backup ● Automatic preview for each Merge Request ○ 1x Project Managers: ● Integrated Visual Regression Testing ● Custom Automatic Updates setup ○ drush pm:security ○ composer update ○ drush updb ○ drush cex -y

Slide 18

Slide 18 text

Other tools ● Acquia: BLT ● Pantheon: Terminus ● Code Quality: SonarQube ● Monitoring: Zabbix ● Automation: Ansible AWX ● Visualization: Grafana ● SSH key management: Bastillion ● Knowledge management: Drupal 😎

Slide 19

Slide 19 text

Thank you To our wonderful sponsors, our awesome community and fantastic volunteers! Platinum sponsors

Slide 20

Slide 20 text

Thank you Gold sponsors Silver sponsors

Slide 21

Slide 21 text

Questions? João Ventura [email protected] drupal.org/u/jcnventura @jcnventura BTW, we’re hiring 😊

Slide 22

Slide 22 text

Stay in touch #ddd2022 on Drupal slack @drupaldevdays /drupaldevdays