mardi 28 juillet 2015

How to deploy Play on Amazon Beanstalk keeping /public editable for a single page application?

I am looking for alternative methods of deploying a Play application to Elastic Beanstalk. It is a single page app that relies on Ember.js. It would be nice to be able to edit the the contents of the /public folder so I don't need to rebuild the docker image every time something is fixed on the Ember side that doesn't affect the Play app itself.

I am currently using sbt's docker:stage command and zipping the generated docker folder along with this Dockerfile and Dockerrun.

Dockerfile

FROM java:latest
WORKDIR /opt/docker
ADD stage /
RUN ["chown", "-R", "daemon:daemon", "."]
EXPOSE 9000
USER daemon
ENTRYPOINT ["bin/myapp", "-Dconfig.resource=application-prod.conf"]
CMD []

Dockerrun

{
    "AWSEBDockerrunVersion": "1",
    "Ports": [{ "ContainerPort": "9000" }],
    "Volumes": []
}

Once I zip the file I upload it using Beanstalk console. But this involves rebuilding the app every time a typo is fixed on the front end. It is annoying because it means all the updated front end code has to wait until I get a chance to push it up so the boss can view it and give feedback. It would be nice if there was a way to have the /public folder (Play just serves /public/index.html) accessible so the front end dev could access it directly for his edits.

Ideally I would like some method that can be used for both development and production. I don't know the requirements imposed by Beanstalk so it can properly spin up extra instances of the app when needed. Maybe something where when the instance starts it does git pull on the backend repo and git pull on the front end repo, then runs my custom build script for ember to generate the /dist folder and move into Play's /public folder and create gzips of each file. Then start the play app. Then let the front end Dev ssh into the development instance and do git pull and ember build as needed for his edits.

It would also be nice for the development server for the Play server to be run using run or ~run so I can just do git pull and have it rebuild the backend.

Or maybe I am approaching this in the completely wrong way. I have never done any of this before so I am sort of guessing my way through all of it.

Thanks for any suggestions and pointers in the correct direction.

Adam




Aucun commentaire:

Enregistrer un commentaire