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

ci: 👷 changed to building imagick from source #2428

Merged

Conversation

marvinroman
Copy link
Contributor

Updated Dockerfile that builds the main application image to build the imagick library from source instead of using pecl since their version is not yet fully ready for php v8.4.

@marvinroman marvinroman linked an issue Dec 10, 2024 that may be closed by this pull request
1 task
@@ -1,6 +1,7 @@
FROM php:8.4-fpm

ENV PHP_VERSION 8.4
ENV IMAGICK_VERSION 3.7.0 # This should be bumped to the latest version and
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like part of the comment is missing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link
Collaborator

@jobara jobara left a comment

Choose a reason for hiding this comment

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

What's the best way to test these changes before merging?


RUN pecl install imagick
# START BUILDING IMAGICK FROM SOURCE - this can be removed once pecl fixes issues installing with php8.4
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please leave a link to #2425 in the comments. It'll just make it easier to understand when scanning the code later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

Comment on lines 72 to 75
# - this can be removed once pecl fixes issues installing with php8.4
RUN apt-get remove -y \
$PHPIZE_DEPS \
libtool
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to do the remove in the same block as the install? I think it's more likely this will get missed when reverting later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It needs to be there or the following pecl build commands fail. I thought those commands ensures build dependencies were installed if necessary when pecl runs, but it failed when I removed them prior to running those.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Migrated to TODO comments which should be recognized by IDE's that implement finding the tags for pending items that are pending changes.

@@ -1,6 +1,8 @@
FROM php:8.4-fpm

ENV PHP_VERSION 8.4
# TODO - IMAGICK_VERSION can be removed once pecl fixes issues installing with php8.4
ENV IMAGICK_VERSION 3.7.0 # This should be bumped to the latest version, especially when PHP version is bumped and can be removed when https://github.com/accessibility-exchange/platform/issues/2425 is resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess this link is a bit odd because this PR will close that issue. Maybe reword a bit here so that it indicates that 2425 is what this work around is for an can be removed when the upstream issue in imagick is resolved (and link to an imagick issue).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed all the TODO comments to reference issue Imagick/imagick#698.


RUN mkdir -p /tmp/imagick
WORKDIR /tmp/imagick
RUN curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/tags/${IMAGICK_VERSION}.tar.gz
Copy link
Collaborator

Choose a reason for hiding this comment

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

When I tried to build the container I got the error

failed to solve: process "/bin/sh -c curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/tags/${IMAGICK_VERSION}.tar.gz" did not complete successfully: exit code: 6

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When abstracting version to an environment variable it broke the curl command reverted to static url.

@jobara
Copy link
Collaborator

jobara commented Jan 8, 2025

@marvinroman I'm having trouble testing this with the local docker compose. Every time I get to a spot that needs to start mysql it fails. It says it can't properly start it or that it's unhealthy. Have you run into an issue like this?

@jobara
Copy link
Collaborator

jobara commented Jan 14, 2025

@marvinroman I've tried a few more times after updating my docker tools and it is still failing to start mysql. I asked @greatislander to also try this PR but he was unable to run the local docker compose based environment due to issues running it on an Apple Silicon based Mac.

@marvinroman
Copy link
Contributor Author

@marvinroman I've tried a few more times after updating my docker tools and it is still failing to start mysql. I asked @greatislander to also try this PR but he was unable to run the local docker compose based environment due to issues running it on an Apple Silicon based Mac.

It's not just an issue with Apple and I was able to resolve the issue by eliminating the custom MySQL configuration but this configuration is the same as what gets deployed on the Kube. I ran out of time last week to finish the full update and to find out which configuration variable it causing the issues. I will submit changes this week to resolve.

@marvinroman
Copy link
Contributor Author

@jobara The reported errors in deployment have been fixed in branch infrastructure-local-environment-update-nix you will want to merge both these branches locally to be able to fully build and deploy.

To complete the updates I would do the following after downloading the updates.

  • Backing up the .env file and letting it be recreated.
  • Rebuild the laravel container using the following alias dcbp.
  • Remove the mysql volume.

@jobara
Copy link
Collaborator

jobara commented Jan 20, 2025

@marvinroman I got things built using nix, but even when combining the PRs I still got a failure with mysql ( dependency failed to start: container platform.mysql exited (1) ) when running docker local without nix. This happens in the step for creating the app key. Also I had to WWWUSER and WWWGROUP info before I could get this step to get even this far.

@marvinroman
Copy link
Contributor Author

@marvinroman I got things built using nix, but even when combining the PRs I still got a failure with mysql ( dependency failed to start: container platform.mysql exited (1) ) when running docker local without nix. This happens in the step for creating the app key. Also I had to WWWUSER and WWWGROUP info before I could get this step to get even this far.

Can you give me the contents of docker logs platform.mysql ? Did you remove the volume for the mysql container? If you didn't you will want to make sure to copy the database credentials from the backed up .env file before you let nix-shell recreate it. But personally I would just delete the volume so it can be started fresh with new credentials.

You should no longer need WWWGROUP.

Did you delete the .env file and then ran nix-shell and when it was re-created the WWWUSER was empty?

