cloudfoundry-community / spring-service-broker

Spring MVC framework app for V2 CloudFoundry service brokers
10 stars 41 forks source link

Questions and Ideas #1

Open jhiemer opened 10 years ago

jhiemer commented 10 years ago

First of all, thanks a lot for this nice sample. Regarding your implementation I have a few questions about the code itself and in general:

What do you recommend regarding size and number of instances for a broker? Is it best practice to put them into a separate organisation (e.g. services) and then conclude those into different spaces (e.g. logging, queuing, sql...) etc.?

spgreenberg commented 10 years ago

Johannes,

I apologize for the delay in responding. I have been traveling this week.

The broker-catalog.xml isn't configured in the master branch. It is configured in the root-context.xml in the mongodb example branch: https://github.com/cloudfoundry-community/spring-service-broker/blob/mongodb/src/main/webapp/WEB-INF/spring/root-context.xml. The master branch is really just boilerplate while the mongodb branch is a full example.

Sizing is dependent on what your broker is doing. For example, if you are performing all stateless and fast operations on a data source (creating a mongo db in an existing cluster) you need less resources per request than if you are doing heavier manipulations to a data store (spinning up a new mongo cluster). Personally, I like deploying brokers directly as apps to CF because you can easily scale and manage routes as needed. If you are looking at a production deployment, I would say a minimum of two instances is in order solely for redundancy.

As for organizations, I honestly have not thought about creating a services org but I think it is a great idea. If you have other ideas around this, I would like to hear them.

Thanks for reaching out and getting involved. I would like to merge your spring 4 changes (and any other changes/enhancements) back into the project if you are comfortable with it. This started as a learning experiment, but I believe it can continue to evolve and add value to the community.

Best, Steve

On Thu, Feb 13, 2014 at 7:15 AM, Johannes Hiemer notifications@github.comwrote:

First of all, thanks a lot for this nice sample. Regarding your implementation I have a few questions about the code itself and in general:

  • I migrated the project to Spring 4.0.1 in the first. Currently the project is still running with xml, but I am going to migrate the project to Java WebConfig. I was only able to get the project running, after moving broker-catalog.xml to the servlet-context.xml. I was not able (perhaps I oversaw it), where you defined the inclusion of broker-catalog.xml?

What do you recommend regarding size and number of instances for a broker? Is it best practice to put them into a separate organisation (e.g. services) and then conclude those into different spaces (e.g. logging, queuing, sql...) etc.?

Reply to this email directly or view it on GitHubhttps://github.com/cloudfoundry-community/spring-service-broker/issues/1 .

jhiemer commented 10 years ago

Hi Steve, thanks a lot for your response and no problem regarding the delay. Happens to me as well, when I am travelling. :-)

Regarding the sizes I was asking, because I have only a small deployment environment on Openstack, which has no really heavy load. So there is no experience on my side. My thoughts were quite similar to yours. I think in most cases it is also a matter of experience. Perhaps some developments like the scaler would help here as well: https://github.com/nttlabs/bosh-scaler/blob/master/config/sample.yml

I pushed to commits with Java Config for the default template and the MongoDB branch. You might take look on it. If you want, I would to highly appreciate to commit a pull-req and add value to the community. Sources can be found here: https://github.com/jhiemer/cf-spring-service-broker https://github.com/jhiemer/cf-spring-service-broker-mongodb On my ToDo list are service brokers for Postgres and RabbitMQ as well. Then I would have a solid broker landscape for our internal testing environment.

Perhaps what might be interesting for your as well is: https://github.com/jhiemer/cf-spring-web-management-console

It is build on the same stack. Spring 4 MVC with pure Java Config and in the frontend AngularJS. Honestly displaying services in this UI was the reason I stumbled over your blog entry. :-) An Idea I had here was for the admin part, to integrate the management of existing services, plans, tags etc. via UI. That's something I will be working on this weekend.

Wish you a nice weekend, Johannes

jhiemer commented 10 years ago

Hi Steve, further insights or misunderstanding from my side follows now: :-)

I added the logging/mongodb as a service to my service organisation. Afterwards I had to do a cf curl PUT /v2/service_plans/60694318-40a6-496a-b58d-b940b39a26fa -b '{"public":"true"}'to be able to assign the services from others organisation. That feels quite hacky. Is this the preferred way to go?

Afterwards I tried to do a:

cf create-service -t

As an error was thrown, I traced the output (minor relevant output is removed, due to more readability):

1: MongoDB , via 
2: logging , via 
3: user-provided , via 
What kind?> 2

