How our "Tree per order" app is hosted
As some of you may already know, we have a free app in the Shopware Store called "Tree per Order", where store owners can enable their customers to plant a tree for each order. Therefore, this app is about donations and reforestation of the world's tree population. A sustainable idea, then!
But appearances are a little deceptive.... Because although the app is free and this is about charity, the technical setup is by no means simple and "cheaply" implemented. This post is about a technical introduction to our state-of-the-art "Tree per Order" application for Shopware Cloud. Curious? Then let's get started!
Shopware Cloud meets AWS Cloud
The first question you might ask is how the app is hosted in the first place? As a reminder, since the app is for Shopware Cloud, it is not possible to map the functionalities - such as creating the donation product or submitting the orders to our partners (e.g. TreeMates) - directly on the store's server. The execution of own PHP code is simply not possible.
Therefore, the functionalities have to be outsourced to external servers and the communication then takes place exclusively via so-called REST-Apis & Webhooks - i.e. encrypted via the public Internet. Fortunately, you can choose where the app is hosted: This can be a normal shared hosting like GoDaddy or also a managed server at Timme Hosting.
However, we have decided that we will host all our cloud applications in the AWS Cloud. The same cloud hosting that Netflix, Amazon or Shopware use themselves. With such modern cloud hosting, we can implement virtually anything we want! This goes far beyond normal hosting: high-performance computing, machine learning or even quantum computing.
Admittedly, we don't need quantum mechanics to sustainably save forests for our "Tree per order" app. But below you will learn that there will be some technologies and concepts involved that are not possible with normal hosting, making the app technically special.
Isolated environments through AWS Organizations
The first special feature is that while we have only one server landscape with the AWS cloud for all our apps like "Tree per Order" or even "Back in Stock Notification", these apps are completely isolated from each other. This is implemented in AWS through AWS Organizations.
All the apps are in separate accounts and it is not possible to access the servers of the other account without the proper permissions from one account. Even in case of a disaster like crashed servers or a hacker attack, we developers always know that only 1 app is affected at a time. Basically, the ultimate security that no traditional hosting can provide. Perfect for our Shopware apps, some of which have to deal with sensitive customer data.
Infrastructure as Code for reproducible cloud apps
We also use a technique called Infrastructure as Code (IaC) with the help of CloudFormation. With IaC, it is possible to define the entire technical environment such as servers, backups or databases in a few files and then upload them to our landscape with just a few clicks.
This guarantees that we get exactly the environment built by AWS that we have thought of to get the highest reliability in the running operation. This way, we don't have to wildly click through to the hoster and create human carelessness errors, as is usually the case. Our environment is 100% reproducible.
It also creates another small advantage regarding the internationalization of our app. Currently, our server environment is located in Frankfurt, Germany. But since we have defined the app with IaC, we can start parallel operations in other countries like Australia, Japan or USA without any problems to provide the best possible performance and proximity to the customers.
Scalable and self-healing hosting with Elastic Beanstalk
For the actual hosting, we use Elastic Beanstalk, which belongs to so-called Platform as a Service applications (PaaS). The great thing about PaaS is that we hand over some of the responsibility regarding hosting to AWS with their years of experience, so we know that under the hood everything works 100%.
We don't have to do any updates or renew certificates, because this annoying part is done by AWS itself, similar to Shopware Cloud. Also, we know that our servers are always available, automatically scale up at higher load or can heal themselves within a few minutes if a server crashes. Cool, isn't it?
In addition, Elastic Beanstalk makes updating new code more fault-tolerant: Because when we release a new version of the app in the background, additional servers are brought up and only there the new version is applied. If the health checks on the additional servers determine that the new version is stable, only then is the new code packed onto all the remaining servers. However, if something goes wrong, the additional servers are simply taken down again and no one would have known that the update had failed. This way, ongoing operations are still guaranteed without interruptions.
Powerful databases with continuous backups
To be able to store data, we chose MySQL over AWS RDS. With RDS, we are able to access high-performance databases that we can scale as needed. For example, if we notice that our Shopware cloud apps are becoming more popular, then it's no problem for us to handle the higher data load. Just upgrade to the next RDS level and then everything is back in the green!
In addition, RDS is also very helpful when it comes to backups. Backups of the database happen with the app in a continuous way every 5 minutes! Normally, most store owners and developers know it so that only 1 time a day a backup is made. So 5 minutes is really amazing. In case of the case, you would always know that only 5 minutes of data is gone.
Should our apps be used more and more, then a hot standby replica of the database would also be useful. Should the database ever crash, then a fully functional clone of the original database would be deployed and operations would continue with virtually no interruption.
Monitoring security with GuardDuty and CloudTrail
And if it weren't enough, we even went a step further and set up AWS GuardDuty and CloudTrail. With the two services, we have intelligent threat detection that protects our cloud apps for malicious users and hackers.
With AWS GuardDuty, we use artificial intelligence that knows exactly what normal running operation means and sounds an alarm if an unknown person should gain access to our app or start changing any settings or deleting technical modules.
Through AWS CloudTrail, we can, among other things, track, log, and evaluate any activity in our cloud landscape. This way, we always know exactly which user did what.
Amazing what we do to ensure a high standard, isn't it? And there's one more thing to consider: although we offer the app for free, on the other hand we pay around 50 euros a month in AWS hosting fees.
But it's worth every penny! We have always wanted to do something good for the environment and with the "Tree per Order" app we want to do our part. The Shopware Cloud offers us the platform to reach many people.
If you are a store owner: Help us with the green initiative and download the app today for free in the Shopware Store. Show your customers that responsibility starts with online commerce.