Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Usage example for run -d #25

Open
rwetzold opened this issue May 14, 2018 · 5 comments
Open

Usage example for run -d #25

rwetzold opened this issue May 14, 2018 · 5 comments
Labels

Comments

@rwetzold
Copy link

I have an app that consists of a backend (Java) and a UI (static html files). The jar and the HTML files are then assembled into a WAR.

What does cflocal offer in such a case? I want to be able to change the Java or the UI coding and automatically have this reflected in the running app.

I have a Maven build where in the target directory I can see the extracted app, containing the html files in the root, the libraries in the lib folder etc. I figured this would be the natural candidate to point to but when doing so I get the error that catalina.sh could not be found.

Are there any examples that show where to point the -d work dir to? Are there best practices when working with Eclipse and Maven? Using a Tomcat inside Eclipse I get a roundtrip time of around 5s if I change Java and a roundtrip time of 0.5s when changing the HTML. It's hotdeployed. But this is outside the CF environment so I need to use cflocal. Is it possible to achieve similar times there?

@sclevine
Copy link
Contributor

sclevine commented May 23, 2018

CF Local provides the same buildpacks as CF. The Java buildpack requires a compiled Java JAR or WAR, so instead of cf local run -d, the recommended development workflow for CF Local is to use Spring Boot DevTools, which can update a running app as you develop locally. You can use SBDT with CF Local just like you would with CF.

https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html

@till
Copy link

till commented Apr 26, 2019

@sclevine is it possible to get some docs up on how to use -d anyway? I am evaluating cf-local currently for a local development environment and it would seem like it checks all the tings, but some of the docs are lacking.

@sclevine
Copy link
Contributor

CF Local is currently on hold while we build out the Cloud Native Buildpacks project, which has a CLI that's similar to CF Local. I plan to update CF Local to use pack underneath once we finish converting all the CF buildpacks to the new Cloud Native Buildpacks API.

Cloud Native Buildpacks has an API intended to support local development that should work in cases where -d doesn't.

@till
Copy link

till commented Apr 26, 2019

@sclevine so, I am not sure if -d works, or doesn't. I was mostly interested how to use it. Most of CF Local seems to do. It's just this and my inability to forward a service (see my comment on #27).

@mruell
Copy link

mruell commented Mar 1, 2021

Figured out another way, just export to docker using cf local export app and then run it in docker while mounting only the public dir and vendor using

docker run --rm -p 8080:8080 -v /.../public:/home/vcap/app/public -v /.../vendor:/home/vcap/app/vendor app

(... should be the absolute path of the app directory on your host)

Paths may differ for you, I am using this options.json file

{
	"WEBDIR": "public",
	"COMPOSER_VENDOR_DIR": "vendor"
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants