Skip to content

Running Custom RAP plugin from IDE

MarioKusek edited this page Dec 5, 2019 · 7 revisions

Running RAP plugin from IDE is convenient during development and testing.

This document is explaining procedure for RapPluginExample but you need to configure it.

In order to run RapPluginExample from your IDE you need to do following:

1. Tunnelling ports

ATTENTION: If you use docker directly (not using docker-machine) and docker is in the same machine as IDE then you can skip this step

  • You need to tunnel port from virtual machine (in docker-machine) to local computer.

    • ports 5671 and 5672 for symbiote-rabbitmq - needed for every RAP plugin
    • port 8888 for symbiote-cloudconfig - needed for fetching configuration
    • port 8001 for symbiote-rh - needed for RapPluginEaxample. It is used for registering resources
    • port 8080 for symbiote-aam - not needed for RapPluginExample - can be used for creating new platform user
    • if you want to expose other ports then you need to change .yml files for port mapping and also here tunnelling
  • For Linux/Unix/Mac OSX run following commands each in different terminal:

docker-machine ssh default -L 0.0.0.0:5671:127.0.0.1:5671 -L 0.0.0.0:5672:127.0.0.1:5672 -L 0.0.0.0:8888:127.0.0.1:8888
  • For Windows use Putty tool. Here are instructions for port forwarding (mapping).
    • E.g. for port 5671 configure putty like this:
      • Source port: 5671
      • Destination: 127.0.0.1:5671

Docker on remote machine

Besides previous steps you need to forward ports from your local machine to remote machine. You will do that by following instructions:

  • For Linux/Unix/Mac OSX - run command in separate terminals:
ssh -L 5671:127.0.0.1:5671 -L 5672:127.0.0.1:5672 -L 8888:127.0.0.1:8888 user-name@remote-host
  • For Windows - use Putty and make port forwarding
    • e.g. for port 5671 configure putty like this:
      • Source port: 5671
      • Destination: remote-host:5671

2. Create properties file for running in IDE

Create property file CloudConfigProperties/RapPluginExample-localhost.properties with following content:

logging.level.eu.h2020.symbiote=DEBUG
rabbit.replyTimeout=60000
enablerLogic.registrationHandlerUrl=http://127.0.0.1:8001
spring.rabbitmq.host=127.0.0.1
  • If your RAP plugin name is different change the name of the file

3. Create file docker-compose-swarm-custom-local.yml

Copy file docker-compose-swarm-custom.yml to docker-compose-swarm-custom-local.yml and in new file add in appropriate place following:

...
services:
  symbiote-cloudconfig:
    secrets:
      - source: rapplugindevconfig
        target: /home/CloudConfigProperties/RapPluginExample-localhost.properties
...
secrets:
  rapplugindevconfig:
    file: ./CloudConfigProperties/RapPluginExample-localhost.properties
...
  • Modify content of the file according to the name of the file in the step 2.

4. Running swarm stack

Instead of command for running stack now you need to use following command:

docker stack deploy -c docker-compose-swarm-L1.yml -c docker-compose-ngrok-swarm-L1.yml -c docker-compose-swarm-custom-local.yml symbiote-app
  • Checking that configuration is OK
    • Look in log to see message similar to Started EnablerConfigServiceApplication in 59.881 seconds (JVM running for 73.967)

      run similar to this to see logs docker logs symbiote-enabler_symbiote-rpe.1.gp6sd79jss7yj1e48ug4ji297 -f

    • send request to config server by running curl http://127.0.0.1:8888/RapPluginExample/localhost | json_pp | grep spring.rabbitmq.host or by using Postman to send HTTP GET to the same URL and find line with:

      Line: spring.rabbitmq.host" : "127.0.0.1",

      This means that Rabbit is configured at 127.0.0.1 as expected.

      • Change the URL to the name of custom RAP plugin name if you have different name set in step 2

5. Creating Properties in Rap plugin project

  • In the root of the project create file bootstrap.proparties with following content:
spring.application.name=RapPluginExample
spring.cloud.config.uri=http://127.0.0.1:8888
spring.profiles.active=localhost
  • Change RapPluginExample to the name of your custom RAP plugin name if you have change it in step 2.

6. Running RAP plugin in IDE

Run class with main method. In our example it is eu.h2020.symbiote.rappluginexample. RapPluginExampleApplication.

Getting Started
Migration to 3.0.0
Migration to Docker

  1. Preparation steps
    1.1. Register user and configure platform in symbIoTe Core
    1.2. Installation of required tools for symbIoTe platform components
    1.3. Downloading jars
    1.4. Downloading sources
  2. Configuring and starting components
    2.1. Configuration of NGINX
    2.2. Starting third party tools that are prerequisite for symbIoTe
    2.3. Starting (generic) symbIoTe Cloud components
    2.4. Configuration of cloud components
    2.4.1. Starting symbIoTe Cloud components
    2.5. Setting up the Platform Authentication and Authorization Manager (PAAM)
    2.6. Starting Registration Handler and resource management
    2.7. Set up of Resource Access Proxy
    2.8. Manage resources
    2.9. Set up of the Monitoring component
    2.10. Other configuration topics
  3. Test integrated resource
    3.1. Security
    3.2. Search for resources
    3.3. Obtaining resource access URL
    3.4. Accessing the resource and actuating and invoking service for default (dummy) resources
  4. Creating RAP plugin
    4.1. Customizing internal RAP plugin
    4.2. Using RAP plugin starter
    4.3. Creating RAP plugin in other languages
  5. Resource Description Examples
    5.1. JSON Description Examples
    5.2. RDF Description Examples
  6. Preparation for L2 compliance
  7. Configuring and starting components for L2
    7.1. Starting Federation Manager
    7.2. Starting Subscription Manager
    7.3. Starting Platform Registry
    7.4. Starting Trust Manager
    7.5. Starting Bartering And Trading
    7.6. Starting SLA Manager
    7.7. Create a federation
    7.8. Manage resources in L2
    7.9. Register Subscription
  8. Test Integrated L2 Resources
  9. Developing symbIoTe enabled apps
Clone this wiki locally