---
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
---

# Shopware Deployments

<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**: As Shopware relies on Composer for dependency management, running `composer install` is essential during deployment to ensure all necessary packages are included.

### 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**: After major updates, indexes for products, categories, etc., must be rebuilt for optimal data retrieval.

### 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 provides tools and scripts to streamline deployment tasks such as clearing caches, running database migrations, and managing file uploads. 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 Mode**: Keeping Shopware in read-only mode prevents unauthorized file changes, enhancing security by blocking vulnerabilities.

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

In Shopware, **shared folders** are directories that store media and files accessible to both the application and the web server. Key shared folders include:

1. **`public/media`**: Stores media files (e.g., images, documents) accessible to the public.
2. **`files`**: Stores logs, temporary files, and other shared data.

## 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 valuable insights into response times, database queries, and exceptions, 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.
