Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Thanks again @jkleckner:matrix.org. So much work has been done, it'd be a shame for the movement to stop. The Play Framework is by far the best (albeit hardest to learn by FAAAR) web framework I've developed in, including Django, Asp NET Core 👎, and NodeJS/Express. There's loads available, and the Auth put together is great. Still mulling this all over, and hoping for more community feedback.
    Edmundo López Bóbeda
    @wsuchy I'm currently looking for a contract position for scala/play framework. You can contact me at edmundo [at] idiomaticsoft.com, not a software house just me. Will be happy to see if I can help you.
    Brian Miller

    hi, Play v2.6, attempting to reconfigure it for HTTP(S) redirect from :443 to :9443 & play.server.http.port = disabled in prod environment, have specified play.server.https.port = 9443, and the below to no avail (ie: accessing server on https://foo (implicit 443)) just results in connection refused in Chrome v94, what gives?

    play.filters.enabled += play.filters.https.RedirectHttpsFilter
    play.filters.https.redirectEnabled = true

    PS: I understand the 2nd line isn't required, but grasping at straws here? :confused:

    Also tested with http://foo:9000 (since I'm assuming the filter was originally meant to redirect from HTTP to HTTPS), but that doesn't work either??
    Antoine Doeraene
    Are you sure the enabled filters are not overridden somewhere?
    Did anyone already used Azure keyvault with Play? In particular, what do you do to "fill" the Config object with the correct credentials? Is fetching the credentials at start and giving that to Play a good idea?

    Lightbend blog post: On the future of Play Framework

    TL;DR - We are working to form a community-led organization that would take responsibility for the future development of Play Framework outside of Lightbend.

    Hi all, FYI a bit more about the past and present of Playhttps://discuss.lightbend.com/t/on-the-future-of-play-framework/8920/2?u=mkurz

    @honeycomb-cheesecake: I forgot to mention the auth framework pac4j for Play Framework with commercial support.


    Thanks again @jkleckner:matrix.org. I remember seeing this before but ages ago.
    Gaurav Kumar
    What is the best way to throttle api requests based on IP address in Play framework?
    use nginx as reverse-proxy ( https://www.nginx.com/blog/rate-limiting-nginx/ )
    Gaurav Kumar
    nginx won't work if there are multiple servers
    Hi @fR0DDY_gitlab, I agree with @Marc2017 in that NGinX would be the best for a rate-limiting solution and you can guard against multiple redundant servers using an upstream declaration (http://nginx.org/en/docs/http/ngx_http_upstream_module.html) , and you can guard against different servers with different roles by using the same rate limit zone for each proxy (http://nginx.org/en/docs/http/ngx_http_limit_req_module.html). That being said, you can also use the sief/play-guard libary as well https://github.com/sief/play-guard.
    Gaurav Kumar
    Thanks @honeycomb-cheesecake
    Abhishek Krishnaiah
    when i used to ebean play 2.8.8 and it show this error msg to him add enhancer plugin i am add 1.2.2 but it not reconginzed and also not take ebean plugin in play version why ??
    Vedran Marčetić
    in play 2.8 in scala template this always evaluates as true item.user. != null
    and if I delete the user, this will remain true
    Ronaldo Alves de Abreu
    Hello Everyone. I need help guys. I'm working on a play application which is using a wrapper for sl4j. But the logger is failing to log some calls from Background tasks from Akka Scheduler and from some controllers. Have anyone faced this kind of issue?
    2 replies
    Hello. Is it safe to use latest twirl with play 2.6.25?
    addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25")
    addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1")
    I need twirl 1.5.1 because sbt/sbt#6400
    Popescu Petre
    I am close to launching my first (production-ready) app made in Play (Java) and I am having a few dilemmas as to where to host it. First, I don't know what resources I need, how much RAM/CPU power would be enough. Secondly, there are many provider out there, from the traditional Amazon AWS and Azure to some lesser-known ones. Any recommendations? Preferably something cheap to start with, but to have the possibility to scale if the app takes off.
    Hey @pazvanti_gitlab, loving the GitLab part of your name I'm a GitLab man myself. As someone who's deployed Play in both AWS and Azure, I'd say that if you have cloud experience, it shouldn't be difficult on either. AWS have a free t2 tier for a year which could help to get you started. My JVM options are -Xms512m and -Xmx512 and it'll still demand between 800MB-1GB, 1 VCPU is fine but go for 2 depending on what your app is doing so bear that in mind. I'd recommend using the bundled sbt-universal builder to create a Docker image, store it in a cloud container registry (e.g. ACR, ECR etc) and deploy using an Azure App Service or the equivalent on as it makes it easy to tweak and deploy updates. You could even get a Lightsail instance for $20/m, install Docker and Portainer and deploy that way.
    4 replies
    Using mongodb so cannot really advise on space for Postgresql, that being said you'll want some headroom for memory so I'd opt at least for the 2GB personally (I've seen servers made unresponsive in the past, also enable snapshots). Self hosted is fine, you can use the same native packager I suggested for Docker to build a .tar.gz/.zip and deploy to anything, including VMs, which is what i used to do. I just find Dockerised containers easier to automate releases and updates.
    1 reply
    They do use more resources, you are right. Dockerizing (more specifically containerization) isn't overkill, as you build up an application to be run the same way in any environment and is a staple of continuous deployment https://www.atlassian.com/continuous-delivery/continuous-deployment. I saw the word "production-ready" in your original statement, and as someone who has run Play directly (i.e. without containers) and with containers in production, I'd never go back purely because of the manual updating. I have built up pipelines where the updates of the running app are automatically built, tested, packaged and deployed on every code change whilst I'm having a cup of tea.
    Whether it's one application or many, you always benefit, and you'll find practically every official vendor providing a Docker image https://hub.docker.com/_/postgres, https://hub.docker.com/_/mongo etc for their solution. It will likely consume more as the accepted pattern is one app per container, however it really makes automating
    infrastructure a lot easier.
    Or you can run straight, just understand that rolling updates etc will be manual.
    2 replies
    Popescu Petre

    Me again, with another question. I am using actors to send requests to other servers via HTTP calls. The reason I chose this is because I will need to do multiple requests in parallel (let's say 10). So, I have one actor scheduler that reads entries from the database and sends (via tell) a command to another actor requestSender that sends the requests, reads the result and does some processing. So, right now I have an ActorsModule that is configured like this:

    bindActor(CheckScheduler.class, "scheduler", p -> new RoundRobinPool(1).props(p));
     bindActor(RequestSenderActor.class, "requestSender", p -> new RoundRobinPool(10).props(p));

    Guice is used to inject the request sender like this:

    private ActorRef requestSender;

    The tell is done in a for loop:

    for(int count = 0; count<10; count++) {

    The scheduler also listens for a response, so when it receives one back (indicating that the requestSender is done), if there are more than 10 requests that need to be sent, it gets the next one and sends it to the request sender. In short, I always have at most 10 requests in parallel.

    However, I feel that I am not doing things properly. Mostly because I can't find a way to scale the number of request sender actors. What if I need only 5... or 15, depending on the resources I have available? How would I dynamically alter the number of actors in the pool? I think that there may be a better way of doing things. Any suggestions?

    3 replies
    Eric Pugh
    How can I pass in an enivronmetn variable to the call to start up my play app? I'd like to override https://github.com/querqy/smui/blob/master/conf/logback.xml#L30 "SMUI_LOG_LEVEL" on the command line.... something like sbt run -DSMUI_LOG_LEVEL=debug -Dconfig.file=./smui-dev.conf 9000
    I know I could create a new custom logback.xml and pass that in, but would rather change that one variable.
    4 replies
    Dwayne S.
    I'm getting: [error] (data / Compile / manipulateBytecode) java.lang.ClassCastException: class sbt.internal.inc.MappedVirtualFile cannot be cast to class java.io.File (sbt.internal.inc.MappedVirtualFile is in unnamed module of loader sbt.internal.MetaBuildLoader @130f889; java.io.File is in module java.base of loader 'bootstrap')
    2 replies
    We are on play 2.8.8 / sbt 1.5.5 / java 11 / scala 2.13.6 I believe. Some relevant PRs, which /I think have been merged in to 2.8.8 seem to address this.
    Dwayne S.
    Also, we have this: addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "6.2.0-RC3") -- I think this may be the culprit, but when we try 6.0.0 we get [error] java.lang.NoSuchMethodError: 'scala.collection.immutable.Set sbt.internal.inc.Relations.classNames(java.io.File)'
    Derya Aydede
    guys i have a problem where the request timeout i am setting in play isn't being respected
      .addQueryParameter("path", fileLocation + filename)
      .thenApply(wsResponse -> { ... });
    i get an error like this
    java.util.concurrent.CompletionException: java.util.concurrent.TimeoutException: Read timeout to cognitive-services-cvr-filesystem.default.svc.cluster.local/ after 120000 ms
      at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
      at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
      at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:607)
      at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:591)
      at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
      at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
      at scala.concurrent.java8.FuturesConvertersImpl$CF.apply(FutureConvertersImpl.scala:21)
      at scala.concurrent.java8.FuturesConvertersImpl$CF.apply(FutureConvertersImpl.scala:18)
      at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
      at scala.concurrent.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:63)
     Caused by: java.util.concurrent.TimeoutException: Read timeout to cognitive-services-cvr-filesystem.default.svc.cluster.local/ after 120000 ms
      ... 6 common frames omitted
    what gives?
    Derya Aydede
    notably, although i very explicitly set the timeout to an hour and a half, it is timing out after 2 minutes only
    "Read timeout to blah blah blah URL after 120000 ms"
    Derya Aydede
    best part is if i set that value really low, like instead of 90 minutes if i set it to 10 seconds, i can make smaller files than this one it's currently failing on fail
    4 replies
    so that method totally does work
    it's just acting as if there's a max of 120 seconds i'm not allowed to go over
    Ben Fradet
    is there a way to turn a RawBuffer into a Source[ByteString, _]?
    Ben Fradet
    went with FileIO.fromPath(rawb.asFile.toPath())
    Vadim Bondarev
    Hello, has anybody know smth about this: playframework/playframework#11025
    1 reply