Wednesday, January 23, 2019

Minikube on Centos

I want to have a "mini" version of Kubernetes on my Centos laptop.

I would prefer not to install an Hypervisor, since k8s can use "--vm-driver=none"...
but I give it a try to install VirtualBox

After installing VirtualBox, I can proceed with minikube

curl -Lo minikube \
&& chmod +x minikube

sudo cp minikube /usr/local/bin && rm minikube

minikube version
minikube version: v0.33.1

minikube start

I get "Error parsing version semver: Version string empty"

kubectl cluster-info
kubectl get nodes

I can try also with "minikube start --vm-driver=none", which however requires docker

Saturday, January 19, 2019

Coding and cooking


Friday, January 18, 2019

Running Centos on Windows

once you have upgraded to Windows PRO, you can install Docker for Windows

Then open your Git Bash shell and run:

winpty docker run --name centos -i -t -d centos

If the container is stopped, you can simply

docker start centos

and login again:

winpty docker exec -ti centos bash

So you can have a "REAL" Centos on Windows... cool...

VirtualBox and Hyper-V on Windows 10 PRO

I have recently installed Windows PRO. During installation of Hyper-V, it duly warns you that you will no longer be able to use VirtualBox. Which is true, because when I start a VM in VirtualBOx I get the message:

WHvCapabilityCodeHypervisorPresent is FALSE! Make sure you have enabled the 'Windows Hypervisor Platform' feature. (VERR_NEM_NOT_AVAILABLE).
VT-x is not available (VERR_VMX_NO_VMX).

Apparently all you need to do to re-enable VirtualBox is:

open CMD as Administrator
bcdedit /set hypervisorlaunchtype off

reboot your machine

To restore Hyper-V you simply run:
bcdedit /set hypervisorlaunchtype on

I haven't tested yet but it should work IMHO

bcdedit is this

Windows Boot Manager
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume2
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  fr-FR
inherit                 {globalsettings}
badmemoryaccess         Yes
default                 {current}
resumeobject            {b32f6aed-59a4-11e8-b3f7-b9390bbf0244}
displayorder            {current}
toolsdisplayorder       {memdiag}
timeout                 30

Windows Boot Loader
identifier              {current}
device                  partition=C:
path                    \WINDOWS\system32\winload.efi
description             Windows 10
locale                  fr-FR
inherit                 {bootloadersettings}
recoverysequence        {b32f6aef-59a4-11e8-b3f7-b9390bbf0244}
displaymessageoverride  Recovery
recoveryenabled         Yes
badmemoryaccess         Yes
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \WINDOWS
resumeobject            {b32f6aed-59a4-11e8-b3f7-b9390bbf0244}
nx                      OptIn
bootmenupolicy          Standard
hypervisorlaunchtype    Auto

Wednesday, January 16, 2019

Installing spring boot CLI and spring cloud on centos


vi .bash_profile

export SPRING_HOME=/home/centos/spring-2.1.2.RELEASE/
export PATH

to test, type:

spring version

Spring CLI v2.1.2.RELEASE

See also

vi app.groovy

class WebApplication {

String home() {
"Hello World!"


spring run app.groovy
curl http://localhost:8080/

Now you can install Spring Cloud:

spring install

spring cloud configserver

I get

Caused by: java.lang.NoSuchMethodError:$LauncherOptionHandler.option(Ljava/util/Collection;Ljava/lang/String;)Ljoptsimple/OptionSpecBuilder;

see here

If I install an older version of Spring CLI, it works:

More information on the Spring Cloud command here

Tuesday, January 15, 2019

WELD is a holy piece of crap

All of a sudden I get this, and the HTML page is basically blank

2019-01-14 16:21:54,369 WARN [org.jboss.weld.Servlet] (http-/ WELD-000714 HttpContextLifecycle guard leak detected. The Servlet container is not fully compliant. The value was 1
2019-01-14 16:21:54,370 WARN [org.jboss.weld.Context] (http-/ WELD-000223 Bean store leak was detected during org.jboss.weld.context.http.HttpRequestContextImpl association: org.apache.catalina.connector.RequestFacade@6da1f69f
2019-01-14 16:21:54,371 WARN [org.jboss.weld.Context] (http-/ WELD-000223 Bean store leak was detected during org.jboss.weld.context.http.HttpSessionContextImpl association: org.apache.catalina.connector.RequestFacade@6da1f69f

I am just using some javax.inject.Inject and javax.ejb.Stateless annotations.

After undoing all and redoing one step at a time, it all works.

I have enabled weld logging in standalone.xml

<logger category="org.jboss.weld"><level name="DEBUG"/></logger>

but this doesn't help much.

THey say one should hook in the BeanManager to examine its content, but I find this unpractical.
They should really provide a managemen/monitoring console, like the /beans endpoint in SpringBoot.

Once more, Java EE proves to be inferior to Spring.

Wednesday, January 9, 2019

apache httpd on centos

sudo yum install httpd mod_ssl
systemctl status httpd
systemctl start httpd
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
systemctl status httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2018-04-28 02:58:49 CEST; 12s ago
     Docs: man:httpd(8)
  Process: 25955 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 25951 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 25951 (code=exited, status=1/FAILURE)

sudo su -
cd /var/log/httpd/
less error_log

[Sat Apr 28 02:58:49.199587 2018] [core:notice] [pid 25951] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Sat Apr 28 02:58:49.222124 2018] [suexec:notice] [pid 25951] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sat Apr 28 02:58:49.223152 2018] [ssl:emerg] [pid 25951] (13)Permission denied: AH02201: Init: Can't open server certificate file /home/centos/myapp/mysitename.crt
[Sat Apr 28 02:58:49.223168 2018] [ssl:emerg] [pid 25951] AH02312: Fatal error initialising mod_ssl, exiting.

less /etc/httpd/conf/httpd.conf

<VirtualHost *:443>
  DocumentRoot /var/www/website
  SSLEngine on
  SSLCertificateFile "/home/centos/myapp/mysitename.crt"
  SSLCertificateKeyFile "/home/centos/myapp/mysitename.key"

sudo /usr/sbin/httpd -S
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:443                  is a NameVirtualHost
         default server (/etc/httpd/conf/httpd.conf:107)
         port 443 namevhost (/etc/httpd/conf/httpd.conf:107)
         port 443 namevhost localhost.localdomain (/etc/httpd/conf.d/ssl.conf:56)
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex default: dir="/run/httpd/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex ssl-cache: using_defaults
PidFile: "/run/httpd/"
User: name="apache" id=48
Group: name="apache" id=48

See also

Friday, January 4, 2019

jcmd GC.heap_dump File exists

The instructions here say:

Create a heap dump (hprof dump)

jcmd GC.heap_dump filename=Myheapdump

This is wrong. First, you need a PID; second, you should not provide filename=bla but simply bla:

Correct example:

/usr/lib/jvm/java-openjdk/bin/jcmd 50513 GC.heap_dump /u01/users/admrun/nexus3_02.hprof

if you run simply

/usr/lib/jvm/java-openjdk/bin/jcmd 50513 GC.heap_dump filename=bla.hprof

it doesn't create a bla.hprof but rather a "filename" file.... and the second time you run it you get a "File exists" message.

Confusing and frustrating!