Kubernetes and GlusterFS

In this Blog I will explain how to install a distributed filesystem on a kubernetes cluster. To run stateful docker images (e.g. a Database like PostgreSQL) you have two choices.

  • run the service on a dedicated node – this avoids the lost of data if kubernetes re-schedules your server to another node
  • use a distributed storage solution like ceph or glusterfs storage

Gluster is a scalable network filesystem. This allows you to create a large, distributed storage solution on common hard ware. You can connect a gluster storage to Kubernetes to abstract the volume from your services. 

Continue reading “Kubernetes and GlusterFS”

Howto Install Ceph on CentOS 7

In this blog I will explain how to install the Ceph storage system on CentOS. In my previous blog I showed how to install ceph on Debian. But the newer version of ceph are not supported by Debian and Ceph is much better supported by CentOS because RedHat maintains both CentOS and Ceph.

In this blog I will install Ceph ‘Nautilus’ on CentOS 7. You will find detailed information about ceph and the installation process for nautilus release here.

Continue reading “Howto Install Ceph on CentOS 7”

Kubernetes – Storage Volumes with Ceph

In this blog I show how to setup a Kubernetes Storage Volume with Ceph. I assume that you have installed already a kubernetes cluster with one master-node and at least three worker-nodes. On each worker node you need a free unmounted device used exclusively for ceph. Within the ceph cluster I setup a Ceph Filesystem (CephFS) that we can use as a storage volume for kubernetes.

Continue reading “Kubernetes – Storage Volumes with Ceph”

Kubernetes – Setup Traefik 2.1

In my last blog about Traefik I showed how you can setup Traefik version 1.7 in a Kubernetes cluster. In this blog I will explain how to use the latest version 2.1 of Traefik. Version 2.x Traefik implements some new concepts and need of course a different setup. This blog post assumes that you have already an up and running Kubernetes master node and at lease one worker node. See also my Blog ‘From docker-swarm to kubernetes. You can find also detailed information in the official traefik website. A helpful tutorial can also be found here.

Continue reading “Kubernetes – Setup Traefik 2.1”

Kubernetes – Setup Traefik 1.7

In my last blog I showed how you can setup a Kubernets cluster by your own. If your cluster is running in the internet you need some kind of load balancer to access your apps from outside. Traefik is a popular load balancer and reverse-proxy service useful also in a KUbernetes cluster. This tutorial is based on Traefik 1.7 and assumes that you have already an up and running Kubernetes master node and at lease one worker node. You can find also detailed information in the official traefik website.

Continue reading “Kubernetes – Setup Traefik 1.7”

Payara – How To Set Loglevels

Running payara server for test or production requires sometimes more details about the running services. In this case you can increase the log level for a java-package or a single java class.

First you need to log into the server and run the asadmin command:

$ cd ~/appserver/glassfish/bin
$ asadmin

Next you can list the current loggers:

asadmin> list-log-levels
Enter admin password for user "admin"> 
ShoalLogger    
com.hazelcast    
com.sun.enterprise.server.logging.GFFileHandler    
com.sun.enterprise.server.logging.SyslogHandler    
.......

To set a specific log level run

set-log-levels com.foo.MyService=FINEST

And don’t forget to disable the log level after debugging 😉

Payara Micro with Custom Configuration

This is a short guideline how to create a payara-micro Docker container with a custom configuration. A custom configuration is needed if you want to configure application server resources like database pools, mail resources or other stuff needed by your application.

1) Downlaod the payara-micro.jar

First you need to download the payara-mciro jar. Go the the official payara download page: https://www.payara.fish/software/downloads/

2) Copy the domain.xml

Next you can inspect the jar file and copy the domain.xml from the config directory

/MICRO-INF/doman/domain.xml

Now you can customize the domain.xml as needed by your project. The configuration is identically to payara-full so you can add all additional resources and configuration. For example you can add a custom data pool configuration into the resources section of the domain.xml.

3) Create a Dockerfile

Now you can create your custom Dockerfile. Payara-micro can be configured with launch options in several ways. One of them allows you to define a custom location of your configuration and domain.xml files. See the following example:

FROM payara/micro
USER root
# create a custom config folder
RUN mkdir ${PAYARA_HOME}/config
COPY domain.xml ${PAYARA_HOME}/config/
COPY postgresql-42.2.5.jar ${PAYARA_HOME}/config
RUN chown -R payara:payara ${PAYARA_HOME}/config
USER payara
WORKDIR ${PAYARA_HOME}
# Deploy artefacts
COPY my-app.war $DEPLOY_DIR
CMD ["--addLibs","/opt/payara/config/postgresql-42.2.5.jar", "--deploymentDir", "/opt/payara/deployments", "--rootDir", "/opt/payara/config","--domainConfig", "/opt/payara/config/domain.xml"]]

In this Dockerfile derived from the official payra/micro I create a new config/ folder to copy the jdbc-driver and the domain.xml.

The CMD option is important here. I added the following custom settings:

  • –addLibs – adds the postgresql jdbc driver
  • –deploymentDir – set the default deployment directory
  • –rootDir set the configuration directory to our new /opt/payara/config/ folder
  • –domainConfig – define the location of the custom domain.xml

With the CMD option –rootDir you can specify what directory Payara Micro should use as its new domain directory. Adding files to this directory will replicate the behavior of a Payara Server’s domain configuration. Payara-Micro automatically copies the folder with configuration files we do not specified explicitly. So at the end the folder contains all necessary configuation.

The CMD option –domainConfig is necessary. Otherwise payara-micro will ignore your custom domain.xml . More information which options can be added can be found here.

4) Build and Launch your Custom Docker Image

Finally you can now build your custom Docker image…

$ docker build --tag=my-custom-payara-micro .

…and start your docker container:

$ docker build --tag=my-custom-payara-micro .

Now you launched (hopefully without errors your custom payara-micro). I hope this helps you to get started with payara-micro and docker.

From Docker-Swarm to Kubernetes – the Easy Way!

In this blog I would like to give you a short introduction and installation guide for kubernetes.

I worked for years with Docker, Docker-Compose and Docker Swarm. I tried to switch to this ‘common standard’ kubernetes. But to be honest, I’ve always failed in the complexity of kubernetes and given up in frustration. I ask my self – why is kubernetes so complex? The short answer: it is not.

Continue reading “From Docker-Swarm to Kubernetes – the Easy Way!”

Payara Autodeploy with the Eclipse Manik Plugin

Manik-Hot-Deploy is a plugin for the Eclipse IDE which brings auto-deploy and hot-deploy functionallity to the development of web applications. The plugin is Open Source and supports Glassfish, Payara, JBoss, Wildfly and other application servers.

With the latest Release 1.0.6 the plugin improves the Payara Autodeploy support. The new version provides a setting for the target folder with a default setting for maven projects.

To enable the autodeploy feature for Payara you also have to set ‘autodeploy-enabled=true in the ‘das-config’ section of the domain.xml file.

<das-config dynamic-reload-enabled="true" autodeploy-enabled="true"></das-config>

Also hot-deployment is supported for Payara, Wildfly and other application servers. Find the full details on the Wikipage on Github.