5 steps to Shopware automated deployments

5 steps to Shopware automated deployments

Mike Carter
Ixis

--

If you are familiar with software projects you might be aware of how important, in terms of quality, Continuous Delivery (CD) & Continuous Integration (CI) is for your project.

So, what is CD & CI and why you should use it? In simple terms, you will lessen errors, reduce delivery times and boost your software quality by developing and releasing code in short cycles.

CD & CI in a nutshell

What you need

  • Your knowledge of continuous integration must be solid to have ample tests to cover the changes in your project.
  • Deployments will be automated but introducing the process is still a manual task, once the process is established human intervention will no longer be needed, reducing PEBCAK errors.
  • The process can be triggered by a git push or hook so automated deployment is achievable however, the manual button press is recommended for people less confident about deploying things to live by accident
  • The developers working on the project need to grasp feature flags (switch buttons) so that incomplete features will not affect the production environment.

What you gain

  • No more days spent planning large complex deployments with multiple changes
  • Your delivery frequency can be increased, releasing more often means you will get more feedback
  • Reduce the pressures on your team even for small changes, encouraging iterating faster

Do you really need this for an e-commerce project?

At this point, you may think continuous delivery isn’t appropriate for your business. You are running a store based on one of the popular platforms and getting updates directly from them, so what can go wrong?

Projects are more complex than just installing updates direct from the platform development team. Your customisations could vanish from your store causing issues, or your server may not be fully compatible with the new features included in the release.

“I already have a staging server for testing so that won’t happen to me” I hear you say. If this is the case, you are more protected to issues but if you deploy the changes manually then there’s a higher chance that due to human error you could miss parts of code causing errors in your site. Worst case scenario is a fatal error which ultimately means no sales from your store until it’s fixed as customers won’t be able to access your site. In short, you are playing Russian roulette every time you deploy to production when manually deploying.

I’m going to guide you through 5 steps that will simplify your deploys to production for Shopware projects moving forward:

  1. Perform the update manually on your staging/local server to check everything is working as expected.
  2. Once there are no issues on your staging server, commit the file changes to the repository.
  3. For custom configurations, you will need to dump the tables instead of just creating the config files. This could change a bit depending on your customisations but as a base, the tables below are the ones needed:

s_benchmark_config s_core_auth_config s_core_config_element_translations s_core_config_elements s_core_config_form_translations s_core_config_forms s_core_config_mails s_core_config_mails_attachments s_core_config_mails_attributes s_core_config_values s_core_templates_config_elements s_core_templates_config_layout s_core_templates_config_set s_core_templates_config_values

4. Using deployhq, jenkins or any other suitable alternative, configure the task to deploy the changes to live. You will need to download and extract the update package from Shopware, onto your production server in order to get the migrations. Finally, run the following command:

php bin/console sw:migrations:migrate

There’s a few bits of house keeping that we cover in the full Shopware deployment blog post. Check it out.

--

--

Mike Carter
Ixis
Editor for

Mike Carter: a Drupal enthusiast. PHP Coder.