This concept is to use Shopware app as a static executable binary on Kubernetes.
It is based on FrankenPHP and static-php-cli projects.
Note that a static binary is built for production environments only as xdebug won't work with a static binary.
Therefore, the development version is based on dunglas/frankenphp
container image instead.
Check out the article Shopware on Kubernetes: build, test and debug for more details.
docker build --target=app-dev --progress=plain -t shopware-bin-dev .
docker build --target=app-prod --progress=plain -t shopware-bin .
Production:
docker run --rm --name=shopware-bin -p 8000:8000 shopware-bin php-server -l 0.0.0.0:8000 -a -v --no-compress
Development:
docker run --rm --name=shopware-bin -p 8000:8000 shopware-bin-dev php-server -l 0.0.0.0:8000 -a -v --no-compress
docker run --rm --name=shopware-bin shopware-bin php-cli bin/console
Shopware cluster requires the following components to be available upfront in the cluster
- Ingress controller (e.g. NGINX Ingress Controller, Traefik or HAProxy).
- Object storage with S3 compatible API. In this example, we use MinIO Operator.
- Secret generator to automatically generate passwords.
- Optionally Sealed secrets to encrypt secrets that cannot be auto-generated, so they can be securely stored in the repository.
When deploying with Skaffold, the components listed above will be automatically installed.
./create_cluster.sh
Add two test domains into your hosts file, one for the application, the other for media object storage.
Mac OS
echo '127.0.0.1 media.test shopware.test' | sudo tee -a /etc/hosts
Linux
echo $(minikube ip)' media.test shopware.test' | sudo tee -a /etc/hosts
Get the minikube node IP address
minikube ip
Add .test domain into the CoreDNS config pasting the node IP address.
kubectl edit configmap coredns -n kube-system
Append the following into the Corefile
and replace 192.168.49.2
with your actual IP address returned by minikube ip
.
test:53 {
errors
cache 30
forward . 192.168.49.2
}
First delete shopware-init job if it exists
kubectl delete job/shopware-init -n shopware
To deploy and start the dev environment, run:
skaffold run --force=true -p dev
To deploy and start the production environment, run:
skaffold run --force=true -p production
kubectl port-forward -n shopware pod/minio-shopware-pool0-0 9443:9443
The GUI is available at https://localhost:9443
The default username and password are: minio:minio123
.
The administration URL slug has a randomly generated suffix.
kubectl get secret/shopware-app-config -n shopware -o jsonpath='{.data.SHOPWARE_ADMINISTRATION_PATH_SUFFIX}' | \
base64 --decode; \
echo
Then paste the returned suffix into the following URL http://shopware.test/admin_<SUFFIX>
.
It allows accessing Shopware from your host machine (not needed on a Linux host).
minikube tunnel
ktunnel inject deployment app-server-dev 9003
kubectl port-forward deploy/app-server-dev -n shopware 8000:8000