apigee / apigee-devportal-kickstart-drupal

A fast demo and starting point for Apigee Developer Portals for Drupal
https://www.drupal.org/project/apigee_devportal_kickstart
GNU General Public License v2.0
26 stars 34 forks source link

DevPortal kickstart drupal support to Azure kubernetes cluster (AKS) #585

Closed rajakumar2017 closed 1 year ago

rajakumar2017 commented 1 year ago

Is your feature request related to a problem? Please describe

I was successfully deployed the devportal using docker compose in our AKS Cluster as a POC. We have explored devportal kickstart project and like it very much with features it brings to us. So we decided to move the devportal setup in our Dev environment to share with our small set of developers. Since docker compose is not approved architecture in our Dev infrastructure, We created a custom docker image and deployed into our AKS cluster with dedicated Maria DB in azure. While initializing the devportal, It redirect to https://hostnamecore/install.php url and throws 500 error message.

Describe the solution you'd like

I would like to know whether DevPortal kickstart drupal application has any limitations to install on AKS cluster with custom VNet.

Describe alternatives you've considered

We were able to install and configure DevPortal kickstart drupal support in POC infrastructure

Additional context

Add any other context or screenshots about the feature request here.

giteshk commented 1 year ago

Could you add screenshots of the error or php error logs?

rajakumar2017 commented 1 year ago

Hello Giteshk Thanks for your immediate response. Unfortunately, i have not seen any error message in the log files. Below is the snippet of the log files.

phdhiren commented 1 year ago

@rajakumar2017

Can you check what error it throws in the error log, when you're accessing the installation process?

Ideally when you install the URL it will be like this <HOST>/core/install.php

rajakumar2017 commented 1 year ago

Hello Thanks for your response. I have connected the container and checked the stderr and supervisord.log log files. I see only the below information which might be useful for further analysis. I have not seen any entry in stdout log file.

Contents from stderr file located at "/app/code/web " folder. [12-Oct-2022 19:36:29] NOTICE: fpm is running, pid 205 [12-Oct-2022 19:36:29] NOTICE: ready to handle connections 127.0.0.1 - 12/Oct/2022:19:38:01 +0000 "GET /index.php" 302 NOTICE: PHP message: PHP Fatal error: Cannot redeclare format_size() (previously declared in /app/code/web/core/includes/common.inc:137) in /app/code/vendor/drupal/core/includes/common.inc on line 137 127.0.0.1 - 12/Oct/2022:19:38:01 +0000 "GET /core/install.php" 500 127.0.0.1 - 12/Oct/2022:19:50:35 +0000 "GET /index.php" 302 NOTICE: PHP message: PHP Fatal error: Cannot redeclare format_size() (previously declared in /app/code/web/core/includes/common.inc:137) in /app/code/vendor/drupal/core/includes/common.inc on line 137 127.0.0.1 - 12/Oct/2022:19:50:35 +0000 "GET /core/install.php" 500

Contents from supervisord.log file located at "/app/code/web " folder. 2022-10-12 19:36:27,996 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. 2022-10-12 19:36:27,999 INFO supervisord started with pid 204 2022-10-12 19:36:29,001 INFO spawned: 'php-fpm' with pid 205 2022-10-12 19:36:29,016 INFO spawned: 'nginx' with pid 206 2022-10-12 19:36:30,078 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2022-10-12 19:36:30,078 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Thanks Rajakumar

giteshk commented 1 year ago

@rajakumar2017 Please look at this commit and make a similar change to your dockerfile https://github.com/apigee/docker-apigee-drupal-kickstart/commit/0b80869bda17a7e5bfc11f66beeab58cad6fa742

If that doesn't work please paste your docker file here.

rajakumar2017 commented 1 year ago

@giteshk Unfortunately build itself fails when we edit the dockerfile as per the above commit. The snippet of the build error is given below. I also attached the complete log files and dockerfile for your reference.

The command '/bin/sh -c php -d memory_limit=-1 /usr/bin/composer install -o --working-dir=/app/code --no-interaction && ln -sf /app/code/vendor/bin/drush /usr/bin/drush' returned a non-zero code: 1

[debug]Exit code 1 received from tool '/usr/bin/docker'

[debug]STDIO streams have closed for tool '/usr/bin/docker'

