Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serving files on deployment server #5

Open
yanlinaung30 opened this issue Dec 17, 2018 · 3 comments
Open

Serving files on deployment server #5

yanlinaung30 opened this issue Dec 17, 2018 · 3 comments
Assignees
Labels

Comments

@yanlinaung30
Copy link

Thanks for sharing the play & react integration source codes. I have a few problems on deployment in production mode. Could you consider how to solve the issue of my used case?

  • Back-end needs to download some images file from a server.
  • Front-end serves the files downloaded.
  • It works perfectly on development mode run by sbt run.
  • Deployment on production is done by sbt dist, unzip target/universal/xxxx.zip, cd xxx, ./bin/xxx Dplay.http.secret.key=lqkejrnjnjfajsdjfajhsdfhjasdf -Dconfig.file=/home/ubuntu/code/xxx/conf/application.conf -Dhttp.port=8080
  • Downloaded files are under xxx/public/images/
  • Front-end cannot serve the downloaded images file.
  • What I should need to change the config or controller to serve the file under xxx/public/images folder?
    Thank you.
@yohangz yohangz self-assigned this Dec 17, 2018
@yohangz
Copy link
Contributor

yohangz commented Dec 17, 2018

@yanlinaung30 all the contents in public directory is directly exposed via this seed (mechanism used to server forntend source). Check the frontend asset traffic via browser dev tools network tab and use a similar kind of relative paths to access contents in public dir.

Make sure all downloaded images are dynamically added to the public dir.

@yanlinaung30
Copy link
Author

yanlinaung30 commented Dec 18, 2018

@yohangz Thanks for your reply.
public dir means Root/public or Root/xxxSNAPSHOT/public or Root/ui/public.
I have tried all public dirs by copy & paste image files to all public folders.
Unfortunately it does not work...

@yohangz
Copy link
Contributor

yohangz commented Dec 18, 2018

When you build the play project artifact all static frontend assets generated by react codebase build is copied to public directory prior to play build and bundled in jar files generated.

Thus, if you are planing to dynamically retrieve and serve images via play framework you better keep the images in some other directory and implement a separate route to retrieve and server those.

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

No branches or pull requests

2 participants