Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add a Tugboat scaffold #96 #123

Closed
wants to merge 58 commits into from
Closed

feat: Add a Tugboat scaffold #96 #123

wants to merge 58 commits into from

Conversation

deviantintegral
Copy link
Member

@deviantintegral deviantintegral commented Sep 18, 2022

This PR adds support for Tugboat resolving #96.

To turn it on, add tugboat to Drainpipe's extra section in composer.json following the README such as:

        "drainpipe": {
            "tugboat": {
              "provider": {
                "host": "acquia",
                "downsync": true
              }
            }
        },

This PR adds twig as a dependency to assist in rendering configuration files. I first tried to make it so each section was composed "simply" by concatenating files, but that didn't work well. Twig is already part of Drupal so it's not being added completely new. I still refactored the commands out just to save having to edit tugboat command steps directly in YAML.

We talked about pulling in the PHP version from hosting provider files, but that won't cover Acquia hosts. Instead, we use composer to determine the PHP version.

If you set the host to acquia, you get mysql and memcached. If you set pantheon you get mariadb and redis.

Testing:

I turned on memcache admin and see it working for Acquia. I need to double check that for Pantheon too:

image

  • As well, I added some basic tests to the workflow that make sure the right config files are generated. They picked up some good bugs like f333b68. I wonder if later we want to convert these to use bats or similar.

To do:

  • Automatically add credentials to settings.php.
  • Add a tugboat.acquia-example.yml file that includes memcache.
  • Add a tugboat.pantheon-example.yml file that includes redis.
  • Support setting acquia or tugboat in the tugboat composer array to select one.
  • Configure GD with something like:
        apt-get update && apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev
        docker-php-ext-configure gd --with-jpeg --with-freetype && docker-php-ext-install gd
  • Document in the README what environment variables to set so task can download and import a database.
  • Update the configs so if those variables aren't set we run a site:install instead.
  • Fix the workflow
  • Switch to nginx for the Pantheon option
  • Ensure we don't have any issues with stale redis caches

@deviantintegral deviantintegral changed the title feat: Add an initial Tugboat scaffold feat: Add a Tugboat scaffold #96 Sep 18, 2022
@deviantintegral
Copy link
Member Author

It turns out Tugboat validates configurations by sending them to a tugboat API. We'll need to generate and provide an access token for the new job to pass.

@deviantintegral deviantintegral marked this pull request as ready for review September 26, 2022 19:53
@deviantintegral deviantintegral marked this pull request as draft September 26, 2022 20:33
@deviantintegral
Copy link
Member Author

TIL'ed you have to opt in via your job config for repository secrets to be visible. It's not mentioned on the settings UI at all. Eventually I found it at https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow.

@edutrul
Copy link

edutrul commented Oct 24, 2022

The Readme has already been updated, with the new Tugboat variables and it is in a pull request.

And also in the composer, you can support "acquia" and "tugboat"

@edutrul
Copy link

edutrul commented Oct 24, 2022

@deviantintegral
Configure GD with something like:
apt-get update && apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev
docker-php-ext-configure gd --with-jpeg --with-freetype && docker-php-ext-install gd

I don't understand what this code would be for, if you can please explain it to me in more detail. Thank you

@edutrul
Copy link

edutrul commented Oct 24, 2022

Update the configs so if those variables aren't set we run a site:install instead.
When you say site:install, you mean that only the config file will appear in tugboat and the settings

edutrul and others added 4 commits October 27, 2022 12:32
By default in the current Tugboat image, `/var/www/html` is a symlink to `/var/www/html.original`, so the `[ -d ]` (is file) shell test prevents the new symlink from being created. Let's just always go ahead and create the symlink, removing the shell test to abort when an existing symlink is found.
@deviantintegral deviantintegral mentioned this pull request Nov 9, 2022
6 tasks
@deviantintegral
Copy link
Member Author

😮 tests are passing! Well, except the env one which I think is unrelated and being fixed elsewhere.

strategy:
matrix:
php-version: [7.3, 7.4, 8.0]
php-version: ["7.3", "7.4", "8.0"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this actions was treating these as numbers and dropping the .0 from 8.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♀️

cd /usr/local/bin
curl -O https://dashboard.tugboatqa.com/cli/linux/tugboat.tar.gz
tar xzvf tugboat.tar.gz
- name: Validate Tugboat file generation
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These could be turned into matrix parameters in the future, but it's fast now and saves burning CI time on the setup steps.

"tugboat": {
"provider": {
"host": "acquia",
"downsync": true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out we don't actually have a task command to downsync from Acquia. @marcoscano or @hawkeyetwolf think that's something you'd like to contribute based on your other project work?

@@ -11,11 +11,13 @@
},
"require": {
"php": "^7.3||^8.0",
"ext-json": "*",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this up as it's common to group php and extensions together.

@deviantintegral deviantintegral marked this pull request as ready for review November 23, 2022 01:24
@deviantintegral
Copy link
Member Author

I'm currently working on building a tugboat nginx + php image. I have it building, but nginx is not fully configured yet. Once I have something I can point the tugboat image too I will update this PR.

@justafish justafish closed this Jul 24, 2023
@justafish justafish deleted the 96-tugboat branch July 24, 2023 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants