13 July 2017

weblogic part 1 - installation

in this article i want to talk about oracle and weblogic.

there are some information from oracle available and also some git repo's with sample dockerfiles. anyway it does not come out of the box.


at the present time there are 3 options for setting up and running oracle weblogic (developer workstation)

1. download the full installer from oracle
2. build and run a docker image
3. pull a pre-defined image from docker store

since i want to know what the image is doing (approach 3 lacks of documentation) and i want to keep my system clear and stuff separated i choose approach 2.

the sample docker files from oracle are on github

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


from the readme i get the information that these dockerfiles can be used for building from scratch and/or use the buildDockerImage.sh script which assist to set up an image with default parameters

after a quick look into the Dockerfile.developer i went to oracle's website and downloaded the quick installer (as described in the dockerfile, the server jre is by the way not required anymore since there is a base docker image for that). this zip file i have to put in the same directory as the dockerfile


since oracle moved around their software on docker (https://blogs.oracle.com/developers/official-docker-image-for-oracle-java-and-the-openjdk-roadmap-for-containers) i had to change the dockerfile a little bit

   FROM store/oracle/serverjre:8
   EXPOSE 7001 

note:
there is also a git repo available containing this sample - see end of this article :-)


after that i have to acquire the server jre first in docker store (its free of charge) and login to docker store with

   docker login


then i have to enter my login data and build the docker file with

   docker build -t mywls -f Dockerfile.developer .

(important: the dot at the end of the line!!!)


this will take some time



to start the image with the dockerfile defaults enter

   docker run -d -e ADMIN_USERNAME=weblogic -e ADMIN_PASSWORD=welcome1 -e DOMAIN_HOME=/u01/oracle/user_projects/domains/abc_domain -e DOMAIN_NAME=abc_domain {your-image-id}


then follow the logs and enter

   docker logs -f {your-container-id}


this will look like



important:
check the logfile for the password (in my case it is welcome1)


get the admin console ip adress

   docker inspect --format '{{.NetworkSettings.IPAddress}}'
{your-container-id}


in my case this returns 172.17.0.2

then open firefox with the following 

   http://172.17.0.2:7001/console


the admin console is then deployed the first time - what will take some time. after that it will look like. (after login in with weblogic/welcome1)



the sample docker file is on github

   https://github.com/kr-g/oracle-weblogic/tree/master/weblogic-docker-from-scratch



that's all.


external references:

https://docs.oracle.com/middleware/12212/wls/DOCKR/overvew.htm



6 June 2017

angular 2 - part 3

todays article is regarding e2e (end-2-end) testing inside the container with protractor and the bootstrap-angular sample

since the docker container has no "screen" or "monitor" we have to do headless testing inside the running docker container


in principle this can be done by using chrome and xfvb and the docker container (as described in my former article), add it with
  
   docker exec -it ngquickstart /bin/bash
   yum install -y chromium xorg-x11-server-Xvfb


or pull the latest docker image and run a new container

   docker pull
anothersoftwaredevelopmentblog/angular-bootstrap-quickstart


then run a headless e2e test inside the container with a virtual x11 framebuffer (xvfb) by

   Xvfb :9 >& /dev/null &
   DISPLAY=:9  npm run e2e


the output will look like



important:

actual there are some limitations with selenium webdriver and chrome as well as firefox (see bug references below and workaround hints there) and upcoming new features with chrome (see external reference regarding headless flag) so its required to do some manual steps to get it working. since this blog does not deal with solving that sort of problems the workaround is _not_ included in the docker image (sorry for that, but as soon the fix becomes available in the official package to the public it will also come out of the box when updating with yum/npm)


the source is available on github and docker hub

   https://github.com/kr-g/angular-bootstrap-quickstart/tree/master/docker

   https://hub.docker.com/r/anothersoftwaredevelopmentblog/angular-bootstrap-quickstart/




that's all



external references:

https://developers.google.com/web/updates/2017/04/headless-chrome




bug references:

https://github.com/angular/angular-cli/issues/5019
https://github.com/angular/protractor/issues/4253



25 May 2017

angular 2 - part 2


after setting up the development system for angular2 in my former article this article describes how to use the container for development with a project stored outside of the docker container on the local harddrive


first set up your local files (outside of the docker container ). as a base get the demo skeleton from github

   mkdir -p ~/repo/
   cd $_
   git clone https://github.com/kr-g/angular-bootstrap-quickstart.git


then start the development container with


   docker run -d -p 9000:3000 -v ~/repo/angular-bootstrap-quickstart:/repo --name ngquickstart anothersoftwaredevelopmentblog/angular-bootstrap-quickstart


this will take some time since during the startup the node modules and dependecies are installed with npm

watch the startup and logs with

   docker logs ngquickstart -f




then open a browser to access the demo

   http://localhost:9000/


then open an editor with the file

   ~/repo/angular-bootstrap-quickstart/src/app/app.component.ts


and just change the file a litte bit for a first test.

e.g. change the following line

   export class AppComponent  { name = 'Angular'; }

to

   export class AppComponent  { name = 'Angular and Bootstrap'; }


when pressing the save button the app is automatically recompiled by npm and since the demo is connected with browser-sync also the browser windows gets updated automatically without pressing the refresh button :-)




to open a terminal shell in the docker container run 

   docker -it ngquickstart /bin/bash


there its possible to execute all npm or project related commands e.g.

   npm install jquery -save


to stop the container open a new terminal and execute

   docker stop ngquickstart


to start the container

   docker start ngquickstart


remark:
in case of tsc related errors delete your local node_modules folder an re-run npm install (from inside the docker container) again or restart the container.



that's all






24 May 2017

angular 2 - part 1


bootstrap your development system setup :-)

todays tour is about setting up quickly a dockerized development system and a project skeleton for angular2 and bootstrap all running in a centos docker container

get the image with

   docker pull anothersoftwaredevelopmentblog/angular-bootstrap-quickstart


start the container with

   docker run -d -p 9000:3000 anothersoftwaredevelopmentblog/angular-bootstrap-quickstart


then open a browser

   http://localhost:9000/


you will see now the angular-quickstart project skeleton "enhanced" with bootstrap and a theme


the source is on github

   https://github.com/kr-g/angular-bootstrap-quickstart


my next article will be how to use and develop with this docker container



that's all



external references:

https://github.com/angular/quickstart
https://angularjs.org/
https://angular.io/
http://getbootstrap.com/

additonal license:

http://glyphicons.com/


20 May 2017

go lang - part 5


in my last article of this go-lang series my demo is about running go-lang on a mobile device as native app.

some features of the go-mobile package are still experimental... so i am not going to deep here since it might change without further notice.

in order to get it running its required to follow the steps as described
- please find a summary ... (sorry... its not that easy to set it up since the information is scattered among several pages)

get the android sdk and ndk from google - or better - in case you already have android studio installed use the sdk manager as described here to install ndk

   https://developer.android.com/ndk/guides/index.html


then check if your path variables are set properly as described here (android studio will _not_ do that for you...)

    https://developer.android.com/studio/command-line/variables.html


then start within bash

   go get golang.org/x/mobile/cmd/gomobile
   gomobile init



in case gomobile init fails just try it again with the ndk specified e.g. when bundled then it might look like that

   gomobile init -ndk ~/android-sdk-linux/ndk-bundle/


use now the avd manager from android studio to create a new avd and start it with the emulator so that gomobile can install the apk directly by using adb.

the demo as such is very simple. it just paints a triangle and uses one rotation matrix and one matrix for scaling the triangle - all painting and transformation is done by using opengl support from the gomobile-gl package.

here both matrix transformations are done without support of the f32 package - since this package in an experimental unstable state (anyway the mathematics behind that is therefore visible in the code... just wanted to mention that in case someone gets confused by that additional code...)

the source code is on github

   https://github.com/kr-g/go-sample/tree/master/go-mobile-opengl


build the demo with

   gomobile build -target=android go-mobile-opengl

or install it directly (when android emulator is running)

   gomobile install go-mobile-opengl


remark:
in case of build error check the GOPATH environment variable with

   go env

and correct it as described here

   https://developer.android.com/studio/command-line/variables.html



that's all






external references:

https://developer.android.com/ndk/downloads/index.html
https://developer.android.com/studio/index.html

https://developer.android.com/ndk/guides/index.html
https://developer.android.com/ndk/index.html

https://developer.android.com/studio/command-line/variables.html

https://github.com/golang/go/wiki/Mobile
https://godoc.org/golang.org/x/mobile
https://godoc.org/golang.org/x/mobile/exp/f32
https://www.khronos.org/registry/OpenGL-Refpages/es3/

https://godoc.org/golang.org/x/mobile/gl

18 May 2017

go lang - part 4

after i have worked on serving static web content with go-lang in my former articles of this series i now switch to dynamic generated content.

the setup for the next demo covers

- go-lang
- rest
- sql (this time i use sqlite since my former demos always used postgres...)
- bootstrap
- angularjs (still using version 1 ... its a little less complex ...)


the full source is available on github

   https://github.com/kr-g/go-sample/tree/master/webapp-rest-sql


there is also a docker file and image available

   https://hub.docker.com/r/anothersoftwaredevelopmentblog/go-sample/


get and run it with

   docker pull anothersoftwaredevelopmentblog/go-sample

   docker run -d -p 8090:8080 -p 8091:8081 -p 8092:8082 anothersoftwaredevelopmentblog/go-sample


in addition to the markdown and static content handler (from my former articles) there is a new handler inside (handlerRestTld) - driving the rest interface to demonstrate the handling of dynamic content in go-lang 

when the docker image is running just try

   http://localhost:8092/stat/resttld.html


remark:
the rest interface do not use a router with parameter extraction or such alike. i think that for a such a demo (and for understanding the basic behind all that) its quite good to do all that boilerplate code...


remark:
during docker build the database is populated with some sample data. its possible to trigger that again by calling import.go _inside_ the docker container with

   docker exec -it {your-container-id} /bin/bash
   cd /repo/go-sample/webapp-rest-sql
   go run import.go


for the user interface the demo use bootstrap. the demo contains also the starter-template and the theme-template samples from bootstrap under

   http://localhost:8092/stat/starter-template.html

   http://localhost:8092/stat/theme-template.html



that's all






external references
http://getbootstrap.com/
https://docs.angularjs.org/guide
https://en.wikipedia.org/wiki/SQLite
https://sqlite.org/

license information
https://sqlite.org/copyright.html
http://getbootstrap.com/components/

bootstrap uses http://glyphicons.com/





14 May 2017

go lang - part 3

in one of my former articles regarding web-development i created a markdown handler for apache. now i pick up this idea again for go-lang.

the basic idea is to start a seperate process for generating html in the background and collect the data from stdout afterwards.

in go-lang this is a quite short piece of code since all is available in the standard libs. in addition i have installed markdown on my system before to get it working. just one single line of code !!! - somehow ...


   data, err := exec.Command("markdown", fullpath).Output()
   if err != nil {
       log.Printf("exec error %s path %s", err, fullpath)
       return
   }

   resp = resp + fmt.Sprintf("%s", data)



this is only a part of the routine
but there is only a litte more required to get it working.


the full source is available on github

   https://github.com/kr-g/go-sample/tree/master/webapp-static-markdown


there is also a docker file and image available

   https://hub.docker.com/r/anothersoftwaredevelopmentblog/go-sample/


get and run it with

   docker pull anothersoftwaredevelopmentblog/go-sample

   docker run -d -p 8090:8080 -p 8091:8081 anothersoftwaredevelopmentblog/go-sample


in addition to the markdown handler there is also a simple file server handler inside returning the plain markdown file to demonstrate the handling of files in go-lang

   http://localhost:8091/show/main.md

   http://localhost:8091/markdown/main.md


don't miss to have also a look at the dockerfile !!!

doing go-lang with docker is just great :-)



that'all





plain markdown handler