tonyespy / edgex-core-snap

This repository contains a prototype of EdgeX Foundry as a snap, and now should be considered **deprecated**, please see the official EdgeX Foundry main github project:
https://github.com/edgexfoundry/edgex-go
Apache License 2.0
5 stars 3 forks source link

device-virtual property overrides in start script may not be working properly #3

Open tonyespy opened 6 years ago

tonyespy commented 6 years ago

If device-virtual is started from the edgex-core-snap (0.5.1+cali-20180322), the log file (edgex-device-virtual.log) is properly created in $SNAP_COMMON, however the contents of the log file only appear to include spring framework INFO log messages whereas the log messages written to the terminal used to run the start script include DEBUG and ERROR messages.

Here's an example of the messages seen in the log file:

2018-03-22 13:13:09.436 INFO 27577 --- [main] s.c.a.AnnotationConfigApplicationContex t : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationConte xt@722c41f4: startup date [Thu Mar 22 13:13:09 EDT 2018]; root of context hierarchy

It also looks like the property override for consul=enabledisn't working properly either, as I if i hit the Consul services UI, device-virtual isn't shown:

http://localhost:8500/ui/#/dc1/services

The command line in bin/start-edgex.sh uses the following command-line to start device-virtual:

$JAVA -jar -Djava.security.egd=file:/dev/urandom -Xmx100M \ -Dspring.cloud.consul.enabled=true \ -Dlogging.level.org.edgexfoundry=DEBUG \ -Dlogging.file=$SNAP_COMMON/edgex-device-virtual.log \ -Dapplication.device-profile-paths=$SNAP_COMMON/bacnetprofiles,$SNAP\ COMMON/modbus_profiles \ $SNAP/jar/device-virtual/device-virtual.jar &

The snap was installed on an amd64 machine running Ubuntu 16.04 LTS Desktop.

tonyespy commented 6 years ago

Note, it looks like the property override for consul=enabled isn't working properly, as I if i hit the Consul services UI, device-virtual isn't shown:

http://localhost:8500/ui/#/dc1/services

tonyespy commented 6 years ago

It turns out the fact that I was setting spring.cloud.consul.enabled=true is the culprit, at least for the device-profile-paths property. Basically, when consul is enabled, a service reads its properties from Consul, which overrides any local configuration, which includes properties set on the command-line. So for now, I'm changing consul.enabled=false for now.

In order to fix this properly, we'd need to create profile-specific property files for the snap (eg. device-virtual;snap) in core-config-seed, and then specify profile=snap on the command line.