When running an application in production mode you can override any configuration. This section covers the more common use cases.
All these additional configurations are specified using Java System properties and can be used directly if you are using one of the start scripts generated by Play.
This can b usefull.
Specifying the HTTP server address and port
You can provide both HTTP port and address. The default is to listen on port 9000
at the 0.0.0.0
address (all addresses).
$ /path/to/bin/<project-name>-Dhttp.port=1234-Dhttp.address=127.0.0.1
Note that these configuration are only provided for the default embedded Netty server.
Specifying additional JVM arguments
You can specify any JVM arguments to the start
script. Otherwise the default JVM settings will be used:
$ /path/to/bin/<project-name>-J-Xms128M-J-Xmx512m-J-server
As a convenience you can also set memory min, max, permgen and the reserved code cache size in one go; a formula is used to
determine these values given the supplied parameter (which represents maximum memory):
$ /path/to/bin/<project-name>-mem 512-J-server
Specifying alternative configuration file
The default is to load the application.conf
file from the classpath. You can specify an alternative configuration file if needed:
Using -Dconfig.resource
It will search for an alternative configuration file in the application classpath (you usually provide these alternative configuration files into your application conf/
directory before packaging). Play will look into conf/
so you don’t have to add conf/
.
$ /path/to/bin/<project-name>-Dconfig.resource=prod.conf
Using -Dconfig.file
You can also specify another local configuration file not packaged into the application artifacts:
$ /path/to/bin/<project-name>-Dconfig.file=/opt/conf/prod.conf
Using -Dconfig.url
You can also specify a configuration file to be loaded from any URL:
$ /path/to/bin/<project-name>-Dconfig.url=http://conf.mycompany.com/conf/prod.conf
Note that you can always reference the original configuration file in a new
prod.conf
file using theinclude
directive, such as:include "application.conf" key.to.override=blah
Overriding specific configuration keys
Sometimes you don’t want to specify another complete configuration file, but just override a bunch of specific keys. You can do that by specifying then as Java System properties:
$ /path/to/bin/<project-name>-Dapplication.secret=verysecretkey -Ddb.default.password=toto
Using environment variables
You can also reference environment variables from your application.conf
file:
my.key = defaultvalue
my.key = ${?MY_KEY_ENV}
Here, the override field my.key = ${?MY_KEY_ENV}
simply vanishes if there’s no value for MY_KEY_ENV
, but if you set an environment variable MY_KEY_ENV
for example, it would be used.
Changing the logback configuration file
Bundling a custom logback configuration file with your application
Create an alternative logback config file called application-logger.xml
and copy that to <app>/conf
You can also specify another logback configuration file via a System property. Please note that if the configuration file is not specified then play will use the default logger.xml
that comes with play in the production mode. This means that any log level settings in application.conf file will be overridden. As a good practice always specify your application-logger.xml
.
Using -Dlogger.resource
Specify another logback configuration file to be loaded from the classpath:
$ /path/to/bin/<project-name>-Dlogger.resource=conf/prod-logger.xml
Using -Dlogger.file
Specify another logback configuration file to be loaded from the file system:
$ /path/to/bin/<project-name>-Dlogger.file=/opt/prod/prod-logger.xml
Using -Dlogger.url
Specify another logback configuration file to be loaded from an URL:
$ /path/to/bin/<project-name>-Dlogger.url=http://conf.mycompany.com/logger.xml
Changing the path of RUNNING_PID
It is possible to change the path to the file that contains the process id of the started application. Normally this file is placed in the root directory of your play project, however it is advised that you put it somewhere where it will be automatically cleared on restart, such as /var/run
:
$ /path/to/bin/<project-name>-Dpidfile.path=/var/run/play.pid
Make sure that the directory exists and that the user that runs the Play application has write permission for it.
Using this file, you can stop your application using the kill
command, for example:
$ kill $(cat /var/run/play.pid)
From:http://www.playframework.com/documentation/2.2.0/ProductionConfiguration
相关推荐
about to fork child process, waiting until server is ready for connections. forked process: 3560 ERROR: child process failed, exited with error number 1 To see additional information in this output, ...
additional-methods.min.js是微信平台二次开发系统
`activation.jar`则是一个额外的组件,它提供了JAF(JavaBeans Activation Framework),使得程序能够识别和操作不同的数据类型,特别是电子邮件中的附件。`additional.jar`可能包含了一些扩展或特定功能的实现,如...
标题“OpenCV Configuration”揭示了本文档的主要目的:指导用户如何配置C环境以运行OpenCV。OpenCV,即Open Source Computer Vision Library,是一个开源的计算机视觉和机器学习软件库,广泛应用于图像处理和视觉...
Additional_Tools_for_Xcode_12,适用于安装macOS Xcode附加应用
这个是免费的==不知道为什么总变成要积分的。实验配备文档。实验内容 ① 将 bank-additional-full.csv 数据导入到 R; ② 对数据中的缺失值、异常值以及不一致值进行识别和处理
Additional_Tools_for_Xcode_11.4,适用于安装macOS Xcode附加应用
Please see the Checker Framework manual (HTML, PDF). Additional documentation for Checker Framework developers is in directory docs/developer/.
additional-methods.min.js 1.16.0,jquery验证规则
DBISAM Additional Software and Utilities - Version 4.01
谷歌java格式 google-java-format是一个重新格式化 Java 源代码以符合 Google Java Style的程序。 使用格式化程序 从命令行 下载格式化程序 并运行它: java -jar /path/to/google-java-format-${GJF_VERSION?...
### 凸优化附加练习知识点概览 #### 一、引言 本文档提供了一系列附加练习,旨在补充Stephen Boyd与Lieven Vandenberghe合著的《凸优化》一书中的习题。这些练习曾用于多个机构的凸优化课程,如斯坦福大学的EE364a...
These tools include AU Lab, OpenGL Driver Monitor, OpenGL Profiler, Pixie, Quartz Debug, CarPlay Simulator, HomeKit Accessory Simulator, IO Registry Explorer, Network Link Conditioner, PacketLogger, ...
《Apple Additional Tools for Xcode 11.4:开发者必备的辅助工具》 Apple Additional Tools for Xcode 11.4 是苹果公司为Xcode开发环境提供的一套重要的辅助工具集合,它对于iOS、macOS以及其他Apple平台的软件...
Additional parity bit Hamming code Hamming code 是一种常用的错误检测和纠正码,它可以检测和纠正数字信息中的错误。在这个主题中,我们将讨论 Hamming code 中的 additional parity bit,了解它的工作原理和...
【伊利诺伊理工大学ECE511随机信号分析作业1】是针对该大学ECE511课程的一份作业,该课程专注于随机信号的分析。随机信号在许多工程领域,如通信、电子、控制和信号处理中都有着广泛的应用。这份作业涉及到概率论和...
资源分类:Python库 所属语言:Python 资源全名:hashlib-additional-1.0.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
Micro_Focus_LoadRunner_2022_Community_Edition_Additional_Components
IGCSE Additional Maths Write your Centre number, candidate number and name on all the work you hand in. Write in dark blue or black pen. You may use a pencil for any diagrams or graphs. Do not use ...