Tuesday, October 25, 2016

Run Arquillian test on JBoss EAP 7/ Wildfly 10 using Arquillian Chameleon Container

Arqullian

http://arquillian.org/guides/getting_started/

Arquillian Chameleon Container

 https://github.com/arquillian/arquillian-container-chameleon

 http://discuss.arquillian.org/t/proxy-container-for-all-jboss-as-jboss-eap-wildfly/124/7

 Add Maven dependency ( check for latest version )

<dependency>
    <groupId>org.arquillian.container</groupId>
    <artifactId>arquillian-container-chameleon</artifactId>
    <version>1.0.0.Alpha7</version>
</dependency>

Add container configuration into arquillian.xml file

<arquillian xmlns="http://jboss.org/schema/arquillian"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
    
     <container qualifier="chameleon" default="true">
        <configuration>
            <property name="chameleonTarget">jboss eap:7.0.1:remote</property>
            <property name="managementAddress">localhost</property>
            <property name="managementPort">9990</property>
            <property name="username">${jboss.admin.user}</property>
            <property name="password">${jboss.admin.password}!</property>
        </configuration>
    </container>
   
</arquillian>


Add Maven dependencies in multi-module project using shrinkwrap-resolver-impl-maven http://stackoverflow.com/questions/13001371/adding-all-maven-dependencies-to-arquillian

https://github.com/shrinkwrap/resolver


Add Chameleon container dependency ( using runTests profile )

<profile>
            <id>runTests</id>
            <activation>
                <property>
                    <name>runTests</name>
                    <value>true</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                     <groupId>org.arquillian.container</groupId>
                     <artifactId>arquillian-container-chameleon</artifactId>
                 </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skipTests>false</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

Run the single test using Maven command line

$ mvn clean install -PrunTests  -Dtest=ArqTestCase

Tuesday, October 11, 2016

Install Citrix receiver on Fedora

Citrix Workspace app 1910 for Linux


Download und install
https://www.citrix.com/downloads/workspace-app/linux/workspace-app-for-linux-latest.html

sudo dnf install ~/Downloads/ICAClientWeb-rhel-19.10.0.15-0.x86_64.rpm 
sudo dnf install gtk-murrine-engine libidn1.34

cp /usr/share/applications/wfica.desktop ~/.local/share/applications/

sed -i  's/^Exec=/Exec=env LD_PRELOAD="\/lib64\/libcrypto.so.1.0.2o" /g' ~/.local/share/applications/wfica.desktop




Download latest Citrix reciever from Citrix web - decommissioned

https://www.citrix.com/downloads/citrix-receiver/linux/receiver-for-linux-latest.html

Install Citrix Receiver

[root@linux ~]# dnf info ICAClient
Last metadata expiration check: 1:56:02 ago on Tue Oct 11 14:24:35 2016.
Installed Packages
Name        : ICAClient
Arch        : x86_64
Epoch       : 0
Version     : 13.4.0.10109380
Release     : 0
Size        : 45 M
Repo        : @System
From repo   : @commandline
Summary     : Citrix Receiver for Linux
URL         : http://www.citrix.com/
License     : Commercial
Description : Citrix Receiver lets you access your enterprise files, applications, and
            : desktops from your favorite device wherever you are. Just ask your IT
            : department how to get started.


If you see SSL error on connection attemt
https://newspaint.wordpress.com/2015/10/05/linux-citrix-receiver-ssl-error-addtrust-external-ca-root/

Extract  AddTrustExternalCARoot from Firefox -> Preferences -> Advanced -> Certificates -> CA certs ->
Export CA cert AddTrustExternalCARoot to disk

Or download CA certificate from Comodo
https://support.comodo.com/index.php?/Knowledgebase/Article/View/853/74/addtrustexternalcaroot

Copy CA certificate into Citrix installation

[root@linux ~]# cp AddTrustExternalCARoot.crt /opt/Citrix/ICAClient/keystore/cacerts/


Use Google Chrome to connect

Sunday, October 9, 2016

Install and configure Docker on Fedora

Installation guide for Fedora

https://docs.docker.com/engine/installation/linux/fedora/

Install Docker using DNF

Enable docker service and start it

[root@localhost ~]# systemctl enable docker.service
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.


[root@localhost ~]# systemctl start docker
[root@localhost ~]# ps -aef |grep docker
root      6785     1  2 10:32 ?        00:00:00 /usr/bin/dockerd
root      6796  6785  0 10:32 ?        00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runc

