Prepared cloud deployment of hawkbit sandbox
This commit is contained in:
21
examples/hawkbit-device-simulator/cf/manifest.yml
Normal file
21
examples/hawkbit-device-simulator/cf/manifest.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
#
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
---
|
||||||
|
applications:
|
||||||
|
- name: hawkbit-simulator
|
||||||
|
memory: 512M
|
||||||
|
instances: 1
|
||||||
|
buildpack: https://github.com/cloudfoundry/java-buildpack
|
||||||
|
path: hawkbit-example-app-0.2.0-SNAPSHOT.jar
|
||||||
|
services:
|
||||||
|
- dmf-rabbit
|
||||||
|
env:
|
||||||
|
SPRING_PROFILES_ACTIVE: cloudsandbox,amqp
|
||||||
|
CF_STAGING_TIMEOUT: 15
|
||||||
|
CF_STARTUP_TIMEOUT: 15
|
||||||
@@ -42,6 +42,16 @@
|
|||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>cf</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<targetPath>${project.build.directory}</targetPath>
|
||||||
|
<includes>
|
||||||
|
<include>manifest.yml</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice.Protocol;
|
||||||
import org.eclipse.hawkbit.simulator.amqp.SpSenderService;
|
import org.eclipse.hawkbit.simulator.amqp.SpSenderService;
|
||||||
import org.eclipse.hawkbit.simulator.event.InitUpdate;
|
import org.eclipse.hawkbit.simulator.event.InitUpdate;
|
||||||
import org.eclipse.hawkbit.simulator.event.ProgressUpdate;
|
import org.eclipse.hawkbit.simulator.event.ProgressUpdate;
|
||||||
@@ -34,6 +35,9 @@ public class DeviceSimulatorUpdater {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SpSenderService spSenderService;
|
private SpSenderService spSenderService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SimulatedDeviceFactory deviceFactory;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EventBus eventbus;
|
private EventBus eventbus;
|
||||||
|
|
||||||
@@ -58,7 +62,13 @@ public class DeviceSimulatorUpdater {
|
|||||||
*/
|
*/
|
||||||
public void startUpdate(final String tenant, final String id, final long actionId, final String swVersion,
|
public void startUpdate(final String tenant, final String id, final long actionId, final String swVersion,
|
||||||
final UpdaterCallback callback) {
|
final UpdaterCallback callback) {
|
||||||
final AbstractSimulatedDevice device = repository.get(tenant, id);
|
AbstractSimulatedDevice device = repository.get(tenant, id);
|
||||||
|
|
||||||
|
// plug and play - non existing device will be auto created
|
||||||
|
if (device == null) {
|
||||||
|
device = repository.add(deviceFactory.createSimulatedDevice(id, tenant, Protocol.DMF_AMQP, -1, null, null));
|
||||||
|
}
|
||||||
|
|
||||||
device.setProgress(0.0);
|
device.setProgress(0.0);
|
||||||
device.setSwversion(swVersion);
|
device.setSwversion(swVersion);
|
||||||
eventbus.post(new InitUpdate(device));
|
eventbus.post(new InitUpdate(device));
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ public class AmqpConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the receiver queue from sp. Receive messages from sp.
|
* Creates the receiver queue from update server for receiving message from
|
||||||
|
* update server.
|
||||||
*
|
*
|
||||||
* @return the queue
|
* @return the queue
|
||||||
*/
|
*/
|
||||||
@@ -70,7 +71,7 @@ public class AmqpConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the recevier exchange. Sp send messages to this exchange.
|
* Creates the receiver exchange for sending messages to update server.
|
||||||
*
|
*
|
||||||
* @return the exchange
|
* @return the exchange
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ import org.springframework.messaging.handler.annotation.Header;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle all incoming Messages from SP.
|
* Handle all incoming Messages from hawkBit update server.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@@ -44,17 +42,6 @@ public class SpReceiverService extends ReceiverService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
|
||||||
* @param rabbitTemplate
|
|
||||||
* the rabbit template
|
|
||||||
* @param amqpProperties
|
|
||||||
* the amqp properties
|
|
||||||
* @param lwm2mSenderService
|
|
||||||
* the lwm2mSenderService
|
|
||||||
* @param spSenderService
|
|
||||||
* the spSenderService
|
|
||||||
* @param deviceUpdater
|
|
||||||
* the updater service to simulate update process
|
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
public SpReceiverService(final RabbitTemplate rabbitTemplate, final AmqpProperties amqpProperties,
|
public SpReceiverService(final RabbitTemplate rabbitTemplate, final AmqpProperties amqpProperties,
|
||||||
@@ -62,12 +49,11 @@ public class SpReceiverService extends ReceiverService {
|
|||||||
super(rabbitTemplate, amqpProperties);
|
super(rabbitTemplate, amqpProperties);
|
||||||
this.spSenderService = spSenderService;
|
this.spSenderService = spSenderService;
|
||||||
this.deviceUpdater = deviceUpdater;
|
this.deviceUpdater = deviceUpdater;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the incoming Message from Queue with the property
|
* Handle the incoming Message from Queue with the property
|
||||||
* (com.bosch.sp.lwm2m.connector.amqp.receiverConnectorQueueFromSp).
|
* (hawkbit.device.simulator.amqp.receiverConnectorQueueFromSp).
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the incoming message
|
* the incoming message
|
||||||
|
|||||||
@@ -7,11 +7,7 @@
|
|||||||
# http://www.eclipse.org/legal/epl-v10.html
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
#
|
#
|
||||||
|
|
||||||
|
## Configuration for DMF communication
|
||||||
#########################################################################################
|
|
||||||
# PUBLIC configuration, i.e. can be changed by users at runtime (defaults provided here)
|
|
||||||
#########################################################################################
|
|
||||||
## Configuration for RabbitMQ communication
|
|
||||||
hawkbit.device.simulator.amqp.receiverConnectorQueueFromSp=simulator_receiver
|
hawkbit.device.simulator.amqp.receiverConnectorQueueFromSp=simulator_receiver
|
||||||
hawkbit.device.simulator.amqp.deadLetterQueue=simulator_deadletter
|
hawkbit.device.simulator.amqp.deadLetterQueue=simulator_deadletter
|
||||||
hawkbit.device.simulator.amqp.deadLetterExchange=simulator.deadletter
|
hawkbit.device.simulator.amqp.deadLetterExchange=simulator.deadletter
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
# hawkBit Example Application
|
# hawkBit Example Application
|
||||||
The hawkBit example application is a standalone spring-boot application with an embedded servlet container to start the hawkBit.
|
The hawkBit example application is a standalone spring-boot application with an embedded servlet container to host the hawkBit Update Server.
|
||||||
|
|
||||||
## Run
|
We have have described several options for you to get access to the example.
|
||||||
|
|
||||||
|
## Try out the example application in our hawkBit sandbox on Bluemix
|
||||||
|
- try out Management UI https://hawkbit.eu-gb.mybluemix.net/UI
|
||||||
|
- try out Management API https://hawkbit.eu-gb.mybluemix.net/rest/v1/targets (don't forget basic auth header)
|
||||||
|
- try out DDI API https://hawkbit.eu-gb.mybluemix.net/DEFAULT/controller/v1/MYTESTDEVICE
|
||||||
|
|
||||||
|
## On your own workstation
|
||||||
|
### Run
|
||||||
```
|
```
|
||||||
java -jar examples/hawkbit-example-app/target/hawkbit-example-app-*-SNAPSHOT.jar
|
java -jar examples/hawkbit-example-app/target/hawkbit-example-app-*-SNAPSHOT.jar
|
||||||
```
|
```
|
||||||
@@ -10,6 +18,13 @@ Or:
|
|||||||
run org eclipse.hawkbit.app.Start
|
run org eclipse.hawkbit.app.Start
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
### Usage
|
||||||
The UI can be accessed via _http://localhost:8080/UI_.
|
The Management UI can be accessed via http://localhost:8080/UI
|
||||||
The REST API can be accessed via _http://localhost:8080/rest/v1_.
|
The Management API can be accessed via http://localhost:8080/rest/v1
|
||||||
|
|
||||||
|
## Deploy example app to Cloud Foundry
|
||||||
|
|
||||||
|
- Go to ```cf``` subfolder.
|
||||||
|
- Select one of the two manifests
|
||||||
|
- **manifest-simple.yml** for a standalone hawkBit installation with embedded H2.
|
||||||
|
- **manifest.yml** for a standalone hawkBit installation with embedded H2 and RabbitMQ service binding for DMF integration (note: this manifest is used for the sandbox above).
|
||||||
|
|||||||
19
examples/hawkbit-example-app/cf/manifest-simple.yml
Normal file
19
examples/hawkbit-example-app/cf/manifest-simple.yml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
#
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
---
|
||||||
|
applications:
|
||||||
|
- name: hawkbit-simple
|
||||||
|
memory: 1024M
|
||||||
|
instances: 1
|
||||||
|
buildpack: https://github.com/cloudfoundry/java-buildpack
|
||||||
|
path: ${project.build.finalName}.jar
|
||||||
|
env:
|
||||||
|
SPRING_PROFILES_ACTIVE: cloudsandbox
|
||||||
|
CF_STAGING_TIMEOUT: 15
|
||||||
|
CF_STARTUP_TIMEOUT: 15
|
||||||
21
examples/hawkbit-example-app/cf/manifest.yml
Normal file
21
examples/hawkbit-example-app/cf/manifest.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
#
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
---
|
||||||
|
applications:
|
||||||
|
- name: hawkbit
|
||||||
|
memory: 1024M
|
||||||
|
instances: 1
|
||||||
|
buildpack: https://github.com/cloudfoundry/java-buildpack
|
||||||
|
path: ${project.build.finalName}.jar
|
||||||
|
services:
|
||||||
|
- dmf-rabbit
|
||||||
|
env:
|
||||||
|
SPRING_PROFILES_ACTIVE: cloudsandbox,amqp
|
||||||
|
CF_STAGING_TIMEOUT: 15
|
||||||
|
CF_STARTUP_TIMEOUT: 15
|
||||||
@@ -39,6 +39,17 @@
|
|||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>cf</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<targetPath>${project.build.directory}</targetPath>
|
||||||
|
<includes>
|
||||||
|
<include>manifest.yml</include>
|
||||||
|
<include>manifest-simple.yml</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
#
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
|
||||||
|
spring.profiles.active=
|
||||||
|
vaadin.servlet.productionMode=true
|
||||||
Reference in New Issue
Block a user