@jobara
Copy link
Collaborator

jobara commented Jan 21, 2025

@marvinroman I got things built using nix, but even when combining the PRs I still got a failure with mysql ( dependency failed to start: container platform.mysql exited (1) ) when running docker local without nix. This happens in the step for creating the app key. Also I had to WWWUSER and WWWGROUP info before I could get this step to get even this far.

Can you give me the contents of docker logs platform.mysql ? Did you remove the volume for the mysql container? If you didn't you will want to make sure to copy the database credentials from the backed up .env file before you let nix-shell recreate it. But personally I would just delete the volume so it can be started fresh with new credentials.

You should no longer need WWWGROUP.

Did you delete the .env file and then ran nix-shell and when it was re-created the WWWUSER was empty?

@marvinroman The issue I'm mentioning here is when running without nix ( I did get something to build using nix and have merged #2429 ) and using just the instructions from "Local development setup using docker compose:". I still get the issues I mentioned above with the ID & Group needing to happen earlier and mysql failing to start.

@jobara
Copy link
Collaborator

jobara commented Jan 21, 2025

@marvinroman here are the logs from docker logs platform.mysql. Looks like it's an issue with the mysql root password.

mysql 19:00:12.12 INFO  ==> 
mysql 19:00:12.12 INFO  ==> Welcome to the Bitnami mysql container
mysql 19:00:12.12 INFO  ==> Subscribe to project updates by watching https://github.com/bitnami/containers
mysql 19:00:12.13 INFO  ==> Did you know there are enterprise versions of the Bitnami catalog? For enhanced secure software supply chain features, unlimited pulls from Docker, LTS support, or application customization, see Bitnami Premium or Tanzu Application Catalog. See https://www.arrow.com/globalecs/na/vendors/bitnami/ for more information.
mysql 19:00:12.13 INFO  ==> 
mysql 19:00:12.13 INFO  ==> ** Starting MySQL setup **
mysql 19:00:12.15 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 19:00:12.16 ERROR ==> The MYSQL_ROOT_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development.
mysql 19:00:12.16 ERROR ==> root user is already created in the database and you can't use it as username for user creation.
mysql 19:11:47.77 INFO  ==> 
mysql 19:11:47.78 INFO  ==> Welcome to the Bitnami mysql container
mysql 19:11:47.78 INFO  ==> Subscribe to project updates by watching https://github.com/bitnami/containers
mysql 19:11:47.78 INFO  ==> Did you know there are enterprise versions of the Bitnami catalog? For enhanced secure software supply chain features, unlimited pulls from Docker, LTS support, or application customization, see Bitnami Premium or Tanzu Application Catalog. See https://www.arrow.com/globalecs/na/vendors/bitnami/ for more information.
mysql 19:11:47.78 INFO  ==> 
mysql 19:11:47.79 INFO  ==> ** Starting MySQL setup **
mysql 19:11:47.81 INFO  ==> Validating settings in MYSQL_*/MARIADB_* env vars
mysql 19:11:47.82 ERROR ==> The MYSQL_ROOT_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development.
mysql 19:11:47.82 ERROR ==> root user is already created in the database and you can't use it as username for user creation.

@jobara
Copy link
Collaborator

jobara commented Jan 22, 2025

@marvinroman just a heads up that the laravel-vite-plugin was recently updated with this change ( laravel/vite-plugin#318 ). I don't know if it will affect any of the local docker or nix setups, but just letting you know in case.

@marvinroman
Copy link
Contributor Author

@marvinroman just a heads up that the laravel-vite-plugin was recently updated with this change ( laravel/vite-plugin#318 ). I don't know if it will affect any of the local docker or nix setups, but just letting you know in case.

It shouldn't.

@marvinroman
Copy link
Contributor Author

@jobara I would rebase or update from dev both those issues should be addressed by the new nix environment.

@jobara
Copy link
Collaborator

jobara commented Jan 22, 2025

@jobara I would rebase or update from dev both those issues should be addressed by the new nix environment.

@marvinroman Yes I've been testing by first creating a test branch off of dev and merging this PR's branch into it. The problem here though is that there is still documentation, and I suppose artifacts in the repo, for running "Local development setup using docker compose". If this method for local development is no longer supported all those parts should be removed.

@marvinroman
Copy link
Contributor Author

@jobara I would rebase or update from dev both those issues should be addressed by the new nix environment.

@marvinroman Yes I've been testing by first creating a test branch off of dev and merging this PR's branch into it. The problem here though is that there is still documentation, and I suppose artifacts in the repo, for running "Local development setup using docker compose". If this method for local development is no longer supported all those parts should be removed.

@jobara That is true. Initially I wanted to keep both to not make Nix a requirement. But I think some of it broke with the new environment and it's better to not try and maintain both options. That section is now removed.

@jobara jobara enabled auto-merge (squash) January 29, 2025 16:40
@jobara jobara merged commit c7a8fb7 into dev Jan 29, 2025
6 checks passed
@jobara jobara deleted the 2425-error-on-docker-build-on-the-pecl-build-of-imagick-library branch January 29, 2025 16:40
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.

Error on docker build on the pecl build of imagick library.
2 participants