Run the hello world

[root@localhost ~]# docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c04b14da8d14: Pull complete 
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

Create group docker and add own user 

[root@localhost ~]# usermod -aG docker dave

It is necessary to reboot to get rights as non-root user

[dave@localhost docker]$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/
Paste your text here.

Run Ubuntu image

[dave@localhost docker]$ docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
cad964aed91d: Pull complete 
3a80a22fea63: Pull complete 
50de990d7957: Pull complete 
61e032b8f2cb: Pull complete 
9f03ce1741bf: Pull complete 
Digest: sha256:28d4c5234db8d5a634d5e621c363d900f8f241240ee0a6a978784c978fe9c737
Status: Downloaded newer image for ubuntu:latest
root@e0fdce56f046:/# hostname
e0fdce56f046
root@e0fdce56f046:/# more /etc/issue
Ubuntu 16.04.1 LTS \n \l

root@e0fdce56f046:/# 

Running processes in hosting Fedora system

[root@localhost ~]# ps -aef |grep docker
root      1732     1  1 13:09 ?        00:00:08 /usr/bin/dockerd
root      1901  1732  0 13:09 ?        00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runc
dave      3643  3343  0 13:15 pts/0    00:00:00 docker run -it ubuntu bash
root      3855  1901  0 13:15 ?        00:00:00 docker-containerd-shim e0fdce56f046997246242db8c1ad224337dc4915f3ee497c8ae66e321c1f445f /var/run/docker/libcontainerd/e0fdce56f046997246242db8c1ad224337dc4915f3ee497c8ae66e321c1f445f docker-runc
[root@localhost ~]# 

List containers
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
e0fdce56f046        ubuntu              "bash"              5 minutes ago       Up 5 minutes                                   furious_heisenberg
04899e84663d        hello-world         "/hello"            9 minutes ago       Exited (0) 9 minutes ago                       big_newton

