How to deploy Actor APIs?

Hi there, I build my API using Actors and Scala. How should I go about deploying it. I have it containerized in docker.

Extremely happy to be at a step where I am ready to showcase my Akka application to the world!. Please share your thoughts, tips and pitfalls.

It really depends on what you are deploying and to where.

For a cluster based application, I’d start here: Deploying Akka Cluster to Kubernetes • Akka Management

I see, I have no experience with Akka Cluster. As of now my API is built on Persistent Actors, Akka Typed and Akka HTTP.

Thanks @davidogren I will look into it.

I mean if it’s just a single container (and you’ve already containerized it) then just deploy your Akka container however and wherever you already deploy containers. i.e. via docker, podman, or Kubernetes. Where do you need help?

I am unsure about what provider I should go for @davidogren. Also, since it’s my first time deploying are there any pitfalls or mistakes that I should avoid or crucial information that I must know.

Thank you for your help.

If you are deploying a single container, and you are just exposing your API as REST APIs, it’s just a container like any other. The platform that runs the container doesn’t even know anything about the contents of the container, or that you wrote it in Akka. If you are looking to run a container in the cloud, basically every cloud provider provides that kind of service: Cloud Run for Google, for example. Or ECS for AWS.

Pitfalls or mistakes? It’s hard to say without knowing more about your application and your level of experience. The three things that come to mind are:

  • If you are using persistence, what is your persistence plugin? If it’s local to your container, you’ll need to figure out storage. Using a managed database might be easier though. (Because not having backups of your database is certainly a common pitfall.)
  • Use a base image with good security. And keep it up to date. Anything you put on the internet is subject to attack and your base image is part of your defense. I work for Red Hat (so the following is biased). But there is a free to use and distribute base image from Red Hat that is a solid starting point. Details here: (Re)Introducing the Red Hat Universal Base Image . You’ll need to figure out which image you want. registry.access.redhat.com/ubi9/openjdk-11-runtime for an image with a preinstalled OpenJDK11, for example.
  • You need to make sure you automate the process of deployment. As I said, you’ll need to keep that image up to date if you want it publicly accessible, so you’ll want to make sure you can rebuild and redeploy your image automatically so you keep up to date with all the latest patches of both Akka and your base image.

@davidogren Thank you for such a detailed response!

If you are using persistence, what is your persistence plugin? If it’s local to your container, you’ll need to figure out storage. Using a managed database might be easier though. (Because not having backups of your database is certainly a common pitfall.)

  • I am currently using Cassandra for Journal and Snapshots but it is in the local container. What are managed databases for Cassandra?

Use a base image with good security. And keep it up to date. Anything you put on the internet is subject to attack and your base image is part of your defense. I work for Red Hat (so the following is biased). But there is a free to use and distribute base image from Red Hat that is a solid starting point. Details here: (Re)Introducing the Red Hat Universal Base Image . You’ll need to figure out which image you want. registry.access.redhat.com/ubi9/openjdk-11-runtime for an image with a preinstalled OpenJDK11, for example.

  • Thank you I will check it out!

You need to make sure you automate the process of deployment. As I said, you’ll need to keep that image up to date if you want it publicly accessible, so you’ll want to make sure you can rebuild and redeploy your image automatically so you keep up to date with all the latest patches of both Akka and your base image.

  • I’m not sure how to do this, is there any resource that I can read and learn from?

My level of experience is only building APIs and microservices. I have understanding of Akka HTTP, akka Typed, Akka Streams and Akka Persistence Typed. I plan to catch up with Akka Clustering and Remoting and Akka Serialization in the Weekend.

This is so much fun :slight_smile: