redhat-helloworld-msa / aloha

Microservice using Vert.x
Apache License 2.0
11 stars 65 forks source link

Unable to reach service end point #5

Closed hferentschik closed 8 years ago

hferentschik commented 8 years ago

Following these instructions:

$ oc new-app --name aloha vertx-s2i~https://github.com/redhat-helloworld-msa/aloha -l hystrix.enabled=true
$ oc delete service aloha; oc expose dc aloha --port=8080
$ oc expose service aloha
$ oc logs -f bc/aloha

I get the aloha service, deployed, but when trying to get a response from http://aloha-helloworld-msa.rhel-cdk.10.1.2.2.xip.io/api/aloha, I just keep getting

<html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>

The build completed successfully and there is nothing special in the logs:

Service running at 0.0.0.0:8080
[BonjourService#bonjour] ---> GET http://bonjour:8080/api/bonjour HTTP/1.1
[BonjourService#bonjour] <--- HTTP/1.1 200 OK (169ms)
[BonjourService#bonjour] ---> GET http://bonjour:8080/api/bonjour HTTP/1.1
[BonjourService#bonjour] <--- HTTP/1.1 200 OK (14ms)
[BonjourService#bonjour] ---> GET http://bonjour:8080/api/bonjour HTTP/1.1
[BonjourService#bonjour] <--- HTTP/1.1 200 OK (13ms)
[BonjourService#bonjour] ---> GET http://bonjour:8080/api/bonjour HTTP/1.1
[BonjourService#bonjour] <--- HTTP/1.1 200 OK (97ms)
[BonjourService#bonjour] ---> GET http://bonjour:8080/api/bonjour HTTP/1.1
[BonjourService#bonjour] <--- HTTP/1.1 200 OK (14ms)
rafabene commented 8 years ago

Humm. That's odd as well. I couldn't replicate the issue. Can you send me the output of your "oc status"?

Thanks

hferentschik commented 8 years ago

Ok, here is what I do. First I delete everything:

oc delete is/aloha
oc delete bc/aloha
oc delete dc/aloha
oc delete service/aloha
oc delete rc/aloha

Then I make sure I use the latest source. I am at #f9620c5a4e1cd8c6f438b12ad01286bcbd229ae1 which changed to using aloha-fat.jar.

Then I run:

mvn clean package docker:build fabric8:json fabric8:apply

The build completes successfully and I can see the aloha service in the console.

The oc status of aloha:

svc/aloha - 172.30.103.158:8080
  rc/aloha runs redhatmsa/aloha:0.0.1-SNAPSHOT
    rc/aloha created 2 days ago - 1 pod
  exposed by route/aloha on pod port 5701-tcp 

Seem odd with port 5701!? Trying to access the service leads to "503 Service Unavailable".

I start over and try this

$ oc new-app --name aloha vertx-s2i~https://github.com/redhat-helloworld-msa/aloha -l app=aloha,hystrix.enabled=true
$ oc delete service aloha; oc expose dc aloha --port=8080
$ oc expose service aloha

Same problem.

Also note, that the last 'expose service' seems unnecessary:

$ oc delete service aloha; oc expose dc aloha --port=8080
 service "aloha" deleted
 service "aloha" exposed
$ oc expose service aloha
  Error from server: routes "aloha" already exists
hferentschik commented 8 years ago

Funny, if I get a terminal onto the host and run curl, I get the following:

$ curl localhost:8080/api/aloha                                                                      
Aloha mai aloha
hferentschik commented 8 years ago

For what it's worth, I got it to work by running oc expose dc aloha --port=8080 and then exposing the route in the console. Something is fishy here, but I have not digged any deeper yet.

rafabene commented 8 years ago

Aha!!! It seems that you "deleted everything" but the route :) It missed "oc delete route/aloha". Then the later "oc expose" failed to create the route to the proper service because there was an old route pointing to the service created previously by "mvn ... fabric8:apply".

Regarding the port 5701. There's an issue opened at https://github.com/vert-x3/vertx-openshift-s2i/issues/2 regarding to it.

hferentschik commented 8 years ago

Aha!!! It seems that you "deleted everything" but the route :) It missed "oc delete route/aloha". Then the later "oc expose" failed to create the route to the proper service because there was an old route pointing to the service created previously by "mvn ... fabric8:apply".

Ahh, makes sense. So how comes the instructions are different between the README for ALOHA itself and what's in the README of the main repository?

I guess now that there is an app label as well, it might be easier to delete all resources.

Regarding the port 5701. There's an issue opened at vert-x3/vertx-openshift-s2i#2 regarding to it.

I see. Thanks.

rafabene commented 8 years ago

the Readme for aloha justa covers the installation via Fabric8 plugin.

The Readme in the main repo covers two options: (Option 1: Deploy using Fabric8 plugin and Option 2: Create a Vert.x builder template/imagestream). You should use one of those two options.

Do you have any suggestions to make it more clear? Thanks

rafabene commented 8 years ago

I think we can close this issue.