How to Ship Akka to Production
by Paweł Lipski plipski@virtuslab.com
Agenda
-
Docker
-
sbt (Scala built tool)
-
Continuous Integration
-
akka-serialization-helper
-
Kubernetes
-
Log collection
-
Observability
Docker in a nutshell
Docker in a nutshell
Imagine a virtual machine... but so lightweight you can instantly launch 10s of them on your laptop.
Plus you can configure what's installed on that machine with an intuitive language (Dockerfile).
Plus you can download ready machines with e.g. mysql/Nginx/Python/whatever readily installed
Docker in a nutshell
# build your own Docker image ("lightweight VM")
docker build -f my.Dockerfile -t foobar . docker run foobar
# or, use ready stuff: docker run nginx docker run postgres # etc.
Docker in a nutshell
FROM ubuntu:20.04 SHELL ["/bin/bash", "-e", "-o", "pipefail", "-u", "-x", "-c"] ENV DEBIAN_FRONTEND=noninteractive ENV APT_GET_FLAGS="-y -q -o=Dpkg::Use-Pty=0" # Let's move the instructions that do NOT depend on Python version to the top, for the sake of better use of build cache RUN apt-get update $APT_GET_FLAGS RUN apt-get install $APT_GET_FLAGS gnupg wget RUN . /etc/os-release && echo "deb https://apt.repos.neuron.amazonaws.com ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/neuron.list RUN wget -qO- https://apt.repos.neuron.amazonaws.com/GPG-PUB-KEY-AMAZON-AWS-NEURON.PUB | apt-key add - RUN apt-get update $APT_GET_FLAGS RUN apt-get install $APT_GET_FLAGS aws-neuron-tools ENV PATH=$PATH:/opt/aws/neuron/bin RUN groupadd --gid=1000 cinnaroll RUN useradd --create-home --gid=1000 --uid=1000 --no-log-init foobar
Docker in a nutshell
Docker in a nutshell
sbt
"simple build tool" xD
In fact relatively (over)complicated, compared to Gradle
Still a better choice for building Scala than Gradle,
due to abundance of well-maintained plugins
and first-class support for Scala
sbt
sbt <module>/Docker/publish
Continuous Integration
Continuous Integration
Continuous Integration
Continuous Integration
Continuous Integration
Continuous Integration
Continuous Integration
Related: akka-serialization-helper
Kubernetes a nutshell
There needs to be quite a loooot of Docker containers in a modern app (think: backend, frontend, sometimes worker services, sometimes database(s))
Plus it would be nice to systematically define things like how many replicas are needed, what are the networking rules etc.
Kubernetes a nutshell
Kubernetes a nutshell
Kubernetes a nutshell
Kubernetes a nutshell
Kubernetes a nutshell
One of the most useful resources: Deployment
Specify number of replicas R,
and Deployment strives to always have R replicas of the given set of Docker containers ("Pod") around.
Kubernetes a nutshell
Binding between cluster nodes and Kubernetes pods
Making sure that the new cluster and old cluster are kept separate during a rollout of new version
Log collection
- Filebeat (collect)
- ElasticSearch (store)
- Kibana (lookup)
Observability
- Kamon (has support for Akka)
- Prometheus (database)
- Grafana (display)
Observability: kamon-akka
Observability: Grafana
Questions!
How to Ship Akka (and not only) to Production
By plipski
How to Ship Akka (and not only) to Production
- 380