From b2b6bf8161b23af45369c9a6a64057208e30c2a3 Mon Sep 17 00:00:00 2001 From: Jacob Sanford Date: Wed, 10 Jul 2024 08:56:00 -0300 Subject: [PATCH] DOCKW-70 Convert to dockworker 6.x --- .dockerignore | 6 ++ .../deployment/k8s/dev/deployment.yaml | 66 ----------------- .../deployment/k8s/prod/deployment.yaml | 66 ----------------- .dockworker/dockworker.yml | 70 +++++++++++++------ .../Plugin/Commands/MysqlDeployCommands.php | 31 ++++++++ .github/workflows/deployment-workflow.yaml | 19 ++--- composer.json | 12 +++- docker-compose.yml | 6 +- 8 files changed, 108 insertions(+), 168 deletions(-) create mode 100644 .dockerignore delete mode 100644 .dockworker/deployment/k8s/dev/deployment.yaml delete mode 100644 .dockworker/deployment/k8s/prod/deployment.yaml create mode 100644 .dockworker/src/Robo/Plugin/Commands/MysqlDeployCommands.php diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7d4b95d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +# Ignore everything +* + +# Allow files and folders with a pattern starting with ! +!Dockerfile +!build diff --git a/.dockworker/deployment/k8s/dev/deployment.yaml b/.dockworker/deployment/k8s/dev/deployment.yaml deleted file mode 100644 index c70de93..0000000 --- a/.dockworker/deployment/k8s/dev/deployment.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: mysql - appMajor: "5" - instance: drupal.mysql.lib.unb.ca - tier: database - uri: dev-drupal.mysql.lib.unb.ca - vcsOwner: unb-libraries - vcsRepository: mysql.lib.unb.ca - vcsRef: dev - name: drupal-mysql-lib-unb-ca - namespace: dev -spec: - selector: - matchLabels: - uri: dev-drupal.mysql.lib.unb.ca - replicas: 1 - revisionHistoryLimit: 0 - strategy: - type: Recreate - template: - metadata: - labels: - app: mysql - appMajor: "5" - instance: drupal.mysql.lib.unb.ca - tier: database - uri: dev-drupal.mysql.lib.unb.ca - vcsOwner: unb-libraries - vcsRepository: mysql.lib.unb.ca - vcsRef: dev - spec: - nodeSelector: - deploy_dev: 'true' - containers: - - - env: - - - name: MYSQL_ROOT_PASSWORD - valueFrom: - secretKeyRef: - name: mysql - key: root-password - image: "||DEPLOYMENTIMAGE||" - imagePullPolicy: Always - name: drupal-mysql-lib-unb-ca - ports: - - - containerPort: 3306 - name: mysql - volumeMounts: - - - mountPath: /var/lib/mysql - name: mysql-persistent-storage - priorityClassName: dev-high-priority-services - imagePullSecrets: - - - name: github-container-registry-auth - restartPolicy: Always - volumes: - - - name: mysql-persistent-storage - persistentVolumeClaim: - claimName: drupal-mysql-lib-unb-ca diff --git a/.dockworker/deployment/k8s/prod/deployment.yaml b/.dockworker/deployment/k8s/prod/deployment.yaml deleted file mode 100644 index 10a7f26..0000000 --- a/.dockworker/deployment/k8s/prod/deployment.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: mysql - appMajor: "5" - instance: drupal.mysql.lib.unb.ca - tier: database - uri: drupal.mysql.lib.unb.ca - vcsOwner: unb-libraries - vcsRepository: mysql.lib.unb.ca - vcsRef: prod - name: drupal-mysql-lib-unb-ca - namespace: prod -spec: - selector: - matchLabels: - uri: drupal.mysql.lib.unb.ca - replicas: 1 - revisionHistoryLimit: 0 - strategy: - type: Recreate - template: - metadata: - labels: - app: mysql - appMajor: "5" - instance: drupal.mysql.lib.unb.ca - tier: database - uri: drupal.mysql.lib.unb.ca - vcsOwner: unb-libraries - vcsRepository: mysql.lib.unb.ca - vcsRef: prod - spec: - nodeSelector: - deploy_prod: 'true' - containers: - - - env: - - - name: MYSQL_ROOT_PASSWORD - valueFrom: - secretKeyRef: - name: mysql - key: root-password - image: "||DEPLOYMENTIMAGE||" - imagePullPolicy: Always - name: drupal-mysql-lib-unb-ca - ports: - - - containerPort: 3306 - name: mysql - volumeMounts: - - - mountPath: /var/lib/mysql - name: mysql-persistent-storage - priorityClassName: vip-essential - imagePullSecrets: - - - name: github-container-registry-auth - restartPolicy: Always - volumes: - - - name: mysql-persistent-storage - persistentVolumeClaim: - claimName: drupal-mysql-lib-unb-ca diff --git a/.dockworker/dockworker.yml b/.dockworker/dockworker.yml index cb01eb7..3636a84 100644 --- a/.dockworker/dockworker.yml +++ b/.dockworker/dockworker.yml @@ -1,26 +1,52 @@ dockworker: - version: '5' + version: '6' application: - name: drupal.mysql.lib.unb.ca - finish_marker: 'mysqld: ready for connections' - project_prefix: IN - upstream_images: - - mysql:5.7 - uuid: 3503 - deployment: - environments: + name: Mysql Instance for Drupal Applications at UNB Libraries + uri: https://drupal.mysql.lib.unb.ca + description: > + A Mysql instance for use with Drupal applications at UNB Libraries. + topics: + - mysql + - drupal + identifiers: + id: drupal.mysql.lib.unb.ca + slug: drupal-mysql-lib-unb-ca + short_slug: drupmysql + uuid: 3503 + framework: + name: Mysql + version: 7 + startup_finished_marker: 'mysqld: ready for connections' + endpoint: + name: http + port: 3306 + readiness_timeout: 15 + license: + license: MIT + holder: University of New Brunswick Libraries + shell: + path: /bin/sh + endpoints: + env: - dev - prod - workflow: - source: dockworker - type: deployment-workflow - github: - repo: drupal.mysql.lib.unb.ca - owner: unb-libraries - image: - push_branches: - - dev - - prod - name: ghcr.io/unb-libraries/drupal.mysql.lib.unb.ca - date_tag_image: true - repository: ghcr + deployments: + drupal-mysql-lib-unb-ca: + default: true + managed: true + name: drupal-mysql-lib-unb-ca + workflows: + vcs: + type: github + owner: unb-libraries + name: drupal.mysql.lib.unb.ca + jira: + project_keys: + - IN + image: + name: ghcr.io/unb-libraries/drupal.mysql.lib.unb.ca + parent: mysql:5.7 + repository: GitHub + push-branches: + - dev + - prod diff --git a/.dockworker/src/Robo/Plugin/Commands/MysqlDeployCommands.php b/.dockworker/src/Robo/Plugin/Commands/MysqlDeployCommands.php new file mode 100644 index 0000000..e6429f5 --- /dev/null +++ b/.dockworker/src/Robo/Plugin/Commands/MysqlDeployCommands.php @@ -0,0 +1,31 @@ + 'as time zone. Skipping it.', + ] + ), + ]; + } +} \ No newline at end of file diff --git a/.github/workflows/deployment-workflow.yaml b/.github/workflows/deployment-workflow.yaml index 6a959e4..3de75f2 100644 --- a/.github/workflows/deployment-workflow.yaml +++ b/.github/workflows/deployment-workflow.yaml @@ -1,4 +1,4 @@ -name: drupal.mysql.lib.unb.ca +name: Deploy drupal.mysql.lib.unb.ca on: pull_request: @@ -7,15 +7,16 @@ on: jobs: deploy: - uses: unb-libraries/dockworker/.github/workflows/deployment-workflow.yaml@5.x + uses: unb-libraries/dockworker/.github/workflows/build-push-deploy-notify.yaml@6.x with: + branch-env-map: '{"dev":"dev","prod":"prod"}' + build-themes: false deploy-branches: '["dev","prod"]' + image-name: 'ghcr.io/unb-libraries/drupal.mysql.lib.unb.ca' + k8s-deployment-name: 'drupal-mysql-lib-unb-ca' + push-branches: '["dev","prod"]' secrets: - DOCKER_CLOUD_ACCESS_TOKEN: ${{ secrets.DOCKER_CLOUD_ACCESS_TOKEN }} - DOCKER_CLOUD_USER_NAME: ${{ secrets.DOCKER_CLOUD_USER_NAME }} - GH_CONTAINER_REGISTRY_TOKEN: ${{ secrets.GH_CONTAINER_REGISTRY_TOKEN }} - GH_CONTAINER_REGISTRY_USER: ${{ secrets.GH_CONTAINER_REGISTRY_USER }} - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - NEW_RELIC_ACCOUNT_ID: ${{ secrets.NEW_RELIC_ACCOUNT_ID }} - NEW_RELIC_API_KEY: ${{ secrets.NEW_RELIC_API_KEY }} + KUBE_CONFIG: ${{ secrets.KUBE_CONFIG_DATA }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + GH_CONTAINER_REGISTRY_USER: ${{ secrets.GH_CONTAINER_REGISTRY_USER }} + GH_CONTAINER_REGISTRY_TOKEN: ${{ secrets.GH_CONTAINER_REGISTRY_TOKEN }} diff --git a/composer.json b/composer.json index 3e48044..f39de9d 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,8 @@ { "config": { "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "php-http/discovery": true }, "preferred-install": { "*": "dist" @@ -13,11 +14,16 @@ "name": "unb-libraries/drupal.mysql.lib.unb.ca", "prefer-stable": true, "require-dev": { - "unb-libraries/dockworker-mysql": "^5" + "unb-libraries/dockworker-daemon": "^6" + }, + "autoload": { + "psr-4": { + "Dockworker\\": ".dockworker/src" + } }, "scripts": { "post-update-cmd": [ - "vendor/bin/dockworker dockworker:git:setup-hooks" + "vendor/bin/dockworker git:setup-hooks" ] } } diff --git a/docker-compose.yml b/docker-compose.yml index bc77b21..6886744 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,16 @@ services: - drupal.mysql.lib.unb.ca: + drupal-mysql-lib-unb-ca: build: context: . command: mysqld --skip-name-resolve --max_allowed_packet=64M env_file: - ./env/mysql.env restart: unless-stopped - container_name: drupal.mysql.lib.unb.ca + container_name: drupal-mysql-lib-unb-ca expose: - "3306" + ports: + - "3503:3306" volumes: - mysql-data:/var/lib/mysql volumes: