I want to have a shared cache for my Play 2.2.2 app hosted on heroku.
I added memcachier addon and in my conf file :
memcached=enabled
memcached.host=${MEMCACHE_SERVERS}
memcached.user=${MEMCACHE_USERNAME}
memcached.password=${MEMCACHE_PASSWORD}
But the cache is never hit. Is it enought ?
I was missing the play plugin : in the build.sbt
libraryDependencies ++= Seq(
jdbc, javaCore, javaJdbc, javaEbean, anorm, filters,
"ws.securesocial" %% "securesocial" % "2.1.3",
"com.github.mumoshu" %% "play2-memcached" % "0.3.0.2"
)
resolvers ++= Seq(
Resolver.sonatypeRepo("releases"),
"Spy Repository" at "http://files.couchbase.com/maven2"
)
https://github.com/mumoshu/play2-memcached
Related
My golang service uses k8s go api to communicate with Kubernetes clusters. Some of them are v1.9.6, while some clusters of v1.17.0 were recently added.
I am using go.mod to manage dependencies. However I am having trouble combining dependencies of different versions.
For example using dependencies for the old API look like this:
module k8sOld
go 1.13
replace k8s.io/api => k8s.io/api v0.0.0-20180127130940-acf347b865f2
require (
k8s.io/api v0.0.0-20180127130940-acf347b865f2
k8s.io/apimachinery v0.0.0-20180126010752-19e3f5aa3adc
k8s.io/client-go v6.0.1-0.20180321184741-e56f95336983+incompatible
k8s.io/kube-openapi v0.0.0-20200615155156-dffdd1682719
)
When I added newer version of Kubernetes API I tried it like this:
module k8sOld
go 1.13
replace k8s.io/api => k8s.io/api v0.0.0-20180127130940-acf347b865f2
replace k8s.io/api/new => k8s.io/api v0.17.0
require (
k8s.io/api v0.0.0-20180127130940-acf347b865f2
k8s.io/apimachinery v0.0.0-20180126010752-19e3f5aa3adc
k8s.io/client-go v6.0.1-0.20180321184741-e56f95336983+incompatible
k8s.io/kube-openapi v0.0.0-20200615155156-dffdd1682719
k8s.io/api v0.17.0
k8s.io/apimachinery v0.17.0
k8s.io/client-go v0.17.0
)
I named the package for new packages "k8s.io/{subpackage}/new" and used replace to point to the newer version.
I am not sure if this is ok and that is the first question.
The second and most basic one is ,supposing I find a way to refer to newer version, how can I refer subpackages of packages?
For example how can I use k8s.io/api/core/v1?
I tried naming it like this:
"k8s.io/api/{VERSION NAMING CONVENTION}/core/v1"
But it does not seem to work.
I also tried adding k8s.io/api/core/v1 {version number} to the require part of go.mod, but it cannot be used this way.
Any ideas on how I can use different versions of k8s go api under the same hood?
I have been trying to configure Flink UI for Flink application running locally in IDE. So I've set up relevant dependencies and execution environment. But Flink UI still does not work. What might be the reason of it?
By http://localhost:8081 there is a message
{"errors":["Not found."]}
Execution environment setup:
val conf = new Configuration()
conf.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true);
val env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(conf)
Dependency setup in build.sbt:
"org.apache.flink" %% "flink-runtime-web" % "1.9.1"
I'm building a Play! Framework (2.5) Java application and I want to connect it to ElasticSearch using Ebean.
First, I followed the steps here and successfully connected to a dummy jdbc (Added plugin, modified build.sbt, added ebean.default="models.*", default.driver = org.h2.Driver, and default.url = "jdbc:h2:mem:play" to application.conf). So far so good.
Now, I want to switch my connection to ElasticSearch instead of jdbc, so I'm following the steps here, but I can't figure it out for the life of me. What I've done so far:
Added to build.sbt:
libraryDependencies ++= Seq( "org.avaje.ebeanorm" % "avaje-ebeanorm-elastic" % "1.3.1" )
Added to application.conf:
ebean.docstore.url="http://localhost:9200"
ebean.docstore.active=true
ebean.docstore.generateMapping=true
ebean.docstore.dropCreate=true`
Removed from application.conf
default.driver = org.h2.Driver
default.url = "jdbc:h2:mem:play"
I cannot get this code to run, because I keep getting this error:
RuntimeException: com.typesafe.config.ConfigException$WrongType: application.conf # file:/C:/Users/../conf/application.conf: 357-360: docstore has type OBJECT rather than LIST
I would greatly appreciate any pointers in the right direction. Thanks!
You can either :
Override your ebean configuration programmaticaly
Add your configuration in a ebean property file
1 - Programmatically
package models;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebean.event.ServerConfigStartup;
public class ConfigOverride implements ServerConfigStartup {
public void onStart(ServerConfig serverConfig) {
serverConfig.getDocStoreConfig().setUrl("http://localhost:9200");
serverConfig.getDocStoreConfig().setActive(true);
serverConfig.getDocStoreConfig().setGenerateMapping(false);
serverConfig.getDocStoreConfig().setDropCreate(false);
serverConfig.getDocStoreConfig().setCreate(false);
serverConfig.getDocStoreConfig().setPathToResources("conf");
}
}
2 - Configuration
You have to put your ebean.docstore properties in a ebean.properties in conf directory. But unfortunatly, I didn't manage to make the application work in stage mode
Source: https://raw.githubusercontent.com/playframework/play-ebean/master/docs/manual/working/javaGuide/main/sql/JavaEbean.md
FYI : I opened an issue here :
https://github.com/playframework/play-ebean/issues/104
I have a Lift-based REST application. My dev environment is running the Jetty server built into SBT, and the application is deployed on Tomcat 7.
I recently integrated Ehcache to my setup, discarding a custom cache. It works flawlessly in my Jetty dev server. When I deploy to tomcat however, any URL's served by my Lift application get 404's. There are no exceptions, and no log items as far as I can find that are relevant, aside from the 404 in the log.
When I comment out the lines referring to Ehcache and remove it as a dependency, Tomcat fires up and works fine and serves those urls. As soon as I uncomment Ehcache, it's all 404's again.
Does anyone know what is going on? I know Ehcache uses SLF4J to log, is that somehow stopping ehcache errors from appearing in my logs?
Relevant section of build.sbt:
Seq(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftweb" %% "lift-mapper" % liftVersion % "compile",
"com.typesafe.slick" %% "slick" % "2.0.0-M3",
"org.eclipse.jetty" % "jetty-webapp" % "8.1.7.v20120910" % "container,test",
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container,test" artifacts Artifact("javax.servlet", "jar", "jar"),
"ch.qos.logback" % "logback-classic" % "1.0.6",
"org.specs2" %% "specs2" % "1.14" % "test",
"mysql" % "mysql-connector-java" % "5.1.25",
"net.sf.ehcache" % "ehcache" % "2.8.2",
"javax.transaction" % "transaction-api" % "1.1",
"org.slf4j" % "slf4j-simple" % "1.7.7"
)
Relevant seciont of ehcache.xml
<cache name="mycache"
maxEntriesLocalHeap="10000"
maxEntriesLocalDisk="1000"
eternal="false"
diskSpoolBufferSizeMB="20"
timeToIdleSeconds="21600"
timeToLiveSeconds="43200"
memoryStoreEvictionPolicy="LFU"
transactionalMode="off">
</cache>
Any help would be greatly appreciated. Thanks in advance.
Finally solved this. It was two separate problems. First, there was a bug (or multiple) with Tomcat 7.0.42 I was running in production. EhCache was failing silently.
In a separate installation of 7.0.52, It was throwing an Exception, saying it was unable to locate my ehcache.xml file. Moving the file to WEB-INF/classes/ solved that exception and the application spun up. Moving back to my 7.0.42 installation however, it still would not fire up.
After forcing my production installation to 7.0.52, the application fires up and works fine.
So in summary, I had two problems:
Ehcache was unable to find my config file
Tomcat 7.0.42 seemed to have a bug
Solutions:
Move ehcache.xml to WEB-INF/classes
Upgrade Tomcat from 7.0.42 -> 7.0.52
I have a play 2 framework app runnning in heroku. How do I add phantomjs support to the play 2 app?
I know a builspack exists for heroku for phantomjs. How do I specifically add this to my existing play 2 app?
Not sure if it is the only way, but it works for us
install phantomjs in your machine
in your build.sbt libraryDependencies add "com.github.detro.ghostdriver" % "phantomjsdriver" % "1.1.0" % "test",
in your test WithBrowser(webDriver = classOf[org.openqa.selenium.phantomjs.PhantomJSDriver])