Lightbend Orchestration is a suite of tools that helps you deploy Lagom applications to OpenShift and Kubernetes. The development status of Lightbend Orchestration is Incubating, and breaking changes are expected in the future.

In general, the theme of Lightbend Orchestration 1.7.1 is to remove unnecessary features to make the deployment leaner and more manageable.

How to upgrade to Lightbend Orchestration 1.7.1

Lightbend Orchestration 1.7.1 is based on Akka 2.5.20 and Akka Management 0.20.0, so you first need to upgrade to either Lagom 1.4.11, or override the Akka dependencies to 2.5.20 using the technique shown at the end of this post.

Note: there are breaking changes in Lightbend Orchestration 1.7.1. First upgrade sbt-reactive-app in all of your projects, and then upgrade reactive-cli (rp). This is because reactive-cli requires the minimum version of sbt-reactive-app to be 1.7.1.

sbt-reactive-app can be upgraded by bumping the version in your project/plugins.sbt:

addSbtPlugin("com.lightbend.rp" % "sbt-reactive-app" % "1.7.1")

On macOS for example, reactive-cli can be upgraded as follows:

brew upgrade lightbend/tools/reactive-cli

The following illustrations show the pieces included in Lightbend Orchestration’s build and runtime.

The remainder of this blog highlights changes you should be aware of and describes how to upgrade to Lightbend Orchestration 1.7.1.

Secure Docker image building with sbt-native-packager 1.3.18

For building Docker images, Lightbend Orchestration depends on sbt-native-packager, an sbt plugin maintained by Nepomuk "Muki" Seiler. To improve the security around file permissions and Red Hat OpenShift compatibility, Lightbend Tooling team has contributed a few enhancements to sbt-native-packager.

First, dockerPermissionStrategy was added to decide how file permissions are set for the working directory inside the Docker image. The default DockerPermissionStrategy.MultiStage strategy uses multi-stage Docker build to call chmod ahead of time. This avoids extra Docker layer overhead.

Next, dockerChmodType setting was added to specify what file permissions are set for the working directory. By default, it uses DockerChmodType.UserGroupReadExecute, which prevents the working directory to be writable. If you want your application to write a file, the following setting can be used to opt-in:

import com.typesafe.sbt.packager.docker.DockerChmodType
dockerChmodType := DockerChmodType.UserGroupWriteExecute

See sbt-native-packager 1.3.16 release note for more details.

YAML file generation for Akka Cluster Bootstrapping using Kubernetes API

The main feature of Lightbend Orchestration is the automatic generation of Kubernetes configuration (YAML) files.

For Akka Cluster Bootstrapping, Lightbend Orchestration generates YAML files using Kubernetes API as the discovery method. Starting with Lightbend Orchestration 1.7.1, we will use a specialized label akka.lightbend.com/service-name, which denotes the Akka Cluster to join when a pod comes up.

  • The value of the this label will default to either the app name or the app name + version depending on the deployment type.
  • Deployment pods are labeled with "akka.lightbend.com/service-name":
    "friendimpl"
    etc.
  • You can override the label selector as follows:
    -Dakka.discovery.kubernetes-api.pod-label-selector=akka.lightbend.com/service-name=%s (as opposed to using app=%s).
  • You can override the effective name as follows:
    -Dakka.management.cluster.bootstrap.contact-point-discovery.effective-name=friendimpl etc.

YAML file generation: Removal of automatic port assignment

Previous releases of Lightbend Orchestration automatically assigned various port numbers from port 10000—in part by overriding your application.config file. Lightbend Orchestration 1.7.1 removes this feature, and respects the port number declared in your application.config. Otherwise, default port numbers will be used such as port 9000 for Play. This allows us to remove RP_ENDPOINT_* environment variables, greatly simplifying the generated YAML file.

This also means that your deployed service will expose different port numbers (for example 9000) instead of 10000.

YAML file generation for Akka Cluster Bootstrapping using DNS

Optionally, Lightbend Orchestration 1.7.1 adds experimental support to generate Kubernetes configuration for Akka Cluster Bootstrapping using DNS as the discovery method.

If you want to use DNS, pass --discovery-method=akka-dns to the rp command line. cli#195

Rename of sbt-reactive-app key names

All key names are renamed to prefix with rp and camel cased to comply with the Plugins Best Practices. For instance, the endpoints setting will now be rpEndpoints, and the deploy task will be rpDeploy. The old key names are deprecated and will be removed in the future. sbt-reactive-app#145

Deprecation of SecretReader

In the effort to reduce runtime dependencies, SecretReader was deprecated. Read from the file /rp/secrets/%name%/%key% where %name% is transformed to lowercase, and - for non-alphanum instead. lib#118

Other bug fix

  • Fixes missing protocol when UDP endpoint is selected. cli#196

How to align versions for all Akka modules

Save the following as project/OverrideAkkaPlugin.scala to align versions for all Akka modules.


package example

import sbt._
import sbt.Keys._

object OverrideAkkaPlugin extends AutoPlugin {
  override def requires = 
com.lightbend.rp.sbtreactiveapp.SbtReactiveAppPlugin
  override def trigger = allRequirements
  def akkaVersion = "2.5.20"
  override val projectSettings = Seq(
    dependencyOverrides ++= Seq(
      "com.typesafe.akka" %% "akka-actor"              % akkaVersion,
      "com.typesafe.akka" %% "akka-agent"              % akkaVersion,
      "com.typesafe.akka" %% "akka-camel"              % akkaVersion,
      "com.typesafe.akka" %% "akka-cluster"            % akkaVersion,
      "com.typesafe.akka" %% "akka-cluster-metrics"    % akkaVersion,
      "com.typesafe.akka" %% "akka-cluster-sharding"   % akkaVersion,
      "com.typesafe.akka" %% "akka-cluster-tools"      % akkaVersion,
      "com.typesafe.akka" %% "akka-discovery"          % akkaVersion,
      "com.typesafe.akka" %% "akka-distributed-data"   % akkaVersion,
      "com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion,
      "com.typesafe.akka" %% "akka-osgi"               % akkaVersion,
      "com.typesafe.akka" %% "akka-persistence"        % akkaVersion,
      "com.typesafe.akka" %% "akka-persistence-query"  % akkaVersion,
      "com.typesafe.akka" %% "akka-protobuf"           % akkaVersion,
      "com.typesafe.akka" %% "akka-remote"             % akkaVersion,
      "com.typesafe.akka" %% "akka-slf4j"              % akkaVersion,
      "com.typesafe.akka" %% "akka-stream"             % akkaVersion,
      "com.typesafe.akka" %% "akka-stream-testkit"     % akkaVersion,
      "com.typesafe.akka" %% "akka-testkit"            % akkaVersion
    )
  )
}

Thanks for reading, and feel free to visit our Discussion Forums if you have questions or comments!

 

Share



Comments


View All Posts or Filter By Tag


Questions?