TripalCultivate / TripalCultivate-Phenotypes

Provides generic support for large scale phenotypic data and traits with importers, content pages and visualizations.
GNU General Public License v3.0
1 stars 0 forks source link

Build our own dockerfile with testchado schema name. #29

Closed laceysanderson closed 1 year ago

laceysanderson commented 1 year ago

Issue #26

Motivation

Currently our dockerfile and testing use the default tripaldocker images. Unfortunately these images use chado as the name of the schema that Chado is installed in. This does not help us to confirm we are not making any assumptions of what the schema name is... this is an important assumption to test for since Tripal 4 allows the admin to name the schema anything and also supports multiple Chado instances. Testing on a site with no schema named chado makes it more likely we are compatible with multiple Chado instances.

What does this PR do?

  1. Updates our dockerfile to add a build argument to choose the Drupal version. For example, docker build --tag=testing --build-arg drupalversion="9.5.x-dev" ./. The default is to use Drupal 10.0.x-dev. There must already be a tripal docker image for the version of Drupal you ask for.
  2. Updates our dockerfile to first drop the chado schema and then install Chado v1.3 in a testchado schema. This approach is not ideal but much faster and with less duplication of code than copying the entire Tripal docker.
  3. Updates all the workflows to use our own dockerfile for testing rather than the tripal core docker image.

Testing

Automated Testing

The docker build will now be testing in every single workflow before the automated tests run. As such, this will actually be tested for every version of Drupal we test on.

Manual Testing

Test that you can build a docker image using the following command on this branch:

docker build --tag=testing --build-arg drupalversion="9.5.x-dev" ./
docker run --publish=80:80 --name=trpcult-g5.26 -tid --volume=$(pwd):/var/www/drupal9/web/modules/contrib/TripalCultivate-Phenotypes testing
docker exec trpcult-g5.26 service postgresql restart
docker exec trpcult-g5.26 drush sql:query "SELECT nspname FROM pg_catalog.pg_namespace"
docker exec -it trpcult-g5.26 drush status

You should expect

  1. no errors in the build process
  2. Query outputs pg_toast, pg_catalog, public, information_schema, testchado, genetic_code, so, frange.
  3. Drush command outputs a lot of information including Drupal version : 9.5.10-dev

Look at the automated testing logs to confirm that it is building our docker and not just pulling the tripaldocker.

Sending build context to Docker daemon  440.8kB

Step 1/6 : ARG drupalversion='10.0.x-dev'
Step 2/6 : ARG chadoschema='testchado'
Step 3/6 : FROM tripalproject/tripaldocker:drupal${drupalversion}-php8.1-pgsql13
Step 4/6 : COPY . /var/www/drupal9/web/modules/contrib/TripalCultivate-Phenotypes
Step 5/6 : WORKDIR /var/www/drupal9/web/modules/contrib/TripalCultivate-Phenotypes
Step 6/6 : RUN service postgresql restart   && drush trp-drop-chado --schema-name='chado'   && drush trp-install-chado --schema-name='testchado'   && drush en trpcultivate_phenotypes trpcultivate_phenocollect trpcultivate_phenoshare --yes
reynoldtan commented 1 year ago

Manual test a docker image build and confirmed the command created an image and after creating a container off the image to inspect schema that there is no schema named chado.

No testchado found, only the following showed up in the build.

pg_catalog
public
information_schema
genetic_code
so
frange

And this error when accessing localhost. Screen Shot 2023-07-04 at 8 51 54 AM

laceysanderson commented 1 year ago

Ooops, so a couple of things went wrong above 🤦‍♀️

  1. The error you reported is actually a Tripal core error caused because my original instructions said to test 10.1.x-dev which Tripal core does not fully support yet...
  2. I incorrectly specified the version for Chado which caused it not to be installed.
  3. I forgot to update the version of the test action which meant it wasn't building our image and thus didn't detect the first two errors 🙈

These are all fixed now and the instructions for testing above have been updated and more more helpful.

Thanks for the review @reynoldtan! Could you check it again now please?

reynoldtan commented 1 year ago

Confirmed sightings 👁️ of testchado schema and drupal 9.5.10-dev version. All good!