`
sillycat
  • 浏览: 2567438 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Playframework(12)More Samples and Deployment

 
阅读更多
Playframework(12)More Samples and Deployment
My first sample is todolist.

Hello World
The second simple example is hello world from the location
>pwd
/opt/play/samples/scala/helloworld
>cd /opt/play/samples/scala/helloworld
>play eclipsify

Import this project to eclipse and study. It is all about controller/action/routers/forms.

But I do not quite understand the test part, extends Specification.
org.specs2.mutable._

Computer Database
A basic CRUD application with JDBC database.
1. Anorm in Scala to visit the database, computer and company
2. list pagination and CRUD forms
3. CSS with twitter bootstrap. http://twitter.github.com/bootstrap/

Forms
Complex forms with validation

Change the router to mapping to different controller.

Change the action path to merge the different html template in different categories.

ZenTasks
Integrate authentication and security
Use AJAX and JavaScript reverse routing.

CometClock
create a Comet connection
write custom Enumerators

WebSocket chat
WebSocket connections
Advanced Akka Usage

MozWebSocket is for firefox.

Comet monitoring
advanced usage of enumerators and enumeratees

After go through all the samples codes. It seems that play is much more like MVC framework. And it has the Oauth, openID, template engine and a lot of other things. And it can also iterate with akka.

Spray is just a punch of tools, spray-IO, spray-CAN, spray-routing. I think it is more like a small and scala version of play.

5 How to deploy play framework application
5.1 Deploying your application(Based on Source Version)
Using the start command
play>start

or

>play start

It is based on standard Netty.

Using the stage task
>play clean compile stage

And everything will be in the place target/staged. And we can start the server with another command
>target/start

But my project does not work, because the Error Message:
Oops, cannot start the server.
PlayException: Database 'default' needs evolution! [An SQL script need to be run on your database.]

Solution:
For command play start, we need add a parameter
>play -DapplyEvolutions.default=true start

For the stage command
>target/start -DapplyEvolutions.default=true

5.2 Creating a standalone version of your application(Based on Binary version)
play>dist

It will create a binary file under /Users/carl/work/play/todolist/dist named todolist-1.0-SNAPSHOT.zip.

If we want to add a configuration file, we need to run like this.
>play -Dconfig.file=/Users/carl/work/play/todolist/conf/application.conf dist

Publishing to a Maven(or Ivy) repository
play>publish
project/Build.scala will be mostly like this, but I did not try.

val main = PlayProject(appName, appVersion, appDependencies).settings(
     publishTo :=Some(
          "My resolver" at "http://mycompany.com/repo"
     )

     credentials += Credentials(
          "Repo", "http://mycompany.com/repo", "admin", "password"
     )
)

5.3. Additional Configuration
Specifying the HTTP server address and port

>start -Dhttp.port=1234 -Dhttp.address=127.0.0.1

Specifying additional JVM arguments
>start -Xms128M -Xmx512m -server

Specifying alternative configuration file
>start -Dconfig.resource=prod.conf

>start -Dconfig.file=/opt/conf/prod.conf

>start -Dconfig.url=http://conf.mycompany.cm/conf/prod.conf

Overriding specific configuration keys
…snip…

Changing the log back configuration file
>start -Dlogger.resource=conf/prod-logger.xml

>start -Dlogger.file=/opt/prod/logger.xml

>start -Dlogger.url=http://conf.mycompany.com/logger.xml

5.5 Set up a front-end HTTP server
Use apache, lighted, nginx, ha-proxy to handle the 80 port, start multiple instances from the back ends.
>start -Dhttp.port=9998
>start -Dhttp.port=9999

References:
http://sillycat.iteye.com/blog/1757098
http://www.playframework.org/documentation/2.0.4/Samples

http://www.playframework.org/documentation/2.0.4/Production

分享到:
评论

相关推荐

    MICROSOFT .NET FRAMEWORK 2.0 SDK SAMPLES

    微软.NET Framework 2.0 SDK Samples 是一套由微软公司发布的开发资源,旨在帮助开发者更好地理解和利用.NET Framework 2.0的强大功能。这套样本集合涵盖了各种编程场景,为开发者提供了丰富的示例代码,涉及语言...

    Playframework 1.2.7 sdk zip包 play1.2.7.zip

    Playframework 1.2.7 是一个开源的Java和Scala Web应用框架,它采用模型-视图-控制器(MVC)架构模式,并且是基于事件驱动的,这使得开发过程更加高效和简洁。这个zip包"play1.2.7.zip"包含了Playframework的SDK,...

    MICROSOFT .NET FRAMEWORK 2.0 SDK SAMPLES示例程序

    在.NET Framework 2.0 SDK Samples中,C#示例将涵盖以下关键领域: 1. **基础语法**:示例会展示C#的基础语法元素,如变量、数据类型、控制流(条件语句、循环)、函数、类和对象等。 2. **面向对象编程**:包括...

    large set of samples and tutorials

    In addition to a tools and runtime environment, RDS comes with a large set of samples and tutorials for getting robotics enthusiasts and professionals started writing applications.

    Microsoft Deployment Toolkit Samples Guide.docx

    Microsoft Deployment Toolkit Samples Guide

    OpenGL samples and glut for VS

    "OpenGL samples and glut for VS" 是一个针对Visual Studio(VS)的资源包,旨在帮助开发者在Windows环境下搭建OpenGL开发环境并提供示例代码进行学习。 首先,让我们来了解一下OpenGL。OpenGL是一种跨语言、跨...

    OpenGL Basic Samples And Advanced Samples

    这是在OpenGL的一个官方网站上下载的例子,里面有很多基本的和高级的实例。

    deploymentmanager-samples, 部署管理器示例和模板.zip

    deploymentmanager-samples, 部署管理器示例和模板 部署管理器示例Google是一个基础设施管理服务,它使得创建。部署和管理云平台资源变得简单。 使用部署管理器,可以创建 static 或者动态模板来描述云云环境的配置...

    android sdk 自带 实例(samples)

    You can also download the source of these samples into your SDK, then modify and reuse it as you need. For more information, see Getting the Samples. API Demos A variety of small applications that ...

    deploymentmanager-samples:Deployment Manager示例和模板

    部署管理器示例Google Cloud Deployment Manager是一项基础架构管理服务,可让您轻松创建,部署和管理Google Cloud Platform资源。 使用Deployment Manager,您可以创建描述您的Google Cloud环境配置的静态或动态...

    spring-framework-samples:spring-framework原始解析

    "spring-framework-samples" 是一个官方提供的示例集合,旨在帮助开发者更好地理解和学习Spring Framework的各种功能和用法。 在"spring-framework-samples-master"这个压缩包中,我们通常会发现多个子项目,每个子...

    Official Visual Studio 2008 VB.NET Samples

    These samples demonstrate many of the new features available with Visual Basic 2008 and the .NET Framework 3.5 including hundreds Language Integrated Query (LINQ) samples. The following is the list ...

    AForge.NET Framework-2.2.5-Samples-Docs-Sources.zip

    AForge.NET Framework-2.2.5-Samples-Docs-Sources.zip 从官网下载的哈,最新,最全。

    AUTOnomyV(VBScript)+samples and users guide.zip

    │ AutonomyV Samples Guide.pdf │ AutonomyV Users Guide.pdf │ AUTOnomyV(vbscript)+samples-users guide.zip │ AUTOnomyV.zip │ └─AUTOnomyV │ AutonomyLib.vbs │ AutonomyV Users Guide.pdf │ ├─...

    CUDA Samples

    CUDA Samples是NVIDIA提供的一套示例应用程序,旨在帮助开发者学习和使用CUDA编程模型。CUDA(Compute Unified Device Architecture)是NVIDIA开发的一个并行计算平台和编程模型,允许开发者使用NVIDIA的GPU进行通用...

    android-samples.zip

    Android SDK 是开发者学习和实践Android应用开发的重要工具,其中包含了大量的示例代码,也就是我们所说的samples。这些示例代码覆盖了Android开发的各个方面,为初学者提供了丰富的学习材料,同时也为有经验的...

    play-billing-samples:Google Play应用内结算示例

    Google Play帐单范例 Google Play结算示例应用程序。 要构建每个样本,请参阅项目目录中的自述文件说明。 在您的Android应用中购买商品。 -在Android应用程序中购买订阅并在服务器上管理订阅。 在您的Android应用...

    TWAIN Samples

    The samples are released as open source software and uses a Modified BSD licenses. The project was last built and tested using QT 5.9.9, and setting QTDIR to C:\Qt\Qt5.9.9\5.9.9\msvc2017_64 on a ...

    mysql sample安装

    MySQL样本安装指南 在深入学习和使用MySQL数据库之前,安装一个功能齐全的示例数据库是十分有益的。本文将引导你完成MySQL样本数据库的安装过程,帮助你快速入门并熟悉数据库管理。 首先,理解MySQL是什么至关重要...

    nvidia cuda-samples

    CUDA-Samples是NVIDIA为开发者提供的一个官方样例集合,旨在帮助学习和理解CUDA编程模型,以及如何在实际项目中有效地利用GPU进行计算。这个压缩包“cuda-sample-master”很可能包含了CUDA SDK中的所有示例代码,...

Global site tag (gtag.js) - Google Analytics