Name?> logging-ad5da

1: logging-base: base logging plan
Which plan?> 1

Creating service logging-ad5da.  >>>
REQUEST: POST http://api.192.168.1.222.xip.io/v2/service_instances
REQUEST_HEADERS:
  Accept : application/json
  Authorization : [PRIVATE DATA HIDDEN]
  Content-Length : 135
  Content-Type : application/json
REQUEST_BODY: {"name":"logging-ad5da","service_plan_guid":"60694318-40a6-496a-b58d-b940b39a26fa","space_guid":"541ad3a1-d46e-493a-9423-f90ac98a8dc8"}
.. RESPONSE: [500]
RESPONSE_HEADERS:
  content-length : 9655
  content-type : application/json;charset=utf-8
  date : Sun, 16 Feb 2014 12:38:51 GMT
  server : nginx
  x-content-type-options : nosniff
  x-vcap-request-id : 95d1bedb-5425-4130-89b1-7f74705d0048
RESPONSE_BODY:
{"code":10001,"description":"The service broker API returned an error from http://logging.192.168.1.222.xip.io/v2/service_instances/d0f32d52-0167-482f-b8f7-fb0391d91328: 403 Forbidden","error_code":"CF-ServiceBrokerBadResponse",

What makes we wonder here is the request body with:

{"name":"logging-ad5da","service_plan_guid":"60694318-40a6-496a-b58d-b940b39a26fa","space_guid":"541ad3a1-d46e-493a-9423-f90ac98a8dc8"}

to http://api.192.168.1.222.xip.io/v2/service_instances

I checked the guids and all the stuff. Nothing seems wrong here, but as you can see I still get 403 forbidden. Is there still something I am doing wrong?

jhiemer commented 10 years ago

@spgreenberg still out there? :-)

spgreenberg commented 10 years ago

I have been watching the bosh-scaler project anxiously as well. It looks like a great project.

I would be happy to incorporate a pull request. I am hoping more people can continue to get involved and keep evolving the code base.

I really like the idea of managing services (or even just having visibility) through a UI. It is a current gap for sure.

Any reason you implemented a maven build? Just curious more than anything.

On Sat, Feb 15, 2014 at 4:25 AM, Johannes Hiemer notifications@github.comwrote:

Hi Steve, thanks a lot for your response and no problem regarding the delay. Happens to me as well, when I am travelling. :-)

Regarding the sizes I was asking, because I have only a small deployment environment on Openstack, which has no really heavy load. So there is no experience on my side. My thoughts were quite similar to yours. I think in most cases it is also a matter of experience. Perhaps some developments like the scaler would help here as well: https://github.com/nttlabs/bosh-scaler/blob/master/config/sample.yml

I pushed to commits with Java Config for the default template and the MongoDB branch. You might take look on it. If you want, I would to highly appreciate to commit a pull-req and add value to the community. Sources can be found here: https://github.com/jhiemer/cf-spring-service-broker https://github.com/jhiemer/cf-spring-service-broker-mongodb On my ToDo list are service brokers for Postgres and RabbitMQ as well. Then I would have a solid broker landscape for our internal testing environment.

Perhaps what might be interesting for your as well is: https://github.com/jhiemer/cf-spring-web-management-console

It is build on the same stack. Spring 4 MVC with pure Java Config and in the frontend AngularJS. Honestly displaying services in this UI was the reason I stumbled over your blog entry. :-) An Idea I had here was for the admin part, to integrate the management of existing services, plans, tags etc. via UI. That's something I will be working on this weekend.

Wish you a nice weekend, Johannes

Reply to this email directly or view it on GitHubhttps://github.com/cloudfoundry-community/spring-service-broker/issues/1#issuecomment-35153484 .

spgreenberg commented 10 years ago

Unfortunately, the CURL request is a necessary hack. It is documented, but not ideal. I believe there are stories in the backlog to address this and manage visibility of plans through the cf client.

As for the error, I have a few questions: how did you register the broker? Are you sure you have the correct username & pwd getting passed to the cloud controller? Is your service broker deployed as an app to CF? If so, can you see anything in the logs? What version of cf-release are you using? It is odd that you have what looks like a 500 response under the REQUEST_BODY and yet a 403.

I took a look on github and didn't see a "logging" broker code base. I would be happy to clone it and try to deploy it tomorrow to see if I can help troubleshoot.

On Sun, Feb 16, 2014 at 5:54 AM, Johannes Hiemer notifications@github.comwrote:

Hi Steve, further insights or misunderstanding from my side follows now: :-)

