0

I'm looking for some pointers on putting config files for static HTML app in the PCF config server. Two possible ways on making it happen:

  1. On the cf push, static buildpack would go to config server, fetch latest config and deploy it to the container

  2. Every time a client (browser) requests config file, there would be a proxied request to config server to get latest config and then send to client.

Did anyone make this work yet? Any pointers to examples or such?

Marcin Susel
  • 150
  • 1
  • 6

1 Answers1

0

Which server is being used as config server?

Option 1: Do you say that your config file would remain same as part of your application life cycle? If so, you may include it as part of your binary distribution. There is no difference if you include it as part of your build or as a step during cf push. You don't need config server.

Option 2: Please note that the default behavior of Spring Config Server is not to serve files. It responds with JSON of the property files specified. You may need a simple customization if you want to serve plain text from Config Server. This works; but Config Servers meant for this.

In any case, have a proper case for Config Server.

ajoshi
  • 349
  • 2
  • 10
  • 1: if it was, i wouldn't need to provide dynamically. there is a huge difference, properties differ per environment and it is an anti-pattern to include them with the build. See https://12factor.net/ point III. You don't want to rebuild a binary because one of you service URL's has changed. 2: What is a difference between json file and json payload? To the HTML5 it won't make any difference as long as those values are available when browser loads the page. Im not sure if you are on the same page, config server is meant to store configs - no matter if it's a Java, node, .NET or HTML5 – Marcin Susel Apr 28 '17 at 21:37
  • 1: Whether you do it as part of "cf push" or through the build, both are anti patterns. The best way is to make your Spring Cloud config client to fetch the configuration for the app on start up. – ajoshi Apr 29 '17 at 13:40
  • app startup for static buildpack? i guess that would be nginx startup but it would mean messing with the buildpack itself – Marcin Susel May 02 '17 at 22:03