[error]The command '/bin/sh -c php -d memory_limit=-1 /usr/bin/composer install -o --working-dir=/app/code --no-interaction && ln -sf /app/code/vendor/bin/drush /usr/bin/drush' returned a non-zero code: 1

[debug]Processed: ##vso[task.issue type=error;]The command '/bin/sh -c php -d memory_limit=-1 /usr/bin/composer install -o --working-dir=/app/code --no-interaction && ln -sf /app/code/vendor/bin/drush /usr/bin/drush' returned a non-zero code: 1

[debug]task result: Failed

[error]The process '/usr/bin/docker' failed with exit code 1

Build_Issue_10132022.txt Dockerfile.txt

Thanks Rajakumar

giteshk commented 1 year ago

@rajakumar2017 I was able to build using your dockerfile.

Here is the difference I see with the file I provided:

/tmp/docker-apigee-drupal-kickstart$ git diff
diff --git a/Dockerfile b/Dockerfile
index a7b87a6..dc5fcfa 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -48,7 +48,7 @@ RUN curl https://raw.githubusercontent.com/apigee/devportal-kickstart-project-co
     && curl https://raw.githubusercontent.com/apigee/devportal-kickstart-project-composer/9.x/LICENSE.txt -o /app/code/LICENSE.txt

 #OVERRIDE custom code folder if any
-COPY code /app/code
+#COPY code /app/code
 COPY config /app/default-config

 RUN php -d memory_limit=-1 /usr/bin/composer install -o --working-dir=/app/code --no-interaction \
rajakumar2017 commented 1 year ago

@giteshk Thanks for reviewing the docker file and pointing out it. I made a change in my repository and ran a build again without any success. Though I am using Azure DevOps to Build and Release, It should not make any issues while running the Docker Build. I have attached the Dockerfile and error message for your review. I will be happy if you take a look and update me on your findings. I also confirm that whenever I comment on the docker file on line "#COPY code /app/code" Build and deployment are successful. However, the application is not working during the initialization.

Regards Rajakumar BuildIssue_1.txt

dockerfile.txt

giteshk commented 1 year ago

It seems like an issue in your build process, I am not familiar with the Azure DevOps tool.

Have you tried using this image directly in your kubernetes file: ghcr.io/apigee/docker-apigee-drupal-kickstart:latest

rajakumar2017 commented 1 year ago

@giteshk Finally, I was able to resolve the Docker Build issue on Azure DevOps itself. As such build is working fine and is able to deploy in our cluster also. But I am still seeing an issue while the application is initializing with the below error message.

[14-Oct-2022 14:01:19] NOTICE: fpm is running, pid 205 [14-Oct-2022 14:01:19] NOTICE: ready to handle connections 127.0.0.1 - 14/Oct/2022:15:14:55 +0000 "GET /index.php" 302 NOTICE: PHP message: PHP Fatal error: Cannot redeclare format_size() (previously declared in /app/code/web/core/includes/common.inc:137) in /app/code/vendor/drupal/core/includes/common.inc on line 137 127.0.0.1 - 14/Oct/2022:15:14:55 +0000 "GET /core/install.php" 500

When i connected to docker container, I noticed 2 common.inc files which seems to be conflicting which are located in below folders. /app/code/web/core/includes/common.inc /app/code/vendor/drupal/core/includes/common.inc

As per the dockerfile, We are getting the contents(files and folder) for "/app/code/web/core" from "githubusercontent" URL using CURL. But i am not able to identify how are we populating the files and folders on "/app/code/vendor/drupal/core" and what is the reason to get the duplicate common.inc file. I will be really appreciated if you throw some light on this issue.

Thanks

phdhiren commented 1 year ago

@rajakumar2017

It seems there is a recent issue from composer version 2.4.2, can you downgrade to 2.4.1 using composer self-update 2.4.1

https://github.com/composer/composer/issues/11093

rajakumar2017 commented 1 year ago

@phdhiren Thanks for your recommendation. I have modified the Dockerfile to use composer version 2.4.1 and am able to build and deploy in our AKS infrastructure. As such I am validating all the modules of the application and able to update you in a few days.

phdhiren commented 1 year ago

@rajakumar2017

I hope the issue has been resolved, closed this issue. Feel free to reopen if required.