adamlash / magento-aks

Repository demonstrating a Magento deployment to an Azure Kubernetes Service cluster.
MIT License
4 stars 1 forks source link

Build + Deploy Vanilla Magento Image #10

Closed adamlash closed 4 years ago

adamlash commented 4 years ago

Build vanilla Magento image for Kubernetes and Deploy

Done: Running vanilla Magento installation on kubernetes (basic, no modules/config)

adamlash commented 4 years ago

Found a general flow for this, need to codify, cleanup and upload but the salient ideas are as follows (per the general wisdom of online...).

Pods

These are the 3 main Pods used in the core program. PHP running fpm and nginx proxying through to this. The cron pod is in charge of running php bin/magento cron:run . The Cron pod is running the same base image as PHP. Nginx is just plain Nginx with some config files to serve relevant content.

PVCs and Copying Files

Two Mounts:

These are mounted into the PHP Pods, Cron Pods and the Nginx Pods. Nginx is serving them directly to offload any work from PHP.

We can use Jobs to copy files into the PVCs, as well as run the various binaries to 'deploy' Magento. More of the prep will be done in CI such as Compiling and pushing this into the image, however we can trigger php bin/magento setup:upgrade from a Pod as a Job to deploy magento. This pod will also be mounting the relevant files.

ConfigMaps and Secrets

Magento tends to mess with the env.php in various stages, general wisdom is not to make this immuteable so this cannot be a configmap file mounted into the Pods. A few people have used envvars and then referenced these in php via 'dbname' => getenv('DB_NAME'). This may be a start however KeyVault may be a direction, will create a future task for this...

adamlash commented 4 years ago

Vanilla has been deployed with 'prebuilt' magento images (https://hub.docker.com/r/kiweeteam/magento2). Right now building from my own raw source and running into errors after build:

[2020-08-18 18:21:01] main.ERROR: Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
Magento_AuthorizenetAcceptjs data: current version - none, required version - 1.0.0
MSP_ReCaptcha data: current version - none, required version - 1.6.0
Amazon_Core data: current version - none, required version - 3.4.1
Amazon_Login data: current version - none, required version - 3.4.1
Amazon_Payment data: current version - none, required version - 3.4.1
Dotdigitalgroup_Email data: current version - none, required version - 4.4.0
Klarna_Core data: current version - none, required version - 5.2.3
Klarna_Ordermanagement data: current version - none, required version - 5.0.7
Klarna_Kp data: current version - none, required version - 6.4.0
MSP_TwoFactorAuth data: current version - none, required version - 3.1.0 [] []

Running upgrade does not fix this, need to look into further..

adamlash commented 4 years ago

This has since been completed in a 'dirty' fashion with manual files. next step is to productionize into a Helm Chart. please see #13 for the continuation of this