Working with Docker and GCP - how to inject settings?

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
tblanchard
Posts: 7
Joined: 02 Dec 2022, 00:09

Working with Docker and GCP - how to inject settings?

Post by tblanchard » 02 Feb 2023, 21:49

We have shortlisted Aimeos for our new e-commerce platform and we are planning to run on Google Cloud Platform using Docker.

I've found the docker stuff on GitHub and that seems cool but what I am not clear on is how to inject settings/config/extensions. Obviously I need a web server and we are using our own front end UI, running in headless mode. And of course I need to provision databases but (and this might be more a docker than aimeos question and I am a bit of a docker noob), I'm not clear on exactly what goes where or how to inject settings like db connection credentials into my docker container.

I should also mention that a big part of why we want to pilot Aimeos is the announced ChatGPT integration. We want to experiment with that. Is that an extension I need to specify somewhere?

I'm finding the docs kind of thin on how this is all supposed to fit together.

Thanks for any hints or pointers to resources.

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: Working with Docker and GCP - how to inject settings?

Post by aimeos » 03 Feb 2023, 09:40

tblanchard wrote: 02 Feb 2023, 21:49 I've found the docker stuff on GitHub and that seems cool but what I am not clear on is how to inject settings/config/extensions. Obviously I need a web server and we are using our own front end UI, running in headless mode. And of course I need to provision databases but (and this might be more a docker than aimeos question and I am a bit of a docker noob), I'm not clear on exactly what goes where or how to inject settings like db connection credentials into my docker container.
If you want to use Aimeos headless and build your own UI or use the HTML frontend of Aimeos is a personal preference depending on the requirements you have.

Google uses Kubernetes like we do for our demos and all settings which are different between setups are injected via environment variables. Here's the Kubernetes config we use for our Laravel demo:

Code: Select all

---
apiVersion: v1
kind: Namespace
metadata:
  name: demo
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: laravel-demo-setup
  namespace: demo
  labels:
    app: laravel-demo
data:
  99-setup.sh: |
    composer -n create-project aimeos/aimeos /aimeos
    chgrp -R application /aimeos/bootstrap /aimeos/storage
    chmod -R g+w /aimeos/bootstrap /aimeos/storage
    rm -rf /app && mv /aimeos /app
---
apiVersion: v1
kind: Service
metadata:
  name: laravel-demo
  namespace: demo
  labels:
    app: laravel-demo
spec:
  selector:
    app: laravel-demo
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: laravel-demo
  namespace: demo
  labels:
    app: laravel-demo
spec:
  replicas: 2
  revisionHistoryLimit: 0
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 50%
      maxSurge: 1
  selector:
    matchLabels:
      app: laravel-demo
  template:
    metadata:
      labels:
        app: laravel-demo
    spec:
      volumes:
      - name: setup
        configMap:
          name: laravel-demo-setup
      containers:
      - name: nginx-php
        image: webdevops/php-nginx:8.2-alpine
        ports:
        - containerPort: 80
        readinessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 30
          failureThreshold: 10
          periodSeconds: 5
          successThreshold: 3
        volumeMounts:
        - name: setup
          mountPath: /opt/docker/provision/entrypoint.d/99-setup.sh
          subPath: 99-setup.sh
        env:
        - name: WEB_DOCUMENT_ROOT
          value: /app/public/
        - name: PHP_DISMOD
          value: "ioncube"
        - name: PHP_MEMORY_LIMIT
          value: "128M"
        - name: PHP_MAX_EXECUTION_TIME
          value: "30"
        - name: DB_CONNECTION
          value: "mysql"
        - name: DB_HOST
          value: "127.0.0.1"
        - name: DB_PORT
          value: "3306"
        - name: DB_DATABASE
          value: "aimeos"
        - name: DB_USERNAME
          value: "aimeos"
        - name: DB_PASSWORD
          value: "aimeos"
        - name: APP_NAME
          value: "Aimeos Laravel Demo"
        - name: APP_KEY
          value: "base64:..."
        - name: APP_URL
          value: "https://laravel.demo.aimeos.org"
        - name: ASSET_URL
          value: "https://laravel.demo.aimeos.org"
      - name: mariadb
        image: mariadb
        ports:
        - containerPort: 3306
        env:
        - name: MARIADB_ROOT_PASSWORD
          value: "aimeos"
        - name: MARIADB_DATABASE
          value: "aimeos"
        - name: MARIADB_USER
          value: "aimeos"
        - name: MARIADB_PASSWORD
          value: "aimeos"
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: demo-issuer
  namespace: demo
  labels:
    app: laravel-demo
spec:
  acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    privateKeySecretRef:
      name: demo-issuer-key
    solvers:
    - http01:
        ingress:
          class: traefik
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: laravel-demo-aimeos-org
  namespace: demo
  labels:
    app: laravel-demo
spec:
  secretName: laravel-demo-secret
  privateKey:
    rotationPolicy: Always
  dnsNames:
  - laravel.demo.aimeos.org
  issuerRef:
    name: demo-issuer
    kind: Issuer
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: laravel-demo-ingress
  namespace: demo
  labels:
    app: laravel-demo
spec:
  entryPoints:
  - websecure
  routes:
  - match: Host(`laravel.demo.aimeos.org`)
    kind: Rule
    services:
    - name: laravel-demo
      port: 80
      passHostHeader: true
      sticky:
        cookie:
          httpOnly: true
          name: laravel-demo-host
          sameSite: lax
      strategy: RoundRobin
      weight: 10
  tls:
    secretName: laravel-demo-secret
In a production setup, you would split web server and database into different pods.
tblanchard wrote: 02 Feb 2023, 21:49 I should also mention that a big part of why we want to pilot Aimeos is the announced ChatGPT integration. We want to experiment with that. Is that an extension I need to specify somewhere?
The integration is in the Aimeos core and you can test it yourself in our admin demo:
https://admin.demo.aimeos.org/

Here's a description how it works:
https://aimeos.org/tips/ai-revolution-in-ecommerce/
tblanchard wrote: 02 Feb 2023, 21:49 I'm finding the docs kind of thin on how this is all supposed to fit together.
We didn't concentrate on documenting different types of deployments yet but want to offer a Helm chart for installing Aimeos in Kubernetes clusters easily in the future.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

tblanchard
Posts: 7
Joined: 02 Dec 2022, 00:09

Re: Working with Docker and GCP - how to inject settings?

Post by tblanchard » 06 Feb 2023, 18:38

Thanks, that was very helpful.

Post Reply