I added the logging/mongodb as a service to my service organisation. Afterwards I had to do a cf curl PUT /v2/service_plans/60694318-40a6-496a-b58d-b940b39a26fa -b '{"public":"true"}'to be able to assign the services from others organisation. That feels quite hacky. Is this the preferred way to go?

Afterwards I tried to do a:

cf create-service -t

As an error was thrown, I traced the output (minor relevant output is removed, due to more readability):

1: MongoDB , via 2: logging , via 3: user-provided , via What kind?> 2

Name?> logging-ad5da

1: logging-base: base logging plan Which plan?> 1

Creating service logging-ad5da. >>> REQUEST: POST http://api.192.168.1.222.xip.io/v2/service_instances REQUEST_HEADERS: Accept : application/json Authorization : [PRIVATE DATA HIDDEN] Content-Length : 135 Content-Type : application/json REQUEST_BODY: {"name":"logging-ad5da","service_plan_guid":"60694318-40a6-496a-b58d-b940b39a26fa","space_guid":"541ad3a1-d46e-493a-9423-f90ac98a8dc8"} .. RESPONSE: [500] RESPONSE_HEADERS: content-length : 9655 content-type : application/json;charset=utf-8 date : Sun, 16 Feb 2014 12:38:51 GMT server : nginx x-content-type-options : nosniff x-vcap-request-id : 95d1bedb-5425-4130-89b1-7f74705d0048 RESPONSE_BODY: {"code":10001,"description":"The service broker API returned an error from http://logging.192.168.1.222.xip.io/v2/service_instances/d0f32d52-0167-482f-b8f7-fb0391d91328: 403 Forbidden","error_code":"CF-ServiceBrokerBadResponse",

What makes we wonder here is the request body with:

{"name":"logging-ad5da","service_plan_guid":"60694318-40a6-496a-b58d-b940b39a26fa","space_guid":"541ad3a1-d46e-493a-9423-f90ac98a8dc8"}

to http://api.192.168.1.222.xip.io/v2/service_instances

I checked the guids and all the stuff. Nothing seems wrong here, but as you can see I still get 403 forbidden. Is there still something I am doing wrong?

Reply to this email directly or view it on GitHubhttps://github.com/cloudfoundry-community/spring-service-broker/issues/1#issuecomment-35195986 .

jhiemer commented 10 years ago

I am using maven due to the fact that I had not time yet to work with gradle. :-)

I would be happy to incorporate a pull request. I am hoping more people can continue to get >involved and keep evolving the code base.

During the weekend I will have some time to make a pull request with Java config.

Unfortunately, the CURL request is a necessary hack. It is documented, but not ideal.

That would be really great, because it is not really good documented currently.

how did you register the broker? Are you sure you have the correct username & pwd getting passed to the cloud controller? Is your service broker deployed as an app to CF?

cf push --path=target/ssbt.war
....

cf add-service-broker log
URL> http://logging.192.168.1.222.xip.io

Username> admin

Password> cloudfoundry

Adding service broker log... OK

What version of cf-release are you using?

cf -v
cf 5.4.5

If so, can you see anything in the logs?

Log looks good so far.

cf logs logging
Getting logs for logging #0... OK

Reading logs/env.log... OK
TMPDIR=/home/vcap/tmp
VCAP_APP_PORT=61377
USER=vcap
VCAP_APPLICATION={"instance_id":"dd52fea95aca46908375be299a210b57","instance_index":0,"host":"0.0.0.0","port":61377,"started_at":"2014-02-16 12:57:44 +0000","started_at_timestamp":1392555464,"start":"2014-02-16 12:57:44 +0000","state_timestamp":1392555464,"limits":{"mem":256,"disk":1024,"fds":16384},"application_version":"c84425bc-4b68-4d4e-8b49-ae34697abb2d","application_name":"logging","application_uris":["logging.192.168.1.222.xip.io"],"version":"c84425bc-4b68-4d4e-8b49-ae34697abb2d","name":"logging","uris":["logging.192.168.1.222.xip.io"],"users":null}
PATH=/bin:/usr/bin
PWD=/home/vcap
VCAP_SERVICES={}
SHLVL=1
HOME=/home/vcap/app
PORT=61377
VCAP_APP_HOST=0.0.0.0
MEMORY_LIMIT=256m
_=/usr/bin/env

Reading logs/staging_task.log... OK
-----> Downloaded app package (8.8M)
-----> Downloading OpenJDK 1.7.0_51 from http://download.pivotal.io.s3.amazonaws.com/openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (45.1s)
       Expanding JRE to .java (0.8s)
