ruby

Data Sovereignty: How to Keep All of Your Services in Europe (AppSignal + Hatchbox)

Julian Rubisch

Julian Rubisch on

Data Sovereignty: How to Keep All of Your Services in Europe (AppSignal + Hatchbox)

Over the last decade, a great deal of data privacy regulations have been passed in the European Union. Like it or not, measures like GDPR, the Digital Services Act, and the upcoming Artificial Intelligence Act are exerting increasing influence across industries over how and especially where the data of European customers is stored.

In this article, we will explore the ways to keep the simplicity of a Platform as a Service (PaaS) while utilizing only European providers.

Why Data Sovereignty Matters More Than Ever

The General Data Protection Regulation (GDPR), which was ratified in 2016, granted fundamental rights to the "data subject". These include the right of access, the right of rectification, the right of erasure, and similar. One of the implications of this regulation was that personal data of EU citizens can only be stored inside the Union or countries with adequate protection levels.

In the 2020 Schrems II ruling, the EU Court of Justice invalidated the EU-US Privacy Shield over concerns of data privacy adequacy. The ripple effect caused by this decision (and others) has led to greater vigilance about data privacy among European citizens, and customers have started to wonder where their personal information is stored.

All this has put European companies under increased pressure to both comply with the GDPR requirements and make those efforts visible to target groups.

Traditional Trade-offs (and Why They Suck)

Before it has switched to “maintenance mode” with no clear successor emerging, Heroku was undoubtedly the go-to provider of the last decade. As a traditional PaaS, it defined deployment ergonomics: git push heroku master was the gold standard of developer experience. But even though it set the bar, it was never without drawbacks (costs, limited European options, and infrastructure lock-in, to name a few). Developers were always limited to databases, key-value stores, and logging services it provided. Then, there were limited scaling options and the inability to fine-tune resources; compromises worth making, but far from ideal.

Another option is to build your own operations pipeline: implement a DIY solution on bare metal, create the necessary tooling, and deploy every change manually. Even with modern container orchestration tools like Kamal, this approach introduces a massive DevOps overhead. Permissions have to be managed, passwords need to be stored securely and shared among the team, you know the drill. Basically, it boils down to hiring manpower to synchronize the inner and outer loops (development and operations).

The youngest "traditional" way to approach deployment and operations is managed Kubernetes. However, it’s important to point out that it has a steep learning curve and is probably overkill for most Rails apps. It does incorporate some of the developer experience improvements that Heroku pioneered, but you'll still want to have a person on the team to manage the configuration. And if you're just starting out, that's not an ideal situation.

The Third Way: Own Your Cloud Without the Complexity

But what if I told you you can combine developer ergonomics with the freedom to choose your cloud provider? To deploy with a single git push while keeping your data in Europe? To connect to an application and performance monitoring service (APM) that also serves as log storage and uptime watchdog? There is a way to achieve this, and while it's not a silver bullet, it comes close.

Hatchbox is a DevOps service provider designed with one goal in mind: to simplify the deployment pipeline for you. You pick a (European) cloud provider like Scaleway or Hetzner (or any other Ubuntu-based server with root access), create a server, and Hatchbox takes care of the rest. You can deploy your Rails application with one click, or even git push.

AppSignal is a EU-hosted monitoring service that boasts a full suite of observation tools: error and performance monitoring, uptime watchdog, log management, server metrics dashboards, etc.

Below, we will analyze this powerful combination using a real-world example.

Practical Setup: A European-First Rails Stack

We’ll begin by setting up our Hatchbox account, provisioning a server, and deploying a Rails application. First, sign up at Hatchbox and enter a payment method to start adding servers.

Next, we have to create a new cluster. In Hatchbox, a cluster is simply a group of servers where each one has a different role. That can be a web server, load balancer, database server, background processors, and so on.

For the sake of this example, I will use a European option, Hetzner. However, like I’ve said, you can connect any provider via the "custom" option, as long as it can provision a server running an Ubuntu image for you. My second go-to European cloud provider is Scaleway, which also allows you to prepare a managed database and Redis services.

Creating a new cluster on Hatchbox
Creating a new cluster on Hatchbox

After setting up the cluster, we’re asked to provide an API token for our Hetzner account. To create one, navigate to a Hetzner project and click on Security. From there, create an API token with a meaningful description. Remember to give it read and write access:

Generating an API token from the Hetzner console
Generating an API token from the Hetzner console

Now use it to connect your Hatchbox account to Hetzner:

Connecting a Hetzner account to Hatchbox
Connecting a Hetzner account to Hatchbox

After choosing a region, you're ready to add a first server:

Hatchbox cluster dashboard
Hatchbox cluster dashboard

For this demo, we are going with a small CX 23 compute instance, which you can choose right inside this form. In other words, you don't need to leave Hatchbox to manage resources in Hetzner.

Creating a new server on Hetzner via Hatchbox’s interface
Creating a new server on Hetzner via Hatchbox’s interface

As noted above, a server can have a couple of distinct roles. We're going to activate four of them here, for demonstration purposes:

  • Web server (this one is required)
  • Cron server (also required for migrations during deployments)
  • Background worker
  • PostgreSQL
  • Redis

After we click "Create server", Hatchbox will harden our server and install the necessary services and dependencies:

Provisioning a server via Hatchbox
Provisioning a server via Hatchbox

The next step is to actually deploy an application. To do this, we need to create it within our Hatchbox cluster and give it a name:

Creating a new app in Hatchbox
Creating a new app in Hatchbox

Then we're asked to provide the Git repository the app should deploy from. I've already connected my Github account, so I can now simply specify the path.

Connecting a Hatchbox app to a GitHub repository
Connecting a Hatchbox app to a GitHub repository

Once that is saved, we'll have to provision the required PostgreSQL and Redis databases. We can do this by adding new unmanaged instances from the "Databases" tab. (For production, it's advised to use a managed database service, but we'll get to that in a second).

Creating an unmanaged PostgreSQL database on Hatchbox
Creating an unmanaged PostgreSQL database on Hatchbox
Creating an unmanaged Redis database on Hatchbox
Creating an unmanaged Redis database on Hatchbox

Now I can conveniently click the "Deploy" button in the upper right corner, and Hatchbox will work its magic; that is, prepare the correct environment variables (RAILS_ENV, DATABASE_URL etc.), run the deploy script, and so on.

Aside: You can also mimic Heroku-like behavior by enabling automatic deploys on git push:

Enabling automatic deploys via git push
Enabling automatic deploys via git push

What I am leaving out of this tutorial is the fact that you may want to connect your application to a domain or set up SSL. The former requires you to purchase a domain, add it to your Hatchbox app via "Domains & SSL," and point the DNS records to the server. The latter, on the other hand, is more straightforward because Hatchbox uses Caddy, which manages Let’s Encrypt certificates automatically.

At the end of this process, you've got a Rails application running on European infrastructure. But your operation’s requirements likely don't end here. You'll want access to server and business metrics, error and log management, and the like. Luckily, AppSignal is a cost-effective Dutch provider that ticks all these boxes and is very easy to install.

In your application, you only have to add this to your Gemfile:

Ruby
gem "appsignal"

bundle install it, and after creating an organization in AppSignal, add a Ruby on Rails application.

Setting up the application on AppSignal
Setting up the application on AppSignal

AppSignal will then provide you with the necessary installation steps:

Instructions for installing AppSignal in your Ruby on Rails application
Instructions for installing AppSignal in your Ruby on Rails application

The CLI will guide you through the installation, and AppSignal will verify the success:

Verifying the AppSignal installation
Verifying the AppSignal installation

Now that everything’s been set up, you can enjoy some peace of mind, courtesy of AppSignal. I recommend reading the docs for further instructions and configuration options.

App monitoring dashboard on AppSignal
App monitoring dashboard on AppSignal

To complete your migration to European data services, consider extending your toolbox. Cloud providers like Scaleway or IONOS offer a full suite of services, from managed databases and container registries to CDNs and object storage. For a more comprehensive list of alternatives, consult directories such as European Alternatives.

Benefits and Drawbacks

The approach we’ve outlined in this article comes with several benefits:

  • First of all, you’ll worry less about whether your application is GDPR-compliant. While there are other challenges to tackle in this domain, keeping your data in European territory makes them all easier to handle.
  • Hatchbox gives you the flexibility of choosing your own cloud provider and instance configurations, while remaining your single point of contact for management.
  • Deployment to Hatchbox is just as simple as pushing new releases to Heroku used to be.
  • Enlisting AppSignal as your APM keeps the bulk of operational concerns manageable in a cost-effective and comprehensive way. Gone are the days when you needed separate services for uptime monitoring, log management, performance tracking, and error monitoring. It’s effectively an operations management one-stop shop.

Keep in mind that there are some drawbacks, as well:

  • There is a bit of DevOps overhead attached to Hatchbox if you ever need to customize your deploys or builds. Tasks like custom TLS certificates, installing OS packages, and similar can all be pulled off, but they will require a bit of manual work.
  • You’ll be working with more than one company, so you’ll have to manage multiple billing/subscription plans and release cycles.

Clearly, the benefits outweigh the downsides in this approach. All things considered, what’s not to love?

Conclusion

You don't need a DevOps team or complex PaaS to keep your data in Europe. This article has shown a simple and cost-effective way of deploying your Ruby on Rails application to a European data center. By using AppSignal, you can go a step further and ensure your application metrics and other monitoring data remain within domestic borders. And with agentic AI tools improving over time, achieving data sovereignty is bound to become even easier.

Go ahead and try AppSignal and Hatchbox for a fully European stack.

Happy prompting!

Wondering what you can do next?

Finished this article? Here are a few more things you can do:

  • Share this article on social media
Julian Rubisch

Julian Rubisch

Our guest author Julian is a freelance Ruby on Rails consultant based in Vienna, specializing in Reactive Rails. Part of the StimulusReflex core team, he has been at the forefront of developing cutting-edge HTML-over-the-wire technology since 2020.

All articles by Julian Rubisch

Become our next author!

Find out more

AppSignal monitors your apps

AppSignal provides insights for Ruby, Rails, Elixir, Phoenix, Node.js, Express and many other frameworks and libraries. We are located in beautiful Amsterdam. We love stroopwafels. If you do too, let us know. We might send you some!

Discover AppSignal
AppSignal monitors your apps