Create own image
 ( using tutorial https://docs.docker.com/engine/getstarted/step_four/ )

[dave@localhost docker]$ cat Dockerfile 
FROM docker/whalesay:latest
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortune -a | cowsay

[dave@localhost docker]$ docker build -t docker-whale .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM docker/whalesay:latest
 ---> 6b362a9f73eb
Step 2 : RUN apt-get -y update && apt-get install -y fortunes
 ---> Running in a2501bfa86f4
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:2 http://archive.ubuntu.com trusty-security InRelease [65.9 kB]
Hit http://archive.ubuntu.com trusty Release.gpg
Hit http://archive.ubuntu.com trusty Release
Get:3 http://archive.ubuntu.com trusty-updates/main Sources [474 kB]
Get:4 http://archive.ubuntu.com trusty-updates/restricted Sources [5247 B]
Get:5 http://archive.ubuntu.com trusty-updates/universe Sources [209 kB]
Get:6 http://archive.ubuntu.com trusty-updates/main amd64 Packages [1125 kB]
Get:7 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [23.5 kB]
Get:8 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [485 kB]
Get:9 http://archive.ubuntu.com trusty-security/main Sources [153 kB]
Get:10 http://archive.ubuntu.com trusty-security/restricted Sources [3944 B]
Get:11 http://archive.ubuntu.com trusty-security/universe Sources [51.3 kB]
Get:12 http://archive.ubuntu.com trusty-security/main amd64 Packages [662 kB]
Get:13 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [20.2 kB]
Get:14 http://archive.ubuntu.com trusty-security/universe amd64 Packages [180 kB]
Hit http://archive.ubuntu.com trusty/main Sources
Hit http://archive.ubuntu.com trusty/restricted Sources
Hit http://archive.ubuntu.com trusty/universe Sources
Hit http://archive.ubuntu.com trusty/main amd64 Packages
Hit http://archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://archive.ubuntu.com trusty/universe amd64 Packages
Fetched 3525 kB in 3s (1060 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  fortune-mod fortunes-min librecode0
Suggested packages:
  x11-utils bsdmainutils
The following NEW packages will be installed:
  fortune-mod fortunes fortunes-min librecode0
0 upgraded, 4 newly installed, 0 to remove and 87 not upgraded.
Need to get 1961 kB of archives.
After this operation, 4817 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main librecode0 amd64 3.6-21 [771 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/universe fortune-mod amd64 1:1.99.1-7 [39.5 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/universe fortunes-min all 1:1.99.1-7 [61.8 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty/universe fortunes all 1:1.99.1-7 [1089 kB]
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
Fetched 1961 kB in 0s (2729 kB/s)
Selecting previously unselected package librecode0:amd64.
(Reading database ... 13116 files and directories currently installed.)
Preparing to unpack .../librecode0_3.6-21_amd64.deb ...
Unpacking librecode0:amd64 (3.6-21) ...
Selecting previously unselected package fortune-mod.
Preparing to unpack .../fortune-mod_1%3a1.99.1-7_amd64.deb ...
Unpacking fortune-mod (1:1.99.1-7) ...
Selecting previously unselected package fortunes-min.
Preparing to unpack .../fortunes-min_1%3a1.99.1-7_all.deb ...
Unpacking fortunes-min (1:1.99.1-7) ...
Selecting previously unselected package fortunes.
Preparing to unpack .../fortunes_1%3a1.99.1-7_all.deb ...
Unpacking fortunes (1:1.99.1-7) ...
Setting up librecode0:amd64 (3.6-21) ...
Setting up fortune-mod (1:1.99.1-7) ...
Setting up fortunes-min (1:1.99.1-7) ...
Setting up fortunes (1:1.99.1-7) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
 ---> d32c0f1dd6fd
Removing intermediate container a2501bfa86f4
Step 3 : CMD /usr/games/fortune -a | cowsay
 ---> Running in 4be6a9e302e6
 ---> 04c2ee13ff82
Removing intermediate container 4be6a9e302e6
Successfully built 04c2ee13ff82


Run own image

[dave@localhost docker]$ docker run docker-whale
 ______________________________________ 
/ Now Denial:                          \
|                                      |
| To tell oneself that the only time   |
| worth living in is the past and that |
| the only time that may ever be       |
| interesting again is the future.     |
|                                      |
| -- Douglas Coupland, "Generation X:  |
| Tales for an Accelerated             |
|                                      |
\ Culture"                             /
 -------------------------------------- 
    \
     \
      \     
                    ##        .            
              ## ## ##       ==            
           ## ## ## ##      ===            
       /""""""""""""""""___/ ===        
  ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~   
       \______ o          __/            
        \    \        __/             
          \____\______/   

Saturday, September 24, 2016

AWS IAM setup for CodeDeploy

Create new IAM user using AWS console


https://console.aws.amazon.com/iam/home#users

Create new user awsdave



Download user credentials into file


 

Create new policies using AWS console


 Create new custom policy CodeDeploy and
EC2CodeDeploy

 


Create new roles using AWS console

 https://console.aws.amazon.com/iam/home#roles

Create roles and assign policy as described in AWS tutorial video
https://www.youtube.com/watch?v=qZa5JXmsWZs&list=LLl1AVDEQMsLIiTYI5M-v0ow&index=1



Create role CodeDeploy
Create role EC2CodeDeploy


Edit trust relationship for the created Role if needed



Launch EC2 instance 

 

Select EC2 instance IAM role EC2CodeDeploy



Policy CodeDeploy

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "autoscaling:PutLifecycleHook",
                "autoscaling:DeleteLifecycleHook",
                "autoscaling:RecordLifecycleActionHeartbeat",
                "autoscaling:CompleteLifecycleAction",
                "autoscaling:DescribeAutoscalingGroups",
                "autoscaling:PutInstanceInStandby",
                "autoscaling:PutInstanceInService",
                "autoscaling:DescribeLifecycleHooks",
                "ec2:Describe*"
            ],
            "Effect": "Allow",
            "Resource": "*"
        }
    ]
}

Trust Relationship


{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "Service": [
          "codedeploy.us-east-1.amazonaws.com",
          "codedeploy.us-west-2.amazonaws.com",
          "codedeploy.ap-northeast-2.amazonaws.com",
          "codedeploy.ap-southeast-2.amazonaws.com",
          "codedeploy.ap-southeast-1.amazonaws.com",
          "codedeploy.us-west-1.amazonaws.com",
          "codedeploy.eu-west-1.amazonaws.com",
          "codedeploy.ap-south-1.amazonaws.com",
          "codedeploy.eu-central-1.amazonaws.com",
          "codedeploy.ap-northeast-1.amazonaws.com",
          "codedeploy.sa-east-1.amazonaws.com"
        ]
      },
      "Action": "sts:AssumeRole"
    }
  ]
}



Thursday, August 4, 2016

Deploy Java application from GitHub to AWS

HOWTO from AWS tutorial


AWS tutorial video  Code Deploy Setup (IAM, EC2)
https://www.youtube.com/watch?v=qZa5JXmsWZs

GitHub for AWS tutorial video https://github.com/andrewpuch/code_deploy_example/

AWS CodeDeploy tutorial video https://www.youtube.com/watch?v=jcR9iIWdU7E

Steps to create running AWS EC2 instance


Create AWS free account

Getting started :
https://aws.amazon.com/free/

Create AWS account




Create own Linux instance
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html


Connect to AWS Linux instance via ssh

[dave@localhost aws]$ chmod 400 dave_amazon.pem
[dave@localhost aws]$ ssh -i "dave_amazon.pem" ec2-user@ec2-11-123-765-44.us-west-2.compute.amazonaws.com


       __|  __|_  )
       _|  (     /   Amazon Linux AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2016.03-release-notes/
8 package(s) needed for security, out of 17 available
Run "sudo yum update" to apply all updates.


Install AWS tools on Fedora

https://fedoramagazine.org/aws-tools-fedora/

[root@localhost ~]# dnf install  awscli
Dependencies resolved.
=================================================================================================
 Package                  Arch         Version                               Repository     Size
=================================================================================================
Installing:
 awscli                   noarch       1.10.45-1.fc23                        updates       868 k
 python3-botocore         noarch       1.4.35-1.fc23                         updates       1.8 M
 python3-colorama         noarch       0.3.2-2.fc23                          fedora         29 k
 python3-docutils         noarch       0.12-0.3.20140510svn7747.fc23         fedora        1.5 M
 python3-jmespath         noarch       0.9.0-1.fc23                          updates        43 k
 python3-pyasn1           noarch       0.1.8-1.fc23                          fedora        108 k
 python3-rsa              noarch       3.4.1-1.fc23                          updates        72 k
 python3-s3transfer       noarch       0.0.1-2.fc23                          updates        29 k

Transaction Summary
=================================================================================================
Install  8 Packages

Total download size: 4.5 M
Installed size: 27 M
Is this ok [y/N]: 
Paste your text here.

  

[dave@localhost aws]$ aws --version
aws-cli/1.10.45 Python/3.4.3 Linux/4.5.7-200.fc23.x86_64 botocore/1.4.35

 Add AWS IAM access keys

[dave@localhost aws]$ aws configure

Check running instances 

[dave@localhost aws]$ aws ec2 describe-instances 
{
    "Reservations": [
        {
            "Instances": [
                {
                    "PublicDnsName":

Integrating AWS CodeDeploy with GitHub

https://docs.aws.amazon.com/codedeploy/latest/userguide/github-integ.html


Setup roles in IAM
https://docs.aws.amazon.com/codedeploy/latest/userguide/getting-started-setup.html



Amazon AWS Java samples
https://github.com/aws/aws-sdk-java/tree/master/src/samples



Create GitHub repository with sample application
https://github.com/dveselka/aws-java-sample

User guide GitHub - AWS integration
https://docs.aws.amazon.com/codedeploy/latest/userguide/github-integ-tutorial.html 

Create application - see tutorial page
  Step 5: Deploy the Application to the Instance


Connect with GitHub


Deploy AWS sample Linux
https://github.com/dveselka/aws-sample-linux


Check AWS CodeDeploy console

Deploy fails with HEALTH_CONSTRAINTS

It is necessary to install CodeDeploy on instance
Follow this tutorial :

Install or reinstall the AWS CodeDeploy agent for Amazon Linux or RHEL

https://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-run-agent-install.html#how-to-run-agent-install-linux

[ec2-user@ip-172-31-21-129 ~]$ wget https://aws-codedeploy-eu-central-1.s3.amazonaws.com/latest/install
--2016-08-07 13:45:20--  https://aws-codedeploy-eu-central-1.s3.amazonaws.com/latest/install
Resolving aws-codedeploy-eu-central-1.s3.amazonaws.com (aws-codedeploy-eu-central-1.s3.amazonaws.com)... 54.231.193.44
Connecting to aws-codedeploy-eu-central-1.s3.amazonaws.com (aws-codedeploy-eu-central-1.s3.amazonaws.com)|54.231.193.44|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13359 (13K) []
Saving to: ‘install’

install                    100%[======================================>]  13.05K  78.6KB/s    in 0.2s    

2016-08-07 13:45:21 (78.6 KB/s) - ‘install’ saved [13359/13359]


Check installation success
[ec2-user@ip-172-31-21-129 ~]$ sudo service codedeploy-agent status
The AWS CodeDeploy agent is running as PID 2660


Deploy application from GithHub  using CodeDeploy - Deployments


Access application using public IP address





Check log on EC2 instance

c2-user]# tail -500f /var/log/httpd/access_log 
189.278.189.245 - - [24/Sep/2016:18:03:53 +0000] "GET / HTTP/1.1" 200 911 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0"



Sample app Linux
https://github.com/awslabs/aws-codedeploy-samples/tree/master/applications/SampleApp_Linux

Sample Tomcat application on GitHub
https://github.com/awslabs/aws-codedeploy-sample-tomcat


You can also download sample app from Amazon S3
[dave@localhost aws]$ aws s3 cp s3://aws-codedeploy-eu-central-1/samples/latest/SampleApp_Linux.zip . --region eu-central-1
download: s3://aws-codedeploy-eu-central-1/samples/latest/SampleApp_Linux.zip to ./SampleApp_Linux.zip

[dave@localhost aws]$ unzip -l SampleApp_Linux.zip 
Archive:  SampleApp_Linux.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
       34  11-03-2014 22:42   scripts/install_dependencies
       33  11-03-2014 22:43   scripts/start_server
      105  11-03-2014 22:43   scripts/stop_server
      359  11-03-2014 22:42   appspec.yml
      717  11-03-2014 22:42   index.html
    10884  11-03-2014 22:42   LICENSE.txt
---------                     -------
    12132                     6 files

Thursday, April 21, 2016

Scala - setup environment - sbt, Scala IDE

Download sbt http://www.scala-sbt.org/download.html


Configure https proxy
 export JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=webproxy -Dhttp.proxyPort=8080"  


Change sbt repository root
 export _JAVA_OPTIONS='-Duser.home=/d/vesedan/sbt-repository'  


Start sbt
 $ sbt  
 Getting org.scala-sbt sbt 0.13.11 ...  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.11/jars/sbt.jar ...  
     [SUCCESSFUL ] org.scala-sbt#sbt;0.13.11!sbt.jar (2209ms)  
 downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.6/scala-library-2.10.6.jar ...  
     [SUCCESSFUL ] org.scala-lang#scala-library;2.10.6!scala-library.jar (36565ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main/0.13.11/jars/main.jar ...  
     [SUCCESSFUL ] org.scala-sbt#main;0.13.11!main.jar (14438ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.13.11/jars/compiler-interface.jar ...  
     [SUCCESSFUL ] org.scala-sbt#compiler-interface;0.13.11!compiler-interface.jar (3732ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/actions/0.13.11/jars/actions.jar ...  
     [SUCCESSFUL ] org.scala-sbt#actions;0.13.11!actions.jar (4983ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main-settings/0.13.11/jars/main-settings.jar ...  
     [SUCCESSFUL ] org.scala-sbt#main-settings;0.13.11!main-settings.jar (189535ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/interface/0.13.11/jars/interface.jar ...  
     [SUCCESSFUL ] org.scala-sbt#interface;0.13.11!interface.jar (2385ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/io/0.13.11/jars/io.jar ...  
     [SUCCESSFUL ] org.scala-sbt#io;0.13.11!io.jar (3836ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/ivy/0.13.11/jars/ivy.jar ...  
     [SUCCESSFUL ] org.scala-sbt#ivy;0.13.11!ivy.jar (10631ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/logging/0.13.11/jars/logging.jar ...  
     [SUCCESSFUL ] org.scala-sbt#logging;0.13.11!logging.jar (2493ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/logic/0.13.11/jars/logic.jar ...  
     [SUCCESSFUL ] org.scala-sbt#logic;0.13.11!logic.jar (2893ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/process/0.13.11/jars/process.jar ...  
     [SUCCESSFUL ] org.scala-sbt#process;0.13.11!process.jar (3226ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/run/0.13.11/jars/run.jar ...  
     [SUCCESSFUL ] org.scala-sbt#run;0.13.11!run.jar (4793ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/command/0.13.11/jars/command.jar ...  
     [SUCCESSFUL ] org.scala-sbt#command;0.13.11!command.jar (3569ms)  
 downloading https://repo1.maven.org/maven2/org/scala-sbt/launcher-interface/1.0.0-M1/launcher-interface-1.0.0-M1.jar ...  
     [SUCCESSFUL ] org.scala-sbt#launcher-interface;1.0.0-M1!launcher-interface.jar (265ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/classpath/0.13.11/jars/classpath.jar ...  
     [SUCCESSFUL ] org.scala-sbt#classpath;0.13.11!classpath.jar (2508ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/completion/0.13.11/jars/completion.jar ...  
     [SUCCESSFUL ] org.scala-sbt#completion;0.13.11!completion.jar (4228ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/api/0.13.11/jars/api.jar ...  
     [SUCCESSFUL ] org.scala-sbt#api;0.13.11!api.jar (6932ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-integration/0.13.11/jars/compiler-integration.jar ...  
     [SUCCESSFUL ] org.scala-sbt#compiler-integration;0.13.11!compiler-integration.jar (2715ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-ivy-integration/0.13.11/jars/compiler-ivy-integration.jar ...  
     [SUCCESSFUL ] org.scala-sbt#compiler-ivy-integration;0.13.11!compiler-ivy-integration.jar (2659ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/relation/0.13.11/jars/relation.jar ...  
     [SUCCESSFUL ] org.scala-sbt#relation;0.13.11!relation.jar (2618ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/task-system/0.13.11/jars/task-system.jar ...  
     [SUCCESSFUL ] org.scala-sbt#task-system;0.13.11!task-system.jar (2604ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/tasks/0.13.11/jars/tasks.jar ...  
     [SUCCESSFUL ] org.scala-sbt#tasks;0.13.11!tasks.jar (3010ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/tracking/0.13.11/jars/tracking.jar ...  
     [SUCCESSFUL ] org.scala-sbt#tracking;0.13.11!tracking.jar (2193ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/testing/0.13.11/jars/testing.jar ...  
     [SUCCESSFUL ] org.scala-sbt#testing;0.13.11!testing.jar (3076ms)  
 downloading https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.10.6/scala-compiler-2.10.6.jar ...  
     [SUCCESSFUL ] org.scala-lang#scala-compiler;2.10.6!scala-compiler.jar (100258ms)  
 downloading https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.10.6/scala-reflect-2.10.6.jar ...  
     [SUCCESSFUL ] org.scala-lang#scala-reflect;2.10.6!scala-reflect.jar (10966ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/control/0.13.11/jars/control.jar ...  
     [SUCCESSFUL ] org.scala-sbt#control;0.13.11!control.jar (2203ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/collections/0.13.11/jars/collections.jar ...  
     [SUCCESSFUL ] org.scala-sbt#collections;0.13.11!collections.jar (4384ms)  
 downloading https://repo1.maven.org/maven2/jline/jline/2.13/jline-2.13.jar ...  
     [SUCCESSFUL ] jline#jline;2.13!jline.jar (1690ms)  
 downloading https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.jar ...  
     [SUCCESSFUL ] org.fusesource.jansi#jansi;1.11!jansi.jar (1058ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/classfile/0.13.11/jars/classfile.jar ...  
     [SUCCESSFUL ] org.scala-sbt#classfile;0.13.11!classfile.jar (2419ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/incremental-compiler/0.13.11/jars/incremental-compiler.jar ...  
     [SUCCESSFUL ] org.scala-sbt#incremental-compiler;0.13.11!incremental-compiler.jar (4280ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compile/0.13.11/jars/compile.jar ...  
     [SUCCESSFUL ] org.scala-sbt#compile;0.13.11!compile.jar (3685ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/persist/0.13.11/jars/persist.jar ...  
     [SUCCESSFUL ] org.scala-sbt#persist;0.13.11!persist.jar (2781ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbinary/sbinary_2.10/0.4.2/jars/sbinary_2.10.jar ...  
     [SUCCESSFUL ] org.scala-tools.sbinary#sbinary_2.10;0.4.2!sbinary_2.10.jar (2939ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/cross/0.13.11/jars/cross.jar ...  
     [SUCCESSFUL ] org.scala-sbt#cross;0.13.11!cross.jar (2050ms)  
 downloading https://repo1.maven.org/maven2/org/scala-sbt/ivy/ivy/2.3.0-sbt-2cc8d2761242b072cedb0a04cb39435c4fa24f9a/ivy-2.3.0-sbt-2cc8d2761242b072cedb0a04cb39435c4fa24f9a.jar ...  
     [SUCCESSFUL ] org.scala-sbt.ivy#ivy;2.3.0-sbt-2cc8d2761242b072cedb0a04cb39435c4fa24f9a!ivy.jar (5077ms)  
 downloading https://repo1.maven.org/maven2/com/jcraft/jsch/0.1.46/jsch-0.1.46.jar ...  
     [SUCCESSFUL ] com.jcraft#jsch;0.1.46!jsch.jar (1399ms)  
 downloading https://repo1.maven.org/maven2/org/scala-sbt/serialization_2.10/0.1.2/serialization_2.10-0.1.2.jar ...  
     [SUCCESSFUL ] org.scala-sbt#serialization_2.10;0.1.2!serialization_2.10.jar (2002ms)  
 downloading https://repo1.maven.org/maven2/org/scala-lang/modules/scala-pickling_2.10/0.10.1/scala-pickling_2.10-0.10.1.jar ...  
     [SUCCESSFUL ] org.scala-lang.modules#scala-pickling_2.10;0.10.1!scala-pickling_2.10.jar (2997ms)  
 downloading https://repo1.maven.org/maven2/org/json4s/json4s-core_2.10/3.2.10/json4s-core_2.10-3.2.10.jar ...  
     [SUCCESSFUL ] org.json4s#json4s-core_2.10;3.2.10!json4s-core_2.10.jar (2953ms)  
 downloading https://repo1.maven.org/maven2/org/spire-math/jawn-parser_2.10/0.6.0/jawn-parser_2.10-0.6.0.jar ...  
     [SUCCESSFUL ] org.spire-math#jawn-parser_2.10;0.6.0!jawn-parser_2.10.jar (699ms)  
 downloading https://repo1.maven.org/maven2/org/spire-math/json4s-support_2.10/0.6.0/json4s-support_2.10-0.6.0.jar ...  
     [SUCCESSFUL ] org.spire-math#json4s-support_2.10;0.6.0!json4s-support_2.10.jar (122ms)  
 downloading https://repo1.maven.org/maven2/org/scalamacros/quasiquotes_2.10/2.0.1/quasiquotes_2.10-2.0.1.jar ...  
     [SUCCESSFUL ] org.scalamacros#quasiquotes_2.10;2.0.1!quasiquotes_2.10.jar (2490ms)  
 downloading https://repo1.maven.org/maven2/org/json4s/json4s-ast_2.10/3.2.10/json4s-ast_2.10-3.2.10.jar ...  
     [SUCCESSFUL ] org.json4s#json4s-ast_2.10;3.2.10!json4s-ast_2.10.jar (774ms)  
 downloading https://repo1.maven.org/maven2/com/thoughtworks/paranamer/paranamer/2.6/paranamer-2.6.jar ...  
     [SUCCESSFUL ] com.thoughtworks.paranamer#paranamer;2.6!paranamer.jar (764ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/cache/0.13.11/jars/cache.jar ...  
     [SUCCESSFUL ] org.scala-sbt#cache;0.13.11!cache.jar (2837ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/test-agent/0.13.11/jars/test-agent.jar ...  
     [SUCCESSFUL ] org.scala-sbt#test-agent;0.13.11!test-agent.jar (2668ms)  
 downloading https://repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar ...  
     [SUCCESSFUL ] org.scala-sbt#test-interface;1.0!test-interface.jar (634ms)  
 downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/apply-macro/0.13.11/jars/apply-macro.jar ...  
     [SUCCESSFUL ] org.scala-sbt#apply-macro;0.13.11!apply-macro.jar (2501ms)  
 :: retrieving :: org.scala-sbt#boot-app  
     confs: [default]  
     49 artifacts copied, 0 already retrieved (17330kB/137ms)  
 Getting Scala 2.10.6 (for sbt)...  
 downloading https://repo1.maven.org/maven2/org/scala-lang/jline/2.10.6/jline-2.10.6.jar ...  
     [SUCCESSFUL ] org.scala-lang#jline;2.10.6!jline.jar (1016ms)  
 downloading https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.4/jansi-1.4.jar ...  
     [SUCCESSFUL ] org.fusesource.jansi#jansi;1.4!jansi.jar (1034ms)  
 :: retrieving :: org.scala-sbt#boot-scala  
     confs: [default]  
     5 artifacts copied, 0 already retrieved (24494kB/62ms)  
 [info] Set current project to sbt (in build file:/D:/vesedan/sbt/)  


Start Scala console
 > console  
 [info] Updating {file:/D:/vesedan/sbt/}sbt...  
 [info] Resolving org.fusesource.jansi#jansi;1.4 ...  
 [info] Done updating.  
 [info] 'compiler-interface' not yet compiled for Scala 2.10.6. Compiling...  
 [info]  Compilation completed in 16.541 s  
 [info] Starting scala interpreter...  
 [info]  
 Welcome to Scala version 2.10.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_74).  
 Type in expressions to have them evaluated.  
 Type :help for more information.  
 scala>  
 scala>  
 scala> println("Hi!")  
 Hi!
 scala>  

Download  Scala IDE
 http://scala-ide.org/download/sdk.html

Tuesday, March 8, 2016

Openshift - deploy Java EE7 application onto Wildlfy10

OpenShift  Wildfly  https://developers.openshift.com/en/wildfly-getting-started.html

 Create OpenShift account https://openshift.redhat.com/app/account/new?then=%2Fapp%2Faccount

Install RedHat RHC  client tools  https://developers.openshift.com/en/managing-client-tools.html


sudo yum install rubygems
rhc setup

Create application via web console or using RHC tools

Write down admin password to access cloud via SSH

Open application URL in browser http://ee7full-testjavaee.rhcloud.com/




[dave@localhost ee7full.git]$ rhc apps
ee7full @ http://ee7full-testjavaee.rhcloud.com/ (uuid: 56d97e36454545636454540026f)
---------------------------------------------------------------------------------
  Domain:          testjavaee
  Created:         Mar 04  1:23 PM
  Gears:           1 (defaults to small)
  Git URL:         ssh://5645454545367a00026f@ee7full-testjavaee.rhcloud.com/~/git/ee7full.git/
  Initial Git URL: https://github.com/dveselka/wildfly/#master
  SSH:             5645454545367a00026f@ee7full-testjavaee.rhcloud.com
  Deployment:      auto (on git push)

  jboss-wildfly-10 (WildFly Application Server 10)
  ------------------------------------------------
    From:    https://raw.github.com/openshift-cartridges/openshift-wildfly-cartridge/wildfly-10/metadata/manifest.yml
    Website: http://www.wildfly.org
    Gears:   1 small

You have access to 1 application.
[dave@localhost ee7full.git]$ 


Initial source code is taken from existing GitHub code https://github.com/dveselka/wildfly


Clone Git Repository

git clone ssh://56d93434343445456f@ee7full-testjavaee.rhcloud.com/~/git/ee7full.git/


Forward ports to local host https://developers.openshift.com/en/managing-port-forwarding.html

[dave@localhost openshift]$ rhc port-forward -a ee7full
Checking available ports ... done
Forwarding ports ...

To connect to a service running on OpenShift, use the Local address

Service Local               OpenShift
------- -------------- ---- -----------------
java    127.0.0.1:3528  =>  127.5.77.129:3528
java    127.0.0.1:3529  =>  127.5.77.129:3529
java    127.0.0.1:8080  =>  127.5.37.129:8080
java    127.0.0.1:9990  =>  127.5.77.129:9990

Press CTRL-C to terminate port forwarding



Deploy application using Maven deploy plugin

dave@localhost dave-java-ee7-wildfly-full]$ pwd
/home/dave/openshift/ee7full.git/dave-java-ee7-wildfly-full
[dave@localhost dave-java-ee7-wildfly-full]$ mvn clean package wildfly:deploy


[INFO] --- wildfly-maven-plugin:1.0.2.Final:deploy (default-cli) @ dave-java-ee7-wildfly-full-ear ---
Mar 08, 2016 7:49:14 AM org.xnio.Xnio <clinit>
INFO: XNIO version 3.2.2.Final
Mar 08, 2016 7:49:14 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.2.2.Final
Mar 08, 2016 7:49:14 AM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.3.Final
Authenticating against security realm: ManagementRealm
Username:


Check application server logs

2016-03-08 01:52:43,915 INFO  [org.jboss.as.repository] (management-handler-thread - 5) WFLYDR0001: Content added at location /var/lib/openshift/56d9454545450026f/wildfly/standalone/data/content/62/75d7af5656565656573/content
2016-03-08 01:52:43,934 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "dave-java-ee7-wildfly-full-ear.ear" (runtime-name: "dave-java-ee7-wildfly-full-ear.ear")
2016-03-08 01:52:44,090 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0207: Starting subdeployment (runtime-name: "dave-java-ee7-wildfly-full-ejb.jar")
2016-03-08 01:52:44,091 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0207: Starting subdeployment (runtime-name: "dave-java-ee7-wildfly-full-web.war")
2



Access application via browser using public URL  http://ee7full-testjavaee.rhcloud.com/dave-java-ee7-wildfly-full-web/