-----> Downloading Spring Auto-reconfiguration 0.8.7 from http://download.pivotal.io.s3.amazonaws.com/auto-reconfiguration/auto-reconfiguration-0.8.7.jar (4.2s)
-----> Downloading Tomcat 7.0.50 from http://download.pivotal.io.s3.amazonaws.com/tomcat/tomcat-7.0.50.tar.gz (10.6s)
       Expanding Tomcat to .tomcat (0.1s)
-----> Downloading Buildpack Tomcat Support 1.1.1 from http://download.pivotal.io.s3.amazonaws.com/tomcat-buildpack-support/tomcat-buildpack-support-1.1.1.jar (0.3s)

Reading logs/stderr.log... OK
Feb 16, 2014 12:57:46 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-61377"]
Feb 16, 2014 12:57:46 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 349 ms
Feb 16, 2014 12:57:46 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Feb 16, 2014 12:57:46 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.50
Feb 16, 2014 12:57:46 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/vcap/app/.tomcat/webapps/ROOT
Feb 16, 2014 12:57:46 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/vcap/app/.tomcat/webapps/ROOT/WEB-INF/lib/javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Feb 16, 2014 12:57:49 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Feb 16, 2014 12:57:49 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Sun Feb 16 12:57:49 UTC 2014]; root of context hierarchy
Feb 16, 2014 12:57:49 PM org.springframework.web.context.support.AnnotationConfigWebApplicationContext loadBeanDefinitions
INFO: Registering annotated classes: [class com.pivotal.cf.config.security.CustomSecurityConfiguration]
Feb 16, 2014 12:57:50 PM org.springframework.security.web.DefaultSecurityFilterChain <init>
INFO: Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@67dcb3bf, org.springframework.security.web.context.SecurityContextPersistenceFilter@3d9a4a3d, org.springframework.security.web.header.HeaderWriterFilter@482f32d8, org.springframework.security.web.csrf.CsrfFilter@426fd2f7, org.springframework.security.web.authentication.logout.LogoutFilter@4c254927, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@4deac919, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@1d10729, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@1dea32cc, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@4a9cf5de, org.springframework.security.web.session.SessionManagementFilter@29f29436, org.springframework.security.web.access.ExceptionTranslationFilter@5a3452d9, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@9601d29]
Feb 16, 2014 12:57:50 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 647 ms
Feb 16, 2014 12:58:07 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [17,502] milliseconds.
Feb 16, 2014 12:58:07 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization started
Feb 16, 2014 12:58:07 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Sun Feb 16 12:58:07 UTC 2014]; parent: Root WebApplicationContext
Feb 16, 2014 12:58:07 PM org.springframework.web.context.support.AnnotationConfigWebApplicationContext loadBeanDefinitions
INFO: Registering annotated classes: [class com.pivotal.cf.config.web.CustomMvcConfiguration]
Feb 16, 2014 12:58:07 PM org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor intercept
WARNING: @Bean method CustomMvcConfiguration.properties is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method's declaring @Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @Bean Javadoc for complete details
Feb 16, 2014 12:58:07 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
INFO: Loading properties file from class path resource [application-mvc.properties]
Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/v2/service_instances/{instanceId}/service_bindings/{bindingId}],methods=[PUT],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<com.pivotal.cf.broker.model.ServiceInstanceBindingResponse> com.pivotal.cf.broker.controller.ServiceInstanceBindingController.bindServiceInstance(java.lang.String,java.lang.String,com.pivotal.cf.broker.model.ServiceInstanceBindingRequest) throws com.pivotal.cf.broker.exception.ServiceInstanceDoesNotExistException,com.pivotal.cf.broker.exception.ServiceInstanceBindingExistsException,com.pivotal.cf.broker.exception.ServiceBrokerException
Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/v2/service_instances/{instanceId}/service_bindings/{bindingId}],methods=[DELETE],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.lang.String> com.pivotal.cf.broker.controller.ServiceInstanceBindingController.deleteServiceInstanceBinding(java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws com.pivotal.cf.broker.exception.ServiceBrokerException
Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/v2/service_instances/{instanceId}],methods=[DELETE],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.lang.String> com.pivotal.cf.broker.controller.ServiceInstanceController.deleteServiceInstance(java.lang.String,java.lang.String,java.lang.String) throws com.pivotal.cf.broker.exception.ServiceBrokerException
Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/v2/service_instances],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<com.pivotal.cf.broker.model.ServiceInstance> com.pivotal.cf.broker.controller.ServiceInstanceController.getServiceInstances()
Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/v2/service_instances/{instanceId}],methods=[PUT],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<com.pivotal.cf.broker.model.CreateServiceInstanceResponse> com.pivotal.cf.broker.controller.ServiceInstanceController.createServiceInstance(java.lang.String,com.pivotal.cf.broker.model.CreateServiceInstanceRequest) throws com.pivotal.cf.broker.exception.ServiceDefinitionDoesNotExistException,com.pivotal.cf.broker.exception.ServiceInstanceExistsException,com.pivotal.cf.broker.exception.ServiceBrokerException
Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/v2/catalog],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public com.pivotal.cf.broker.model.Catalog com.pivotal.cf.broker.controller.CatalogController.getCatalog()
Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/resources/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler]
Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization completed in 909 ms
Feb 16, 2014 12:58:08 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-61377"]
Feb 16, 2014 12:58:08 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 21836 ms

Reading logs/stdout.log... OK
LOGBACK:12:58:08.408 [localhost-startStop-1] INFO  o.h.validator.internal.util.Version - HV000001: Hibernate Validator 5.0.2.Final

I took a look on github and didn't see a "logging" broker code base.

https://github.com/jhiemer/cf-spring-service-broker

Thanks a lot for your response! :-)

spgreenberg commented 10 years ago

cf v5.4.5 is the client CLI (command line interface). cf-release is the cloud foundry runtime you are deploying to (your open stack deployment). I will try to deploy the broker today to my local bosh-lite install and get back to you.

FYI - the ruby version of cf CLI (5.x) has been deprecated in favor of the new v6 written in go. https://github.com/cloudfoundry/cli

On Thu, Feb 20, 2014 at 1:43 AM, Johannes Hiemer notifications@github.comwrote:

I am using maven due to the fact that I had not time yet to work with gradle. :-)

I would be happy to incorporate a pull request. I am hoping more people can continue to get >involved and keep evolving the code base.

During the weekend I will have some time to make a pull request with Java config.

Unfortunately, the CURL request is a necessary hack. It is documented, but not ideal.

That would be really great, because it is not really good documented currently.

how did you register the broker? Are you sure you have the correct username & pwd getting passed to the cloud controller? Is your service broker deployed as an app to CF?

cf push --path=target/ssbt.war ....

cf add-service-broker log URL> http://logging.192.168.1.222.xip.io

Username> admin

Password> cloudfoundry

Adding service broker log... OK

What version of cf-release are you using?

cf -v cf 5.4.5

If so, can you see anything in the logs?

Log looks good so far.

cf logs logging Getting logs for logging #0... OK

Reading logs/env.log... OK TMPDIR=/home/vcap/tmp VCAP_APP_PORT=61377 USER=vcap VCAP_APPLICATION={"instance_id":"dd52fea95aca46908375be299a210b57","instance_index":0,"host":"0.0.0.0","port":61377,"started_at":"2014-02-16 12:57:44 +0000","started_at_timestamp":1392555464,"start":"2014-02-16 12:57:44 +0000","state_timestamp":1392555464,"limits":{"mem":256,"disk":1024,"fds":16384},"application_version":"c84425bc-4b68-4d4e-8b49-ae34697abb2d","application_name":"logging","application_uris":["logging.192.168.1.222.xip.io"],"version":"c84425bc-4b68-4d4e-8b49-ae34697abb2d","name":"logging","uris":["logging.192.168.1.222.xip.io"],"users":null} PATH=/bin:/usr/bin PWD=/home/vcap VCAP_SERVICES={} SHLVL=1 HOME=/home/vcap/app PORT=61377 VCAP_APP_HOST=0.0.0.0 MEMORYLIMIT=256m =/usr/bin/env

Reading logs/staging_task.log... OK -----> Downloaded app package (8.8M) -----> Downloading OpenJDK 1.7.0_51 from http://download.pivotal.io.s3.amazonaws.com/openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (45.1s) Expanding JRE to .java (0.8s) -----> Downloading Spring Auto-reconfiguration 0.8.7 from http://download.pivotal.io.s3.amazonaws.com/auto-reconfiguration/auto-reconfiguration-0.8.7.jar (4.2s) -----> Downloading Tomcat 7.0.50 from http://download.pivotal.io.s3.amazonaws.com/tomcat/tomcat-7.0.50.tar.gz (10.6s) Expanding Tomcat to .tomcat (0.1s) -----> Downloading Buildpack Tomcat Support 1.1.1 from http://download.pivotal.io.s3.amazonaws.com/tomcat-buildpack-support/tomcat-buildpack-support-1.1.1.jar (0.3s)

