Permalink
Browse files

Tamir added s Play framework recipe

  • Loading branch information...
1 parent b312652 commit 82ce7526b0eafd394b61a3824e77981ceeb22a6e Tamir Korem committed Aug 10, 2012
View
@@ -0,0 +1,42 @@
+# Pet Clinic
+
+**Status**: Tested
+**Description**: Pet Clinic
+**Maintainer**: Cloudify
+**Maintainer email**: cloudifysource@gigaspaces.com
+**Contributors**: Adam Lavie[https://github.com/adaml] [Eitan Yanovsky]https://github.com/eitany [tamirko](https://github.com/tamirko)
+**Homepage**: [http://www.cloudifysource.org](http://www.cloudifysource.org)
+**License**: Apache 2.0
+**Build**: [Cloudify 2.2.0 M2](http://repository.cloudifysource.org/org/cloudifysource/2.2.0/gigaspaces-cloudify-2.2.0-m2-b2491.zip)
+**Linux* sudoer permissions**: Mandatory
+**Release Date**: August 10th 2012
+
+
+Tested on:
+--------
+
+* <strong>EC2</strong>: CentOs
+* <strong>OpenStack</strong>: CentOs
+
+We disable the requiretty flag in /etc/sudoers on the installed VMs, so that Cloudify will be able to invoke remote ssh commands as a sudoer. This feature will be a part of Cloudify in the near future.
+Until then, please use the [Cloud Drivers Repository](https://github.com/CloudifySource/cloudify-cloud-drivers).
+
+
+Synopsis
+--------
+
+This folder contains a service recipe for the [Computer database]http://www.playframework.org/documentation/2.0.1/Samples Play framework Sample application.
+
+The Computer database is a classic CRUD application, backed by a JDBC database. It demonstrates:
+
+ accessing a JDBC database, using Ebean in Java and Anorm in Scala
+ table pagination and CRUD forms
+ integrating with a CSS framework
+
+
+This recipe is comprised of five services:
+* [play](../../services/play/README.md)
+* [mysql](../../services/mysql/README.md)
+* [apacheLB](../../services/apacheLB/README.md)
+
+
@@ -0,0 +1,10 @@
+<html>
+<head></head>
+<body onload="openTutorial()">
+<script language="javascript">
+function openTutorial() {
+ window.location.href = "http://www.cloudifysource.org/guide/qsg/quick_start_guide";
+}
+</script>
+</body>
+</html>
@@ -0,0 +1,18 @@
+/*******************************************************************************
+* Copyright (c) 2011 GigaSpaces Technologies Ltd. All rights reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*******************************************************************************/
+service {
+ extend "../../../services/apacheLB"
+}
@@ -0,0 +1,29 @@
+/*******************************************************************************
+* Copyright (c) 2011 GigaSpaces Technologies Ltd. All rights reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*******************************************************************************/
+downloadFolder=System.properties["user.home"]+ "/.cloudify"
+
+useStickysession="false"
+
+win32 {
+ downloadUrl = "https://s3.amazonaws.com/gigaspaces-repository/org/apache/httpd/2.2.21/Apache_2.2_Win32.zip"
+ zipName = "apache.zip"
+}
+
+linux {
+
+}
+
+currentPort=8080
@@ -0,0 +1,18 @@
+application {
+ name "computers"
+
+ service {
+ name = "mysql"
+ }
+
+ service {
+ name = "apacheLB"
+ }
+
+ service {
+ name = "play"
+ dependsOn = ["mysql","apacheLB"]
+ }
+}
+
+
@@ -0,0 +1,3 @@
+service {
+ extend "../../../services/mysql"
+}
@@ -0,0 +1,173 @@
+jdbcPort=3306
+
+win64 {
+ mysqlHome="mysql-5.5.24-winx64"
+ mysqlD="mysqld.exe"
+ mysqlProgram="mysql.exe"
+ mysqladmin="mysqladmin.exe"
+ mysqldump="mysqldump.exe"
+ zipName="${mysqlHome}.zip"
+ /* http://downloads.skysql.com/archive/index/p/mysql/v/5.5.24 */
+ zipURL="http://downloads.skysql.com/archives/mysql-5.5/${zipName}"
+}
+
+linux {
+ mysqlD="mysqld"
+ mysqlProgram="mysql"
+ mysqladmin="mysqladmin"
+ mysqldump="mysqldump"
+}
+
+
+dbName="play"
+dbUser="play"
+dbPassW="play"
+
+
+/* Use the following format - leave an empty string (startDetectionQuery="") for using the default startDetection ( by port ) :
+ startDetectionQuery="select count(XXX) as cc from table_name"
+*/
+startDetectionQuery=""
+
+
+/*
+ actionType can be one of the four following: mysqladmin,mysql,mysqldump or import
+ Examples :
+
+ // In this case, dbName is a property which is defined in this properties file
+ // All the occurrences of MYSQLHOST in actionQuery, will be replaced with the private IP address on which this service instance resides
+ [
+ "actionType" : "mysqladmin",
+ "actionQuery" : "create" ,
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Creating db - Name : ${dbName} ... "
+ ] ,
+
+
+ // In this case, dbUser and dbPassW are properties which are defined in this properties file
+ // All the occurrences of MYSQLHOST in actionQuery, will be replaced with the private IP address on which this service instance resides
+ [
+ "actionType" : "mysql",
+ "actionQuery" : "\"CREATE USER '${dbUser}'@'localhost' IDENTIFIED BY '${dbPassW}';\"",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Creating db user ${dbUser} at localhost, passw ${dbPassW} in ${dbName} db... "
+ ],
+
+ // In this case:
+ // dbName,currDBZip,currImportSql are properties which are defined in this properties file
+ // currDBZip is the local name of the zip file ( after download )
+ // currImportSql is the name of the sql file which is stored in currDBZip.
+ // All the occurrences of REPLACE_WITH_DB_NAME in currImportSql, will be replaced with ${dbName}
+ [
+ "actionType" : "import",
+ "importedZip" : "${currDBZip}",
+ "importedFile" : "${currImportSql}",
+ "importedFileUrl" : "http://dropbox/1/222/mysql.zip",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Importing to ${dbName} ..."
+ ]
+
+ // In this case:
+ // dbName is a property which is defined in this properties file.
+ // if actionDbName is an empty string, then --all-databases will be used
+ // actionArgs contain the flags that you want to use with this mysqldump command
+ // Do NOT database flags, because they will be set according to the actionDbName.
+ // So do NOT use the following : --all-databases,-A,--databases, -B
+ // Do NOT -u flag flags, because it will be set according to the actionUser
+ [
+ "actionType" : "mysqldump",
+ "actionArgs" : "--add-drop-database -c --lock-all-tables -F",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "dumpPrefix" : "myDumpFile_",
+ "debugMsg" : "Invoking mysqldump ..."
+ ]
+
+*/
+postStartActions = [
+ [
+ "actionType" : "mysqladmin",
+ "actionQuery" : "create" ,
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Creating db - Name : ${dbName} ... "
+ ],
+
+ [
+ "actionType" : "mysql",
+ "actionQuery" : "\"CREATE USER '${dbUser}'@'localhost' IDENTIFIED BY '${dbPassW}';\"",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Creating db user ${dbUser} at localhost, passw ${dbPassW} in ${dbName} db... "
+ ],
+
+ [
+ "actionType" : "mysql",
+ "actionQuery" : "\"CREATE USER '${dbUser}'@'MYSQLHOST' IDENTIFIED BY '${dbPassW}';\"",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Creating db user ${dbUser} at MYSQLHOST, passw ${dbPassW} in ${dbName} db... "
+ ],
+
+
+ [
+ "actionType" : "mysql",
+ "actionQuery" : "\"CREATE USER '${dbUser}'@'%' IDENTIFIED BY '${dbPassW}';\"",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Creating db user ${dbUser} at all hosts, passw ${dbPassW} in ${dbName} db... "
+ ],
+
+
+ [
+ "actionType" : "mysql",
+ "actionQuery" : "\"grant usage on *.* to ${dbUser}@localhost identified by '${dbPassW}';\"",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Granting usage to user ${dbUser} at localhost, passw ${dbPassW} in ${dbName} db..."
+ ],
+
+ [
+ "actionType" : "mysql",
+ "actionQuery" : "\"grant usage on *.* to ${dbUser}@MYSQLHOST identified by '${dbPassW}';\"",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Granting usage to user ${dbUser} at MYSQLHOST, passw ${dbPassW} in ${dbName} db..."
+ ],
+
+ [
+ "actionType" : "mysql",
+ "actionQuery" : "\"grant usage on *.* to ${dbUser}@'%' identified by '${dbPassW}';\"",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Granting usage to user ${dbUser} at all hosts, passw ${dbPassW} in ${dbName} db..."
+ ],
+
+
+ [
+ "actionType" : "mysql",
+ "actionQuery" : "\"grant all privileges on *.* to ${dbUser}@'localhost' with grant option;\"",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Granting all privileges to user ${dbUser} in ${dbName} db at localhost... "
+ ],
+
+ [
+ "actionType" : "mysql",
+ "actionQuery" : "\"grant all privileges on *.* to ${dbUser}@'MYSQLHOST' with grant option;\"",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Granting all privileges to user ${dbUser} in ${dbName} db at MYSQLHOST... "
+ ],
+
+ [
+ "actionType" : "mysql",
+ "actionQuery" : "\"grant all privileges on *.* to ${dbUser}@'%' with grant option;\"",
+ "actionUser" : "root",
+ "actionDbName" : "${dbName}",
+ "debugMsg" : "Granting all privileges to user ${dbUser} in ${dbName} db at all hosts ... "
+ ]
+]
View
@@ -0,0 +1,30 @@
+# --- First database schema
+
+# --- !Ups
+
+create table company (
+ id bigint not null auto_increment,
+ name varchar(255) not null,
+ constraint pk_company primary key (id))
+;
+
+create table computer (
+ id bigint not null auto_increment,
+ name varchar(255) not null,
+ introduced timestamp null,
+ discontinued timestamp null,
+ company_id bigint,
+ constraint pk_computer primary key (id))
+;
+
+alter table computer add constraint fk_computer_company_1 foreign key (company_id) references company (id) on delete restrict on update restrict;
+create index ix_computer_company_1 on computer (company_id);
+
+# --- !Downs
+
+drop table if exists computer;
+
+drop table if exists company;
+
+
+
@@ -0,0 +1,18 @@
+/*******************************************************************************
+* Copyright (c) 2011 GigaSpaces Technologies Ltd. All rights reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*******************************************************************************/
+service {
+ extend "../../../services/play"
+}
Oops, something went wrong.

0 comments on commit 82ce752

Please sign in to comment.