Friday, January 19, 2018

docker weblogic

https://hub.docker.com/r/ismaleiva90/weblogic12/

docker pull ismaleiva90/weblogic12
docker run -d --name myweblogic -p 49163:7001 -p 49164:7002 -p 49165:5556 ismaleiva90/weblogic12:latest
http://localhost:49163/console
User: weblogic
Pass: welcome1

exit ( go back to host )

generate a basic WAR:

mvn archetype:generate -DgroupId=com.mkyong -DartifactId=pippoWebApp -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false


docker cp ./pippoWebApp/target/pippoWebApp.war myweblogic:/u01/oracle/weblogic/user_projects/domains/base_domain


then you have to manually deploy (copying to autodeploy doesn't work, this domain has PRODUCTION mode enabled)

http://localhost:7001/pippoWebApp/

See also http://www.javamonamour.org/2015/04/weblogic-deployment-with-docker.html


To get the image from Oracle itself:

https://blogs.oracle.com/weblogicserver/weblogic-server-certification-on-kubernetes

https://github.com/oracle/docker-images/tree/master/OracleWebLogic


git clone https://github.com/oracle/docker-images.git
cd docker-images/OracleWebLogic/dockerfiles

first you should download the JAr files and scp them here (this really sucks.... why not just curl them in place from a repository...)

./buildDockerImage.sh -v 12.2.1.3 -d -c







Thursday, January 18, 2018

R support in Sonatype Nexus 3.7

What is R ? https://www.r-project.org/about.html but even better https://en.wikipedia.org/wiki/R_(programming_language)

What is CRAN ? https://cran.r-project.org/ and https://en.wikipedia.org/wiki/R_(programming_language)#CRAN

"A core set of packages is included with the installation of R, with more than 11,000 additional packages (as of July 2017) available at the Comprehensive R Archive Network (CRAN), Bioconductor, Omegahat, GitHub, and other repositories."



https://github.com/sonatype-nexus-community/nexus-repository-r

git clone https://github.com/sonatype-nexus-community/nexus-repository-r.git
cd nexus-repository-r/
mvn clean install

ls target/nexus-repository-r-1.0.0.jar

docker run -d -p 8081:8081 --name nexus sonatype/nexus3
6f49bdc956a6
docker cp nexus-repository-r-1.0.0.jar 6f49bdc956a6:/opt/sonatype/nexus/system/org/sonatype/nexus/plugins/


docker exec -u 0 -ti 6f49bdc956a6 /bin/bash
stty rows 50 cols 132
cd /opt/sonatype/nexus/system/org/sonatype/nexus/plugins/
mkdir -p nexus-repository-r/1.0.0/
mv nexus-repository-r-1.0.0.jar nexus-repository-r/1.0.0/

vi /opt/sonatype/nexus/system/com/sonatype/nexus/assemblies/nexus-oss-feature/3.7.1-02/nexus-oss-feature-3.7.1-02-features.xml

customize the file as per https://github.com/sonatype-nexus-community/nexus-repository-r chapter "(most) Permanent Install" (careful! you must add 2 separate sections in the XML file! Nexus stinks, they should provide a CLI to manage plugins, instead of asking you to manually manipulate the XML )

docker stop 6f49bdc956a6
docker start 6f49bdc956a6

when you create a new repository, you should now see the r (group) r (hosted) and r (proxy) types









Tuesday, January 16, 2018

the Docker book by James Turnbull



The books - although a bit outdated - is still excellent, very practical, hands-on and detailed.



dial tcp lookup index.docker.io connection refused

I was trying to

docker run -d -p 8081:8081 --name nexus sonatype/nexus3

and I got the scary error "dial tcp lookup index.docker.io connection refused"

googling around, they suggest to "reset the docker settings to factory defaults." .
Everybody keeps repeating this mantra "reset to factory defaults" but nobody explains how to do it on Linux. I hate it. So I could not figure out what to do. iptables -F didn't work.

Someone mentions to add index.docker.io to the /etc/hosts file because the DNS playing tricks and truncate.. scary....

Eventually I rebooted the machine and it all works again. I only wish that Docker Inc stopped playing with docker and kept it stable. I hate them. They are destroying a great product.

Thursday, January 11, 2018

Itinerary to visit Italy

See also my http://www.javamonamour.org/2012/08/itinerary-to-visit-rome.html

Everybody goes to Venice, Florence, Pompei and Rome, so I will not cover them. But there are many more astounding places in Italy.

Disclaimer: I am an archeology bug, so I like mostly ancient ruins. The most amazing places I have seen in Italy are:

Paestum https://en.wikipedia.org/wiki/Paestum - don't miss the museum with amazing frescoes

Agrigento Temple Valley https://en.wikipedia.org/wiki/Valle_dei_Templi , greek stuff, awesome

Cerveteri https://en.wikipedia.org/wiki/Cerveteri absolutely amazing Etruscan cemetery

Herculaneum https://en.wikipedia.org/wiki/Herculaneum

Napoli https://en.wikipedia.org/wiki/Assisi and the islands (Ischia, Capri) and the Vesuvio volcano - beware, Napoli is a bit rough, watch your wallet, same thing in Roma.

Ostia Antica https://en.wikipedia.org/wiki/Ostia_Antica

Bologna https://en.wikipedia.org/wiki/Bologna with his medieval center and the Towers (no VERY ancient stuff here)

Ravenna https://en.wikipedia.org/wiki/Ravenna the Italian Bisantium

Ferrara https://en.wikipedia.org/wiki/Ferrara rich of middleage history

Verona https://en.wikipedia.org/wiki/Verona with its Arena (roman) and medieval center

Siena and its middle age palaces https://en.wikipedia.org/wiki/Siena

Assisi https://en.wikipedia.org/wiki/Assisi magic atmosphere with white houses and churches

Palermo https://en.wikipedia.org/wiki/Palermo and its main old palaces

I am aware of the beauty of Lucca, Lecce but I was never there.




Wednesday, January 10, 2018

Encrypting stuff with Openssl

Let's first encode base64 the password:

echo -n "pippo" | openssl enc -base64
cGlwcG8=


man echo says: "-n do not output the trailing newline"


This is equivalent to

echo -n "pippo" | base64
cGlwcG8=

You can then decode with "base64 -decode" :

echo -n "pippo" | base64 | base64 --decode
pippo


or with "openssl enc -base64 -d":

echo -n "pippo" | openssl enc -base64 | openssl enc -base64 -d
pippo


If you want to encrypt with a salt:

openssl aes-256-cbc -in mypw.txt -out mypwenc.txt -e -pass pass:pluto

and to decrypt:

openssl aes-256-cbc -in mypwenc.txt -out mypwclear.txt -d -pass pass:pluto

Details on the openssl command options are here https://wiki.openssl.org/index.php/Manual:Openssl(1)


You can always check here https://encode-decode.com/aes-256-ofb-encrypt-online/



Jenkins blueocean plugin with Docker

https://jenkins.io/doc/book/blueocean/getting-started/ and here the Docker installation instructions https://jenkins.io/doc/book/installing/#docker

Here all the Docker images https://hub.docker.com/r/jenkinsci/blueocean/tags/


Then I run this:

( http://devdocs.io/docker~1.12/engine/reference/commandline/run/index I am using DOcker 1.12 )

docker run -u root -d -p 8080:8080 -v jenkins-data:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkinsci/blueocean

(I had to remove --rm otherwise I get Conflicting options: --rm and -d )

docker ps gives you the containerid -> docker exec -ti 03e820715e74 bash

cat /var/jenkins_home/secrets/initialAdminPassword
copy and paste in localhost:8080 to unlock Jenkins






Saturday, January 6, 2018

Google maps Java API

The Google MAPS main page is here https://developers.google.com/maps/

Entry point for Java API is: https://googlemaps.github.io/google-maps-services-java/v0.2.5/javadoc/com/google/maps/GeoApiContext.html


The GIT repo is https://github.com/googlemaps/google-maps-services-java

Nice presentation, but tutorial link is broken





https://developers.google.com/maps/documentation/javascript/adding-a-google-map

Essential: KML specifications https://developers.google.com/kml/documentation/kml_tut

Witches' Sabbath with yum install and docker

After a major CentOS update, when I "oc cluster up" I get this:

Error: Minor number must not contain leading zeroes "01"

the usual "docker version mismatch" issue (go to hell OpenShift)

So I "yum install docker" and I get this:

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.spreitzer.ch
* epel: ftp.nluug.nl
* extras: mirror.spreitzer.ch
* ius: mirror.amsiohosting.net
* updates: mirror.spreitzer.ch
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 2:1.12.6-68.gitec8512b.el7.centos will be installed
--> Processing Dependency: docker-common = 2:1.12.6-68.gitec8512b.el7.centos for package: 2:docker-1.12.6-68.gitec8512b.el7.centos.x86_64
--> Processing Dependency: docker-client = 2:1.12.6-68.gitec8512b.el7.centos for package: 2:docker-1.12.6-68.gitec8512b.el7.centos.x86_64
--> Running transaction check
---> Package docker-client.x86_64 2:1.12.6-68.gitec8512b.el7.centos will be installed
---> Package docker-common.x86_64 2:1.12.6-68.gitec8512b.el7.centos will be installed
--> Processing Conflict: docker-ce-18.01.0.ce-0.1.rc1.el7.centos.x86_64 conflicts docker
--> Processing Conflict: docker-ce-18.01.0.ce-0.1.rc1.el7.centos.x86_64 conflicts docker-io
--> Finished Dependency Resolution
Error: docker-ce conflicts with 2:docker-1.12.6-68.gitec8512b.el7.centos.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest






I try "yum install docker --skip-broken" but I still get

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.spreitzer.ch
* epel: ftp.nluug.nl
* extras: mirror.spreitzer.ch
* ius: mirror.amsiohosting.net
* updates: mirror.spreitzer.ch
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 2:1.12.6-68.gitec8512b.el7.centos will be installed
--> Processing Dependency: docker-common = 2:1.12.6-68.gitec8512b.el7.centos for package: 2:docker-1.12.6-68.gitec8512b.el7.centos.x86_64
--> Processing Dependency: docker-client = 2:1.12.6-68.gitec8512b.el7.centos for package: 2:docker-1.12.6-68.gitec8512b.el7.centos.x86_64
--> Running transaction check
---> Package docker-client.x86_64 2:1.12.6-68.gitec8512b.el7.centos will be installed
---> Package docker-common.x86_64 2:1.12.6-68.gitec8512b.el7.centos will be installed
--> Processing Conflict: docker-ce-18.01.0.ce-0.1.rc1.el7.centos.x86_64 conflicts docker
--> Processing Conflict: docker-ce-18.01.0.ce-0.1.rc1.el7.centos.x86_64 conflicts docker-io
extras/7/x86_64/filelists_db | 528 kB 00:00:00

Packages skipped because of dependency problems:
2:docker-1.12.6-68.gitec8512b.el7.centos.x86_64 from extras
2:docker-client-1.12.6-68.gitec8512b.el7.centos.x86_64 from extras
2:docker-common-1.12.6-68.gitec8512b.el7.centos.x86_64 from extras



Then I do yum list installed | grep docker

docker-ce.x86_64 18.01.0.ce-0.1.rc1.el7.centos @docker-ce-test

then "yum remove docker-ce.x86_64" and "yum install docker"


Installed:
docker.x86_64 2:1.12.6-68.gitec8512b.el7.centos

Dependency Installed:
docker-client.x86_64 2:1.12.6-68.gitec8512b.el7.centos docker-common.x86_64 2:1.12.6-68.gitec8512b.el7.centos



and everything works again.


I used to love Docker, but since it was split in CE and EE they messed really hard. Too much greed for money and need to place expensive consultants.

List of useful yum commands: https://www.thegeekstuff.com/2011/08/yum-command-examples/

yum install bla
yum -y install bla
yum remove bla
yum update bla
yum search bla
yum info bla
yum list
yum list installed
#this to find which package a file belongs to
yum provides filename

yum grouplist
yum groupinstall 'bla'
yum groupupdate 'bla'
yum groupremove 'bla'

yum repolist
yum repolist all
yum --enablerepo=fedora-source install vim-X11.x86_64



Friday, January 5, 2018

CentOS install JDK

which java
java -version
ls -ltr /usr/bin/java
ls -ltr /etc/alternatives/java


sudo yum update

yum list installed | grep "java"

sudo yum install java-1.8.0-openjdk-devel

cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-5.b12.el7_4.x86_64/

sudo ln -sf /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-5.b12.el7_4.x86_64/bin/java /etc/alternatives/java





Gnome hotcorner: most annoying unwanted feature ever

I have moved away from Windows because I was really fed up with Microsoft. Installed Centos with Gnome. To discover that Gnome is even worse!

If by mistake you put the mouse on the screen border, all your open windows stack up and you are forced to click back on a thumbnail to resume work.

And apparently, after 20 minutes googling, there is no easy way to disable this unasked-for, unwanted trollish feature.

Even in Applications/Utilities/Tweak tools I could not find an option to disable this stupid crap.

YAGNI: you will never need this stupid trick, then why enabling it by default? I simply hate UIs overloaded with hidden features..... KEEP IT SIMPLE !



Tuesday, January 2, 2018

Linux misc (iptables, dig, rpm)

echo $LANG
en_US.UTF-8

CTRL-SHIFT-U allows you to enter the 4 letters for a Unicode character (eg 03bb is greek lambda)

localectl

System Locale: LANG=en_US.UTF-8
VC Keymap: it
X11 Layout: it,us
X11 Variant: ,

to change locale:
localectl set-locale LANG=fr_FR.utf8

cat /etc/locale.conf
LANG="en_US.UTF-8"

list all available language packs:
yum langavailable

list installed language packs:
yum langlist


iptables tutorial instructions: https://www.howtogeek.com/177621/the-beginners-guide-to-iptables-the-linux-firewall/

sudo iptables -L -v
sudo iptables -F
sudo cat /etc/sysconfig/iptables


network:
dig
systemctl status firewalld
systemctl status NetworkManager



history: remove line numbers by adding to .bash_profile
HISTTIMEFORMAT="$(echo -e '\r\e[K')"

#rpm list all packages
rpm -qa | grep ansible
#this installs 1.1 without removing 1.0 if exists
rpm -ivh some-package-1.1
#this updates (if existing) 1.0 to 1.1
rpm -Uvh some-package-1.1