Skip to content

Instantly share code, notes, and snippets.

View sample-log4r.R
# Package for Log4R
library("log4r")
# Default Logger
default_logger <- logger()
# Debug level enabled Logger (by default DEBUG level is suppressed)
debug_logger <- logger("DEBUG")
# File Logger
View lagom-k8s-app-apply.sh
# Apply configuration
kubectl create -f lagom-k8s-app.yaml
View lagom-k8s-app.yaml
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: menu
labels:
app: menu
spec:
replicas: 1
template:
View lagom-k8s-apply-rbac.sh
# Create RBAC
kubectl create -f lagom-on-k8s-rbac.yaml
View lagom-on-k8s-rbac.yaml
---
#
# Create a role, `pod-reader`, that can list pods and
# bind the default service account in the `default` namespace
# to that role.
#
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
View lagom-k8s-build-docker-image.sh
# Build Docker Image
eval $(minikube docker-env)
mvn clean package docker:build -P kubernetes
View start-minikube.sh
# Start Minikube
(minikube delete || true) &>/dev/null && minikube start --memory 2048 && eval $(minikube docker-env)
View lagom-k8s-module.java
package com.knoldus.lagom.sample.restaurant.menu.impl;
import akka.actor.ActorSystem;
import akka.management.AkkaManagement$;
import akka.management.cluster.bootstrap.ClusterBootstrap$;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.knoldus.lagom.sample.restaurant.menu.api.MenuService;
import com.lightbend.lagom.javadsl.server.ServiceGuiceSupport;
import com.typesafe.config.Config;
View lagom-kubernetes.conf
play {
akka.actor-system = menu
modules.enabled += com.knoldus.lagom.sample.restaurant.menu.impl.MenuModule
http.secret.key = none
}
lagom.persistence.ask-timeout = 10s
View lagom-reactive-lib-pom.xml
<!-- for reactive-lib kubernetes api -->
<dependency>
<groupId>com.lightbend.lagom</groupId>
<artifactId>api-tools_2.12</artifactId>
<version>1.4.8</version>
</dependency>
<dependency>
<groupId>com.lightbend.rp</groupId>
<artifactId>reactive-lib-akka-cluster-bootstrap_2.12</artifactId>
<version>0.9.2</version>