---
title: Shopware Deployments | Shopware Community Hub
description: This unit gives you the best practice on how to do deployment with Shopware.
canonical_url: >-
  https://hub.shopware.com/learn/unit/best-practices-for-shopware-deployments-and-testing
---

<LearningObjectives>

- Define **software deployment** and its importance for ecommerce stability.
- Understand Shopware deployment **methods**.
- Outline **key deployment steps**.
- Recognize common **challenges and solutions**.
- Describe the CI's role in **code quality** and the need for logging and monitoring.

</LearningObjectives>

# Shopware Deployments

Software deployment refers to delivering, installing, and configuring applications or updates onto servers or user environments. It follows a series of steps to ensure a smooth transition from development to production use, minimizing risks like downtime, errors, and security vulnerabilities. In the case of Shopware, following a structured, opinionated deployment strategy is crucial due to the platform's unique requirements, such as handling product data, caching, plugin compatibility, and scaling for ecommerce traffic. This approach ensures performance, security, and reliability across environments while reducing the complexity of managing an ecommerce platform.

## Types of Shopware Deployments

There are several approaches to deploying Shopware, depending on your environment, team, and scalability needs:

1. **Webspace with SFTP Access**: This is a common approach involving tools like Jenkins or GitLab CI for automated deployment (CI/CD). This method automates building, testing, and deploying, offering reliability and scalability, though it requires setup.
2. **Dockerized Deployment**: Employs Docker containers to ensure consistent environments across local, staging, and production stages.
3. **Kubernetes Deployment**: Shopware is containerized (typically with Docker) and deployed on a [Kubernetes cluster](https://github.com/shopware/shopware-operator).
4. **Manual Deployment**: This method is not recommended due to the potential for errors and lack of scalability. This method manually uploads code to the server using FTP or SSH.

These methods form the foundation of Shopware deployment strategies. Automated deployments through CI/CD pipelines, coupled with containerization tools like Docker and Kubernetes, ensure consistency, scalability, and efficiency across different environments.

## Key Elements and Best Practices for Shopware Deployments

Successful deployments rely on careful planning, the right tools, and adherence to best practices. Here’s a breakdown of the key elements and practices involved:

### Setup and Configuration

- **Environment Setup**: Prepare the server with required components like PHP, Composer, MySQL, or MariaDB. For Shopware 6, Docker simplifies dependency setup.
- **Configuration Files**: Manage environment-specific settings (e.g., `.env` files) for database connections, caching, and system configuration.

### Code Deployment

- **Version Control**: Shopware projects often use Git to manage code changes.
- **Manual or Automated Deployment**: Deployment can be done manually or through CI/CD pipelines (GitLab, GitHub Actions, Jenkins) to automate tasks like building, testing, and releasing code.
- **Composer Installation**: Shopware relies on Composer dependencies. Run `composer install` when building the deployment artifact so that it contains all required PHP packages.

### Database Migrations

- **Migrations**: Deployments often involve updating the database schema. Migrations ensure new tables and data structures are properly implemented.
- **Backup**: Always back up the database before deploying to prevent data loss in case of errors.

### Caching and Indexing

- **Clear Cache**: Shopware uses caching for performance, but caches need to be cleared during deployment to apply changes.
- **Re-indexing**: Complete Shopware's normal update process first. A major update alone does not require a manual full re-index.
  - If the release or upgrade instructions require a re-index, or indexed data is outdated, update the indexes under **Settings > System > Caches & Indexes** in the administration.
  - For a large shop, run `bin/console dal:refresh:index --use-queue` so that the full re-index is processed through the message queue. On a large live shop, these queued jobs can take considerable time and add system load. Plan the timing and make sure the message queue workers continue processing until the re-index is complete.
  - Elasticsearch and OpenSearch use a separate search index. Rebuild it with `bin/console es:index` when an update changes its mappings.

### Deployment Environments

- **Local Development**: Development typically occurs in Docker containers or virtual environments.
- **Staging Environment**: A staging environment mirrors production for final testing before deployment.
- **Production Deployment**: After successful testing, the deployment is pushed live, making the Shopware shop available to customers.

### Monitoring and Error Handling

- **Logging**: Shopware includes logging tools to monitor issues during and after deployment. Review log files post-deployment.
- **Performance Monitoring**: Tools like New Relic, Grafana, or Shopware’s built-in features track performance, server load, and response times.

### Deployment Tools and Strategies

- **CI/CD Pipelines**: Automation tools like Jenkins or GitLab [CI handle](https://hub.shopware.com/learn/unit/best-practices-for-shopware-deployments-and-testing#what-is-ci) everything from testing to deployment.
- **Docker**: Docker ensures uniform development, staging, and production environments.
- **Blue-Green Deployment**: This strategy deploys to a new environment while keeping the current one live. After verifying functionality, traffic is switched to the new environment.

### Deployment Helper

[Shopware's Deployment Helper](https://developer.shopware.com/docs/guides/hosting/installation-updates/deployments/deployment-helper/) streamlines deploy-time tasks after the code has been uploaded, such as installing or updating Shopware, managing extensions, compiling themes, and running one-time tasks. This ensures consistent deployments across environments and simplifies project management.

### Performance Optimization

For better performance, use caching solutions like Redis or Varnish, optimize database queries, and employ a content delivery network (CDN).

### Security

- Ensure SSL implementation, configure firewalls, and keep server software updated. The [Shopware documentation](https://developer.shopware.com/docs/resources/references/security.html) provides more details.

## Common Challenges in Shopware Deployments

Despite best practices, deployments can encounter challenges such as:

- **Downtime**: Avoiding downtime during deployments is crucial, especially for larger shops.
- **Plugin Compatibility**: Ensure third-party plugins are compatible with new Shopware versions.
- **Database Integrity**: Handle large datasets carefully to prevent migration-related data corruption.
- **Performance**: Minimize performance impact, particularly during peak traffic.
- **Installation Best Practices**: Plugins should be installed via Composer, not through the administration interface.
- **Read-Only Extension Manager**: Since Shopware 6.6.4.0, setting `shopware.deployment.runtime_extension_management` to `false` prevents ad-hoc extension installations through the administration in deployment-managed projects.

Following these best practices minimizes risks to shop performance and user experience during Shopware updates and maintenance.

## Files to Avoid Uploading on a Live Server/Production

When deploying Shopware to a live server, avoid uploading these files:

1. **Development Files**: Files used for debugging or development, like IDE-specific files.
2. **Documentation**: Unnecessary documentation or README files not meant for production.
3. **Backup Files**: Old or unused backup files.
4. **Test Data**: Testing files are irrelevant to the live environment.

Excluding these files ensures the live server remains clean and secure.

## Shared Folders in Shopware

When a deployment creates a new release directory, runtime files must remain available across releases. Deployment tools therefore keep these files in shared storage and link or mount them into each release.

Two important examples are:

1. **`public/media`**: Stores public media files, such as product images.
2. **`files`**: Stores private files, such as invoices, delivery notes, and downloadable product files. These files must not be directly accessible through the web server.

Here, **shared** means that the files are reused by multiple releases. It does not mean that every file is publicly accessible. Depending on the deployment setup, other runtime paths such as `var/log`, `public/thumbnail`, and `public/sitemap` can also use shared storage.

## What is CI?

In Shopware, Continuous Integration (CI) refers to the practice of regularly integrating code changes into a shared repository with automated testing. CI ensures code quality, providing developers with immediate feedback on the success or failure of their changes. This practice is essential for collaboration and efficient deployments.

For more details, check the [Gitlab CI/CD](https://docs.gitlab.com/ci/) or [GitHub](https://docs.github.com/en/actions/get-started/continuous-integration) documentation.

## Logging and Monitoring in Shopware

Effective **logging and monitoring** are key to tracking performance and troubleshooting issues in Shopware. The **frosh/tools** plugin provides health checks, performance recommendations, a log viewer, and database metrics, helping developers identify and resolve performance bottlenecks.

For further information, see the [Shopware monitoring and logging guide](https://developer.shopware.com/docs/guides/hosting/configurations/observability/logging.html).

By adhering to these best practices and utilizing the right tools, Shopware deployments can be streamlined, secure, and efficient, ensuring a stable environment for your Shopware shop and minimizing risks during updates.
