info@yenlo.com
eng
Menu
WSO2 Enterprise Integrator 6 min

Setting up a disposable WSO2 Enterprise Integrator version

Rob Blaauboer
Rob Blaauboer
Integration Consultant & WSO2 Trainer
disposable

disposable wso2 enterprise integrator As an integration consultant and WSO2 trainer I have an almost constant need for a quick disposable WSO2 Enterprise Integrator environment to try out certain setups. In most cases I will unpack a version on the desktop of the WSO2 EI and unzip the product. But that also has drawbacks. I have a lot of directories with EI versions and cleaning them up is always a challenge since there might be some artifact there I still need or other settings. That is why I’ve invested some time in creating a setup where I simply create a Virtualbox environment with all of the needed stuff to run my disposable WSO2 EI. I love using vagrant in conjunction with Virtualbox so we will also use that tool for the configuration and provisioning. In this blog I show you how to do so.

The setup is going to be simple. With vagrant, we create a Virtualbox environment with WSO2 EI and use Developer Studio / Eclipse to connect to that running environment.

Vagrant, Virtualbox, WSO2 Ei and Developer Studio

Installation

In order to keep this blog shortish, I will not describe the installation of both products, you  can find  information on installing and using vagrant here. To download Developer Studio please go to the site of WSO2.  Select the tooling for your operating system and install according to the instructions.

Our definition will be as short and sweet as possible, using the Vagrantfile for configuration of the virtualbox as well as provisioning of that file. You can download the Vagrantfile from our Yenlo Bitbucket.

We will try and keep the instructions for creation flexible and short

Create a directory called DISPEI, for instance on the desktop where you want to create your Vagrantfile.

md (or mkdir) dispei

cd dispei

vagrant init

The last command creates the Vagrantfile needed to setup the environment. In this setup, we actually use the centos/7 box. This needs to be added to Vagrant with the command

vagrant box add https://app.vagrantup.com/centos/boxes/7

this allows us to use the centos/7 box, a minimal installation of centos 7, as the base for our environment.

After running this command, it asks which image to download (provider). The choices are: hyperv, libvirt, virtualbox, vmware_desktop. We choose “virtualbox”. Note that this command is not really necessary. If you just add “centos/7” to the vagrant file and say “vagrant up” it will automatically download the base box for you.

Check if centos/7 is available

vagrant box list

You will see something like this:

centos/7                (virtualbox, 1801.02)

The actual version number will be different, the 1801.02 version is already a bit older.

Creating the vagrant file

We will delete all of the text in the Vagrant file and replace it with this text. I’ve included the comments as explanation in the file, rather than describing them in lines below the file.

Vagrant.configure("2") do |config|
config.vm.box = "centos/7"

config.vm.define "YENLO" do |yenlo|
     yenlo.vm.hostname = "Disposable.EI"
     yenlo.vm.provider "virtualbox" do |vb|
         vb.name = "Disposable WSO2 EI"
         vb.memory = "4096"
         vb.cpus = "2"
    end

    yenlo.vm.network "private_network", ip: "192.168.33.77"
      config.vm.provision "shell", inline: <<-SHELL
     
      #download wget to download Java and WSO2 EI
      sudo yum install -y wget
      #needed  because we need to unzip WSO2 EI
      sudo yum install -y unzip     

      #downloading the WSO2 EI 6.1.1 from WSO2 repository circumventing the required credentials
      sudo wget --user-agent="testuser" --referer="http://connect.wso2.com/wso2/getform/reg/new_product_download" http://dist.wso2.org/products/enterprise-integrator/6.1.1/wso2ei-6.1.1.zip

      #downloading Java from Oracle repository circumventing the required optin
      sudo wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz

      # create the directory for Java to be  installed
      sudo mkdir /usr/java

      #untar java in the right directory
      sudo tar -xzf jdk-8u161-linux-x64.tar.gz -C /usr/java

      # add JAVA_HOME and extend the PATH to include the java installation
      sudo sh -c "echo export JAVA_HOME=/usr/java/jdk1.8.0_161 >> /etc/environment"
      sudo sh -c "echo export PATH=$PATH:/usr/java/jdk1.8.0_161/bin >> /etc/environment"

      #create the directory for wso2
      sudo mkdir /opt/wso2
      #unzip wso2ei to the directory
      sudo unzip wso2ei-6.1.1.zip -d /opt/wso2
      #copy any CAR files (packaged artifacts) to the deployment directory, so they will be hot deployed (in this case at startup)
      #sudo cp /vagrant/*.car /opt/wso2/wso2ei-6.1.1/repository/deployment/server/carbonapps

      #start the WSO2 Enterprise Integrator in the background
      sudo sh /opt/wso2/wso2ei-6.1.1/bin/integrator.sh start  

      SHELL

      end

end

This is a regular script that results in a up and running WSO2 Enterprise Integrator. The special case we included is that we take any CAR files (files that are used to deploy artifacts to the Enterprise Integrator) and copy that file from the shared host vagrant directory to the same directory on the newly created virtual machine. From there we actually copy the file(s) directly to the deployment directory. If there are no car files it will stop the provisioning, that is why I uncommented it.

We start the setup with vagrant up within the directory where we created the Vagrantfile

After startup, we can check the VM. First go to the command line with:

vagrant ssh

Because we run in the background we do not see the log files, so let’s take a look at them. Use tail -f to have a window on the logs.

tail -f /opt/wso2/wso2ei-6.1.1/repository/logs/wso2carbon.log

For this blog, we added a task in the CAR file that will actually put a message on the console.

Command Prompt-vagrant-ssh - Setting up a disposable WSO2 EI

But is Enterprise Integrator running? We open our browser and actually access the URL of the management console. Since we use a private network IP address we enter:

https://192.168.33.77:9443/carbon

WSo2 Enterprise Integrator Management Console

Connecting to Developer Studio

So, we have a WSO2 EI running in virtual box. Now we need to connect to that server in Developer Studio / Eclipse. We start Eclipse and on the server tab create a remote server

Define a new server Eclipse

We click Next and go to the next tab. We enter the Server URL and test the connection.

Remote carbon server eclipse

To test this, I am adding a CAR file (registrycar) to the server and deploy that. In my original setup, I created a simple CAR file (HCAR) and added that to the vagrant directory where it was deployed to the carbonapps directory and therefor it is visible in the screenshot below.

add and remove car file

The log shows the artifacts being deployed and, since one of them is a task, output coming to the console.

Car file log - command prompt -vagrant ssh

So, we have a setup where we can deploy an WSO2 EI to quickly try something out. Getting rid of the whole environment is as simple as vagrant destroy

C:vagrantyenlo>vagrant destroy
    YENLO: Are you sure you want to destroy the 'YENLO' VM? [y/N] y
==> YENLO: Forcing shutdown of VM...
==> YENLO: Destroying VM and associated drives...
C:vagrantyenlo>

This will completely remove the environment, including the virtual box environment.

If you have any questions about this blogpost contact us via the comments section below. View also our WSO2 Tutorialswebinars or white papers for more technical information. Need support? We do deliver WSO2 Product SupportWSO2 Development SupportWSO2 Operational Support and WSO2 Training Programs.

eng
Close