Reading logs/stderr.log... OK Feb 16, 2014 12:57:46 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-61377"] Feb 16, 2014 12:57:46 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 349 ms Feb 16, 2014 12:57:46 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Feb 16, 2014 12:57:46 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.50 Feb 16, 2014 12:57:46 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /home/vcap/app/.tomcat/webapps/ROOT Feb 16, 2014 12:57:46 PM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(/home/vcap/app/.tomcat/webapps/ROOT/WEB-INF/lib/javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class Feb 16, 2014 12:57:49 PM org.springframework.web.context.ContextLoader initWebApplicationContext INFO: Root WebApplicationContext: initialization started Feb 16, 2014 12:57:49 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing Root WebApplicationContext: startup date [Sun Feb 16 12:57:49 UTC 2014]; root of context hierarchy Feb 16, 2014 12:57:49 PM org.springframework.web.context.support.AnnotationConfigWebApplicationContext loadBeanDefinitions INFO: Registering annotated classes: [class com.pivotal.cf.config.security.CustomSecurityConfiguration] Feb 16, 2014 12:57:50 PM org.springframework.security.web.DefaultSecurityFilterChain INFO: Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@67dcb3bf, org.springframework.security.web.context.SecurityContextPersistenceFilter@3d9a4a3d, org.springframework.security.web.header.HeaderWriterFilter@482f32d8, org.springframework.security.web.csrf.CsrfFilter@426fd2f7, org.springframework.security.web.authentication.logout.LogoutFilter@4c254927, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@4deac919, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@1d10729, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@1dea32cc, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@4a9cf5de, org.springframework.security.web.session.SessionManagementFilter@29f29436, org.springframework.security.web.access.ExceptionTranslationFilter@5a3452d9, org.springfr amework.security.web.access.intercept.FilterSecurityInterceptor@9601d29] Feb 16, 2014 12:57:50 PM org.springframework.web.context.ContextLoader initWebApplicationContext INFO: Root WebApplicationContext: initialization completed in 647 ms Feb 16, 2014 12:58:07 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [17,502] milliseconds. Feb 16, 2014 12:58:07 PM org.springframework.web.servlet.FrameworkServlet initServletBean INFO: FrameworkServlet 'dispatcher': initialization started Feb 16, 2014 12:58:07 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Sun Feb 16 12:58:07 UTC 2014]; parent: Root WebApplicationContext Feb 16, 2014 12:58:07 PM org.springframework.web.context.support.AnnotationConfigWebApplicationContext loadBeanDefinitions INFO: Registering annotated classes: [class com.pivotal.cf.config.web.CustomMvcConfiguration] Feb 16, 2014 12:58:07 PM org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor intercept WARNING: @Bean method CustomMvcConfiguration.properties is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method's declaring @Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @Bean Javadoc for complete details Feb 16, 2014 12:58:07 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties INFO: Loading properties file from class path resource [application-mvc.properties] Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod INFO: Mapped "{[/v2/service_instances/{instanceId}/service_bindings/{bindingId}],methods=[PUT],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity com.pivotal.cf.broker.controller.ServiceInstanceBindingController.bindServiceInstance(java.lang.String,java.lang.String,com.pivotal.cf.broker.model.ServiceInstanceBindingRequest) throws com.pivotal.cf.broker.exception.ServiceInstanceDoesNotExistException,com.pivotal.cf.broker.exception.ServiceInstanceBindingExistsException,com.pivotal.cf.broker.exception.ServiceBrokerException Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod INFO: Mapped "{[/v2/service_instances/{instanceId}/service_bindings/{bindingId}],methods=[DELETE],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity com.pivotal.cf.broker.controller.ServiceInstanceBindingController.deleteServiceInstanceBinding(java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws com.pivotal.cf.broker.exception.ServiceBrokerException Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod INFO: Mapped "{[/v2/service_instances/{instanceId}],methods=[DELETE],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity com.pivotal.cf.broker.controller.ServiceInstanceController.deleteServiceInstance(java.lang.String,java.lang.String,java.lang.String) throws com.pivotal.cf.broker.exception.ServiceBrokerException Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod INFO: Mapped "{[/v2/service_instances],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List com.pivotal.cf.broker.controller.ServiceInstanceController.getServiceInstances() Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod INFO: Mapped "{[/v2/service_instances/{instanceId}],methods=[PUT],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity com.pivotal.cf.broker.controller.ServiceInstanceController.createServiceInstance(java.lang.String,com.pivotal.cf.broker.model.CreateServiceInstanceRequest) throws com.pivotal.cf.broker.exception.ServiceDefinitionDoesNotExistException,com.pivotal.cf.broker.exception.ServiceInstanceExistsException,com.pivotal.cf.broker.exception.ServiceBrokerException Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod INFO: Mapped "{[/v2/catalog],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public com.pivotal.cf.broker.model.Catalog com.pivotal.cf.broker.controller.CatalogController.getCatalog() Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler INFO: Mapped URL path [/resources/] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler INFO: Mapped URL path [/] onto handler of type [class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler] Feb 16, 2014 12:58:08 PM org.springframework.web.servlet.FrameworkServlet initServletBean INFO: FrameworkServlet 'dispatcher': initialization completed in 909 ms Feb 16, 2014 12:58:08 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-61377"] Feb 16, 2014 12:58:08 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 21836 ms

Reading logs/stdout.log... OK LOGBACK:12:58:08.408 [localhost-startStop-1] INFO o.h.validator.internal.util.Version - HV000001: Hibernate Validator 5.0.2.Final

I took a look on github and didn't see a "logging" broker code base.

https://github.com/jhiemer/cf-spring-service-broker

Thanks a lot for your response! :-)

Reply to this email directly or view it on GitHubhttps://github.com/cloudfoundry-community/spring-service-broker/issues/1#issuecomment-35599200 .

spgreenberg commented 10 years ago

I deployed your code to cf-release 158 on bosh lite and see the same issue. I need to dig into the code tonight/tomorrow.

Sent from my iPhone

On Feb 20, 2014, at 3:48 AM, Johannes Hiemer notifications@github.com wrote:

I am using maven due to the fact that I had not time yet to work with gradle. :-)

