die KI hat mir folgende Lösung vorgeschlagen, ich frage mich, ob das auf irgendetwas anderes Einfluss hat? Und wieso ich überhaupt so vorgehen muss?
KI hat folgendes vorgeschlagen (was geholfen hat)
force stop migration
docker exec shopware-database-1 mariadb -u shopware -psecure_shopware_password_here shopware -e "
UPDATE swag_migration_run
SET step = ‚aborted‘, updated_at = NOW(3)
WHERE step = ‚aborting‘;
SELECT ROW_COUNT() as rows_updated;" 2>&1
remove lock files:
docker exec shopware-web-1 rm -f /tmp/sf.message_queue_consume_async..lock /tmp/sf.message_queue_consume_low_priority.*.lock && echo „Lock files removed“
start cli worker
docker exec shopware-web-1 php bin/console messenger:consume async -vv --time-limit=3600
Danach kann ich die Migration starten und sie funktioniert….
Mein Projekt hab ich so erstellt:
sudo mkdir -p /opt/shopware && cd /opt/shopware
&& composer create-project shopware/production:^6.7.7.1 .
&& composer require shopware/docker
mit diesen Dateien:
compose.yml:
x-shopware-environment: &shopware
environment:
APP_ENV: prod
APP_SECRET: „${APP_SECRET}“
APP_URL: „${APP_URL:-http://localhost:8000}“
DATABASE_URL: „mysql://shopware:${MYSQL_PASSWORD:-shopware}@database/shopware“
DATABASE_HOST: „database“
JWT_PRIVATE_KEY: „${JWT_PRIVATE_KEY}“
JWT_PUBLIC_KEY: „${JWT_PUBLIC_KEY}“
# Optional: Redis for sessions (recommended for production)
# PHP_SESSION_HANDLER: redis
# PHP_SESSION_SAVE_PATH: „tcp://cache:6379/1“
volumes:
- files:/var/www/html/files
- theme:/var/www/html/public/theme
- media:/var/www/html/public/media
- thumbnail:/var/www/html/public/thumbnail
- sitemap:/var/www/html/public/sitemap
- custom-plugins:/var/www/html/custom/plugins
services:
MariaDB Database
database:
image: mariadb:11.4
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: „${MYSQL_ROOT_PASSWORD:-root}“
MARIADB_USER: shopware
MARIADB_PASSWORD: „${MYSQL_PASSWORD:-shopware}“
MARIADB_DATABASE: shopware
volumes:
- mysql-data:/var/lib/mysql
healthcheck:
test: [„CMD“, „mariadb-admin“, „ping“, „-h“, „localhost“, „-p${MYSQL_ROOT_PASSWORD:-root}“]
interval: 10s
timeout: 5s
retries: 5
Fix volume permissions
init-perm:
image: alpine
<<: *shopware
command: >
chown 82:82
/var/www/html/files
/var/www/html/public/theme
/var/www/html/public/media
/var/www/html/public/thumbnail
/var/www/html/public/sitemap
/var/www/html/custom/plugins
Initialize Shopware (runs migrations, installs, etc.)
init:
image: shopware-local
build:
context: .
<<: *shopware
entrypoint: [„php“, „vendor/bin/shopware-deployment-helper“, „run“]
depends_on:
database:
condition: service_healthy
init-perm:
condition: service_completed_successfully
Main web application
web:
image: shopware-local
build:
context: .
<<: *shopware
restart: unless-stopped
depends_on:
init:
condition: service_completed_successfully
ports:
- „8000:8000“
Background message worker
worker:
image: shopware-local
build:
context: .
<<: *shopware
restart: unless-stopped
depends_on:
init:
condition: service_completed_successfully
entrypoint: [„php“, „bin/console“, „messenger:consume“, „async“, „low_priority“, „–time-limit=300“, „–memory-limit=512M“]
healthcheck:
disable: true
Scheduled task runner
scheduler:
image: shopware-local
build:
context: .
<<: *shopware
restart: unless-stopped
depends_on:
init:
condition: service_completed_successfully
entrypoint: [„php“, „bin/console“, „scheduled-task:run“]
healthcheck:
disable: true
Optional: Redis/Valkey for caching and sessions
cache:
image: valkey/valkey:latest
restart: unless-stopped
volumes:
mysql-data:
files:
theme:
media:
thumbnail:
sitemap:
custom-plugins:
Dockerfile:
#syntax=docker/dockerfile:1.4
ARG PHP_VERSION=8.4
FROM ghcr.io/shopware/docker-base:${PHP_VERSION}-frankenphp AS base-image
FROM ghcr.io/shopware/shopware-cli:latest-php-${PHP_VERSION} AS shopware-cli
Build stage
FROM shopware-cli AS build
ADD . /src
WORKDIR /src
RUN --mount=type=cache,target=/root/.composer
–mount=type=cache,target=/root/.npm
/usr/local/bin/entrypoint.sh shopware-cli project ci /src
Final production image
FROM base-image
COPY --from=build --chown=82 --link /src /var/www/html