Hono - Docker for AWS installation
See original GitHub issueHello Hono Guru,
I got a question regarding deploying Hono using Docker Swarms on AWS. I was able to run Docker Swarms (i.e., one Swarm Manager and five Worker nodes) using CloudFormation and deployed the containers comprising a Hono instance to an existing Docker Swarm based on the swarm_deploy.sh
script and it was successfully deployed.
export DOCKER_HOST=tcp://18.212.195.15:22
~/Desktop/hono-master-3/example/target/deploy$ cd docker/
~/Desktop/hono-master-3/example/target/deploy/docker$ sudo ./swarm_deploy.sh
DEPLOYING ECLIPSE HONO TO DOCKER SWARM
0xztxrqhxariteqjk0kjjx2ok
luvp6cqsezhwr6blcspl143k5
Deploying Influx DB and Grafana ...
x9d4qmskal2tg3br7ariliwwa
unknown flag: --detach
See 'docker service create --help'.
unknown flag: --detach
See 'docker service create --help'.
... done
Deploying Artemis broker ...
p93ugwlhvctovyqzewrwvbvly
hxhkqifv72hgfx6wo4y35sj2c
o1a1pm6w7o3wvmtf4nb1fa2bd
t7lhtd7ziebwa4i83mw5r9806
f0s5b4cvip95il95rvg66ekm1
9evfchl6irinrzrxk9hdsn3cc
8fp0trejdxmzzey5gbxmvz6yf
z8bppuia4z8z7q96c28tw06z7
8hbd0j3m343x2va7dwt90oy94
unknown flag: --detach
See 'docker service create --help'.
... done
Deploying Qpid Dispatch Router ...
baehvq06eufcouylkba2j1uvb
xoh3ehppbobx3jxf44r3frfsp
tx6gd0g4ssbazatrc5rr0kfcw
ug5bu6dl3kt2vxq89w26q1dsi
sp3zkteg5uxo0ultjeuosdh9j
unknown flag: --detach
See 'docker service create --help'.
... done
Deploying Authentication Server ...
plnjjv8m6f5o62zhyk1oswsx6
kdznvqlq4sm1hvjozkaj6vec5
gr6q61z8pvhztw22kpjuhnbq9
b59ueobdqp8ountm3uk0jmfgy
unknown flag: --detach
See 'docker service create --help'.
... done
Deploying Device Registry ...
gtfcr9sm8g328l0ur2h54wpo5
hntyb76dgr5of6wig52b9foxz
n5yihnb180a773dvv3mqri0n5
unknown flag: --detach
See 'docker service create --help'.
Deploying Hono Messaging ...
mfqu1p7ysxs7whtbvvvewyn4n
rrdzqkam9fd4z20wwyh9svlnn
bzly7tipni254xq5yzre2cbp2
unknown flag: --detach
See 'docker service create --help'.
... done
Deploying HTTP adapter ...
zjx1ncoh07r8rboumt4c2hz97
kuw2dv7ym38r2p8pecjx6p8ei
i1edkjpodfczwffcfpe5tvu2y
7p26qf45oxln21tw3fim1k0gm
unknown flag: --detach
See 'docker service create --help'.
... done
Deploying MQTT adapter ...
wvxm9ogmg3gt2k7y5vmu4rykm
8ud4a2t365rds4v5q8ot3v56m
88f0scqgb4vgtlnl3uedt4vr2
x3efbeeloh3lbzhqtvrcbci5d
unknown flag: --detach
See 'docker service create --help'.
... done
Deploying Kura adapter ...
nxi0v6x32ku7z0gtr1exfkm3y
0hrtnnxiidzac5qy9tzwnmbf5
8y2xhkivkajlldlas6mib00c5
tv22e095tnlv7y3s8oc88jxna
unknown flag: --detach
See 'docker service create --help'.
... done
Configuring Grafana ...
Waiting for Grafana service at 127.0.0.1:3000 to come up...
.. Grafana is up, set its datasource and dashboard
HTTP/1.1 409 Conflict
Content-Type: application/json
Date: Thu, 11 Oct 2018 22:55:46 GMT
Content-Length: 55
{"message":"Data source with same name already exists"}HTTP/1.1 100 Continue
HTTP/1.1 412 Precondition Failed
Content-Type: application/json
Date: Thu, 11 Oct 2018 22:55:46 GMT
Content-Length: 96
{"message":"A dashboard with the same name in the folder already exists","status":"name-exists"}... done
ECLIPSE HONO DEPLOYED TO DOCKER SWARM
Now, getting to the Custom Configuration step to employ Docker Swarm’s Secret; I created a copy of the permissions.json in the ~/tmp$ folder (i.e., my-permissions.json), added new-user@HONO element at the end of the my-permissions.json
file, added docker secret create
for the same file, and added the hono.auth.svc.permissionsPath
property pointing to the custom property hono-service-auth-config.yml
file.
Building the deploy script is successful
sudo mvn install
[sudo] password for moaly:
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO] ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Hono Examples 0.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- buildnumber-maven-plugin:1.4:create-timestamp (default) @ hono-example ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-no-snapshots) @ hono-example ---
[INFO] Skipping Rule Enforcement.
[INFO]
[INFO] --- maven-dependency-plugin:3.0.2:unpack-dependencies (copy_demo_certs) @ hono-example ---
[INFO] org.eclipse.hono:hono-demo-certs:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-service-auth:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-service-messaging:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-service-device-registry:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-adapter-http-vertx:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-adapter-mqtt-vertx:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-adapter-kura:jar:0.6-SNAPSHOT already exists in destination.
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ hono-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Copying 32 resources to /home/moaly/Desktop/hono-master-3/example/target/deploy
[INFO] Copying 16 resources to /home/moaly/Desktop/hono-master-3/example/target/sandbox
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:copy-resources (create_docker_config_files) @ hono-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 16 resources to deploy/docker
[INFO] Copying 2 resources to deploy/docker/qpid
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:copy-resources (create_kubernetes_config_files) @ hono-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 16 resources to deploy/kubernetes
[INFO] Copying 2 resources to deploy/kubernetes/qpid
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:copy-resources (create_openshift_config_files) @ hono-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 16 resources to deploy/openshift
[INFO] Copying 2 resources to deploy/openshift/qpid
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ hono-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ hono-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/moaly/Desktop/hono-master-3/example/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ hono-example ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.20.1:test (default-test) @ hono-example ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-dependency-plugin:3.0.2:unpack-dependencies (copy_legal_docs) @ hono-example ---
[INFO] org.eclipse.hono:hono-legal:jar:0.6-SNAPSHOT already exists in destination.
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ hono-example ---
[INFO] Building jar: /home/moaly/Desktop/hono-master-3/example/target/hono-example-0.6-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.8.RELEASE:repackage (default) @ hono-example ---
[INFO]
[INFO] --- maven-assembly-plugin:3.0.0:single (eclipse-hono) @ hono-example ---
[INFO] Reading assembly descriptor: src/main/assembly/hono.xml
[INFO] Building tar: /home/moaly/Desktop/hono-master-3/example/target/eclipse-hono-example-0.6-SNAPSHOT.tar.gz
[INFO]
[INFO] --- maven-source-plugin:3.0.1:jar-no-fork (attach-sources) @ hono-example ---
[INFO] Building jar: /home/moaly/Desktop/hono-master-3/example/target/hono-example-0.6-SNAPSHOT-sources.jar
[INFO]
[INFO] --- maven-checkstyle-plugin:2.17:check (checkstyle-check) @ hono-example ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ hono-example ---
[INFO] Installing /home/moaly/Desktop/hono-master-3/example/target/hono-example-0.6-SNAPSHOT.jar to /root/.m2/repository/org/eclipse/hono/hono-example/0.6-SNAPSHOT/hono-example-0.6-SNAPSHOT.jar
[INFO] Installing /home/moaly/Desktop/hono-master-3/example/pom.xml to /root/.m2/repository/org/eclipse/hono/hono-example/0.6-SNAPSHOT/hono-example-0.6-SNAPSHOT.pom
[INFO] Installing /home/moaly/Desktop/hono-master-3/example/target/hono-example-0.6-SNAPSHOT-sources.jar to /root/.m2/repository/org/eclipse/hono/hono-example/0.6-SNAPSHOT/hono-example-0.6-SNAPSHOT-sources.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.516 s
[INFO] Finished at: 2018-10-11T18:52:40-04:00
[INFO] Final Memory: 36M/578M
[INFO] ------------------------------------------------------------------------
but when deploying and starting up the stack using the custom permissions, I get “connection to server [localhost:5671] already closed” and the consumer doesn’t start (although it returns build success at the end). Also,
[vert.x-eventloop-thread-1] INFO o.e.h.a.i.FileBasedAuthenticationService - loading permissions from resource file:/run/secrets/my-permissions.json
does not appear in the log output of the Auth Server.
sudo mvn spring-boot:run -Drun.profiles=sender,ssl -Drun.arguments=--hono.client.username=new-user@HONO,--hono.client.password=mypassword,--hono.client.hostname=54.237.194.228
[sudo] password for moaly:
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO] ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Hono Examples 0.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) > test-compile @ hono-example >>>
[INFO]
[INFO] --- buildnumber-maven-plugin:1.4:create-timestamp (default) @ hono-example ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-no-snapshots) @ hono-example ---
[INFO] Skipping Rule Enforcement.
[INFO]
[INFO] --- maven-dependency-plugin:3.0.2:unpack-dependencies (copy_demo_certs) @ hono-example ---
[INFO] org.eclipse.hono:hono-demo-certs:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-service-auth:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-service-messaging:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-service-device-registry:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-adapter-http-vertx:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-adapter-mqtt-vertx:jar:0.6-SNAPSHOT already exists in destination.
[INFO] org.eclipse.hono:hono-adapter-kura:jar:0.6-SNAPSHOT already exists in destination.
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ hono-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Copying 32 resources to /home/moaly/Desktop/hono-master-3/example/target/deploy
[INFO] Copying 16 resources to /home/moaly/Desktop/hono-master-3/example/target/sandbox
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:copy-resources (create_docker_config_files) @ hono-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 16 resources to deploy/docker
[INFO] Copying 2 resources to deploy/docker/qpid
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:copy-resources (create_kubernetes_config_files) @ hono-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 16 resources to deploy/kubernetes
[INFO] Copying 2 resources to deploy/kubernetes/qpid
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:copy-resources (create_openshift_config_files) @ hono-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 16 resources to deploy/openshift
[INFO] Copying 2 resources to deploy/openshift/qpid
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ hono-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ hono-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/moaly/Desktop/hono-master-3/example/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ hono-example ---
[INFO] No sources to compile
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) < test-compile @ hono-example <<<
[INFO]
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) @ hono-example ---
______ _ _ _ _
| ____| | (_) | | | |
| |__ ___| |_ _ __ ___ ___ | |__| | ___ _ __ ___
| __| / __| | | '_ \/ __|/ _ \ | __ |/ _ \| '_ \ / _ \
| |___| (__| | | |_) \__ \ __/ | | | | (_) | | | | (_) |
|______\___|_|_| .__/|___/\___| |_| |_|\___/|_| |_|\___/
| |
|_|
Eclipse Hono Example Client
using Spring Boot (v1.5.8.RELEASE)
Go to https://www.eclipse.org/hono for more information.
18:58:14.337 [main] INFO org.eclipse.hono.example.Application - Starting Application on m4122-01 with PID 29843 (/home/moaly/Desktop/hono-master-3/example/target/classes started by root in /home/moaly/Desktop/hono-master-3/example)
18:58:14.341 [main] INFO org.eclipse.hono.example.Application - The following profiles are active: sender,ssl
18:58:14.393 [main] INFO o.s.c.a.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7fff42a4: startup date [Thu Oct 11 18:58:14 EDT 2018]; root of context hierarchy
18:58:15.044 [main] INFO org.eclipse.hono.example.Application - Starting example client in role sender,ssl
18:58:15.528 [main] INFO org.eclipse.hono.example.Application - Started Application in 1.562 seconds (JVM running for 6.303)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.968 s
[INFO] Finished at: 2018-10-11T18:58:15-04:00
[INFO] Final Memory: 37M/571M
[INFO] ------------------------------------------------------------------------
18:58:15.768 [Thread-4] INFO o.s.c.a.AnnotationConfigApplicationContext - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@7fff42a4: startup date [Thu Oct 11 18:58:14 EDT 2018]; root of context hierarchy
18:58:15.777 [vert.x-eventloop-thread-0] INFO o.e.hono.client.impl.HonoClientImpl - connection to server [localhost:5671] already closed
Observation: after modifying and saving the deploy script, everything reverts back to the original script (attached: swarm_deploy_original.sh) after mvn install
and sudo mvn spring-boot:run -Drun.profiles=sender,ssl -Drun.arguments=--hono.client.username=new-user@HONO,--hono.client.password=mypassword,--hono.client.hostname=54.237.194.228
to start the consumer. I used both the IPs (Swarm Manager and Worker) in the --hono.client.hostname=
, but did not work out.
Custom_Configuration_AWS_Docker_Swarm_HONO.zip
Should the custom configuration shown above be tweaked to have the consumer started? Thank you in advance for your assistance.
Issue Analytics
- State:
- Created 5 years ago
- Comments:32 (14 by maintainers)
Top GitHub Comments
I faced the same thing and what I did is that I specified the full path to the .yml (e.g.: /home/… /hono/deploy/src/main/config/hono-service-auth-config.yml) inside the “
swarm_deploy.sh
” instead of $CONFIG/hono-service-auth-config.yml. The same thing applies to “hono-service-auth-config.yml
” ,permissionpath
is pointed to (e.g.: file://home/…/Documents/my-permissions.json). I just changed the location of the.json
file instead of having it in the /tmp directory. The deployment went fine and was able to retrieve all services usingdocker service ls
command.Regarding the consumer, I am also in the same situation. I am not able to start it to send telemetry msgs. I had the
localhost
changed to the IP address of the DockerManager on AWS, but it throws the connection closed exception.I tried the Start Consumer commands in the Getting Started documentation with:
[Thread-4] INFO o.e.hono.client.impl.HonoClientImpl - connection to server [100.24.22.171:15671] already closed
;tcp://
); -->[Thread-4] INFO o.e.hono.client.impl.HonoClientImpl - connection to server [52.178.63.110:15671] already closed
;[Thread-4] INFO o.e.hono.client.impl.HonoClientImpl - connection to server [52.178.63.110:22:15671] already closed
.the same behaviour as reported above. Any further helpful suggestions please?
I am sorry but I cannot help you with setting up and using Docker Swarm on AWS. Please refer to the documentation provided by Docker: https://docs.docker.com/docker-for-aws/deploy/