I would be happy to incorporate a pull request. I am hoping more people can continue to get >involved and keep evolving the code base.

During the weekend I will have some time to make a pull request with Java config.

Unfortunately, the CURL request is a necessary hack. It is documented, but not ideal.

That would be really great, because it is not really good documented currently.

how did you register the broker? Are you sure you have the correct username & pwd getting passed to the cloud controller? Is your service broker deployed as an app to CF?

cf push --path=target/ssbt.war ....

cf add-service-broker log URL> http://logging.192.168.1.222.xip.io

Username> admin

Password> cloudfoundry

Adding service broker log... OK

What version of cf-release are you using?

cf -v cf 5.4.5

If so, can you see anything in the logs?

Log looks good so far.

cf logs logging Getting logs for logging #0... OK

Reading logs/env.log... OK TMPDIR=/home/vcap/tmp VCAP_APP_PORT=61377 USER=vcap VCAP_APPLICATION={"instance_id":"dd52fea95aca46908375be299a210b57","instance_index":0,"host":"0.0.0.0","port":61377,"started_at":"2014-02-16 12:57:44 +0000","started_at_timestamp":1392555464,"start":"2014-02-16 12:57:44 +0000","state_timestamp":1392555464,"limits":{"mem":256,"disk":1024,"fds":16384},"application_version":"c84425bc-4b68-4d4e-8b49-ae34697abb2d","application_name":"logging","application_uris":["logging.192.168.1.222.xip.io"],"version":"c84425bc-4b68-4d4e-8b49-ae34697abb2d","name":"logging","uris":["logging.192.168.1.222.xip.io"],"users":null} PATH=/bin:/usr/bin PWD=/home/vcap VCAP_SERVICES={} SHLVL=1 HOME=/home/vcap/app PORT=61377 VCAP_APP_HOST=0.0.0.0 MEMORYLIMIT=256m =/usr/bin/env

Reading logs/staging_task.log... OK -----> Downloaded app package (8.8M) -----> Downloading OpenJDK 1.7.0_51 from http://download.pivotal.io.s3.amazonaws.com/openjdk/lucid/x86_64/openjdk-1.7.0_51.tar.gz (45.1s) Expanding JRE to .java (0.8s) -----> Downloading Spring Auto-reconfiguration 0.8.7 from http://download.pivotal.io.s3.amazonaws.com/auto-reconfiguration/auto-reconfiguration-0.8.7.jar (4.2s) -----> Downloading Tomcat 7.0.50 from http://download.pivotal.io.s3.amazonaws.com/tomcat/tomcat-7.0.50.tar.gz (10.6s) Expanding Tomcat to .tomcat (0.1s) -----> Downloading Buildpack Tomcat Support 1.1.1 from http://download.pivotal.io.s3.amazonaws.com/tomcat-buildpack-support/tomcat-buildpack-support-1.1.1.jar (0.3s)

