Search

Freitag, 29. November 2019

Small tips for taking Payara to production


Hi all !
This is a small blog how i prepared my Payara application server for production in the cloud!
This blog post is extension of my other blogs about cloud deployment if you interested read here.

Ok , then lets go about how to prepare Payara for the production.
Ask yourself or the developers if you work in company , what kind of services the app server would be responsible for?
After that, you know which services should run on server and which port must be open and which not and must be closed and services disabled and stopped!
Now look at following slides
Then go trough this Payara blog and make sure you fine tune your server.
When you configure your Payara or Glassfish , always restart after each of the optimization, basically use common sense.
Are you sure that your settings are correct then test it , take your stuff into Docker and test it locally, I won't post my Docker file, because it's consists security relative data, but I strongly recommend to test your stuff first locally before to deploy it into the cloud!

Once you tested your stuff locally in Docker container , only then you can deploy it into cloud and hope that it works without any problems.
Further documentation about the Payara configuration click here

Docker important commands and helpful tipps

docker build -t nameofimage .          //PLEASE NOTE YOU NEED A Dockerfile
docker run -itd --name  nameofcontainer  imagename
docker exec -it containterid  sh                   //Here you log in into your container
docker start containerid
docker stop containerid
docker rmi $(docker images -q)            //Wacht out wiht this it removes all your images! docker logs --follow containerid//Sometimes you need to follow what container doing 


Short info about Docker file:
i prefer to use RUN better then CMD (yes i know that it will be a multilayer sandwich, but you can peal the layer) and at the end you need a ENTRYPOINT or else your container will die , but the real reason its just can hook your sh script believe me i tried!
Instead use at the end of your docker something like this

CMD ["java","-XX:+IgnoreUnrecognizedVMOptions", "-jar", "payara5/glassfish/modules/admin-cli.jar", "start-domain", "-v"]

I must admit the syntax of Dockerfiler is not good , what the purpose of  &&\ ?
Yes just to put one by one command in a row when you use RUN.
Then it means do that &&\ do that too,  its kind of mess for my taste , but still it works.

Expose is not exposE at all! wtf!
Well this is true mind blower so make sure that you provide info for -p like for example 8090:8090 etc, when you run your container!


Docker make the life for java developer not easy, because of the way how Docker runs, one services only its difficult to bypass it you have like 2 process which you need, i wasnt able to do that at all!!!
I was able to start my payara server only , one service only ;)
The concept of the Docker anyway to implement Microservices, so one service per Docker container and they really mean that , if you try to stick two permanent services in one docker container it just quits or "freeze" with last command!


Keine Kommentare:

Kommentar veröffentlichen

All comments are pre moderated be polite and respectful!

Blog-Archiv

Blog readers favorites