Reading logs/stderr.log... OK Feb 16, 2014 12:57:46 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-61377"] Feb 16, 2014 12:57:46 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 349 ms Feb 16, 2014 12:57:46 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Feb 16, 2014 12:57:46 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.50 Feb 16, 2014 12:57:46 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /home/vcap/app/.tomcat/webapps/ROOT Feb 16, 2014 12:57:46 PM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(/home/vcap/app/.tomcat/webapps/ROOT/WEB-INF/lib/javax.servlet-api-3.0.1.jar)

Reading logs/stdout.log... OK LOGBACK:12:58:08.408 [localhost-startStop-1] INFO o.h.validator.internal.util.Version - HV000001: Hibernate Validator 5.0.2.Final

I took a look on github and didn't see a "logging" broker code base.

https://github.com/jhiemer/cf-spring-service-broker

Thanks a lot for your response! :-)

Reply to this email directly or view it on GitHubhttps://github.com/cloudfoundry-community/spring-service-broker/issues/1#issuecomment-35599200 .

jhiemer commented 10 years ago

I am on my way to migration to CF CLI v6 atm. Just waiting for a response on the brew tab reliability.

I saw that you forked cfmc. It did a larger refactoring using pure and native Jackson support, which increases the speed, when loading the resources and removed the boilerplate repositories. You should delete your fork and refork the current version. Maybe we could work together on it. What do you think?

Sadly I have a small issue here with my VPN, so I am not able to get into our CF Demo lab. Going to install the Lite version in a VM now, for further testing later on.

jhiemer commented 10 years ago

@spgreenberg I figured it out. The reason was the following line:

CustomSecurityConfiguration.java

 @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
            .antMatchers("/**").hasRole("USER")
            .anyRequest().authenticated()
        .and()
            .httpBasic()
        .and()
            .csrf().disable();
    }

Had to add and().crsf().disable()

Thanks a lot for your help!

Btw. in my opinion the new CF client is a huge step backwards.

cf push APP [-b BUILDPACK_NAME] [-c COMMAND] [-d DOMAIN] [-f MANIFEST_PATH]
   [-i NUM_INSTANCES] [-m MEMORY] [-n HOST] [-p PATH] [-s STACK] [-t TIMEOUT]
   [--no-hostname] [--no-manifest] [--no-route] [--no-start]

Is there any way to shorten that, or have the dialogs, we had in the previous ruby client?

sreelathakoye commented 10 years ago

Hi, Iam new to cloud foundry, and came across this CustomServices. And i have seen this example of spring-service-Broker. I have seen in compatibility section that this is compatible with Bosh Lite. I have tried pushing this app to target run.pivotal.io, i.e cf api api.run.pivotal.io cf login cf push springBroker -p spring-service-broker.war It was pushed succesfully but gave exception when i run it. ""HTTP Status 500 - Servlet.init() for servlet appServlet threw exception"" Was this because it is compatible with only BoshLite? Cant i work on managed services on run.pivotal.io? Should i defenitely create a cf using bosh lite and work on managed services? Waiting to see help on this Thanks, Sreelatha.

jhiemer commented 10 years ago

@sreelathakoye as it is a normal Spring app it should work. Could you get the logs via

cf logs yourappname

And the contents of the files in

cf files yourappname /logs/..
spgreenberg commented 10 years ago

I would also point you to the new spring-boot version rather than the boilerplate: https://github.com/cloudfoundry-community/spring-boot-cf-service-broker

Spring boot makes composing apps from different spring technologies extremely easy and more repeatable. I also created a sample implementation: https://github.com/spgreenberg/spring-boot-cf-service-broker-mongo

I am not planning on supporting/updating the spring-service-broker, instead focusing on the spring-boot-cf-service-broker (versions 2.1-2.3 are all implemented and published currently).

On Thu, May 8, 2014 at 8:24 AM, Johannes Hiemer notifications@github.comwrote:

@sreelathakoye https://github.com/sreelathakoye as it is a normal Spring app it should work. Could you get the logs via

cf logs yourappname

And the contents of the files in

cf files yourappname /logs/..

— Reply to this email directly or view it on GitHubhttps://github.com/cloudfoundry-community/spring-service-broker/issues/1#issuecomment-42555827 .

sreelathakoye commented 10 years ago

Thank you @spgreenberg and @jhiemer , very sorry for the late reply, i would try working on Spring-boot project links which you have provided