Permalink
Browse files

first commit of dancer example repo

  • Loading branch information...
0 parents commit cc89f0d5b8e2620a9bdf64e3112049105c1e0c66 @dblado dblado committed Sep 26, 2011
@@ -0,0 +1,4 @@
+#!/bin/bash
+# This is a simple build script, place your post-deploy but pre-start commands
+# in this script. This script gets executed directly, so it could be python,
+# php, ruby, etc.
@@ -0,0 +1,58 @@
+Feel free to change or remove this file, it is informational only.
+
+Repo layout
+===========
+perl/ - Externally exposed perl code goes here
+libs/ - Additional libraries
+misc/ - For not-externally exposed perl code
+../data - For persistent data (Also in env var OPENSHIFT_DATA_DIR)
+deplist.txt - A list of perl modules required to run
+.openshift/action_hooks/build - Script that gets run every push, just prior to
+ starting your app
+
+
+Environment Variables
+=====================
+
+OpenShift Express provides several environment variables to reference for ease
+of use. The following list are some common variables but far from exhaustive:
+
+ $ENV{'OPENSHIFT_APP_NAME'} - Application name
+ $ENV{'OPENSHIFT_APP_DIR'} - Application dir
+ $ENV{'OPENSHIFT_DATA_DIR'} - For persistent storage (between pushes)
+ $ENV{'OPENSHIFT_TMP_DIR'} - Temp storage (unmodified files deleted after 10 days)
+
+When embedding a database using rhc-ctl-app, you can reference environment
+variables for username, host and password:
+
+ $ENV{'OPENSHIFT_DB_HOST'} - DB host
+ $ENV{'OPENSHIFT_DB_PORT'} - DB Port
+ $ENV{'OPENSHIFT_DB_USERNAME'} - DB Username
+ $ENV{'OPENSHIFT_DB_PASSWORD'} - DB Password
+
+To get a full list of environment variables, simply add a line in your
+.openshift/action_hooks/build script that says "export" and push.
+
+
+Notes about layout
+==================
+Please leave perl, libs and data directories but feel free to create additional
+directories if needed.
+
+Note: Every time you push, everything in your remote repo dir gets recreated
+please store long term items (like an sqlite database) in ../data which will
+persist between pushes of your repo.
+
+
+deplist.txt
+===========
+
+Adding module names to deplist.txt causes your remote OpenShift node to download
+the required modules and install them.
+
+
+Additional information
+======================
+
+Link to additional information will be here, when we have it :)
+
@@ -0,0 +1,39 @@
+Dancer on OpenShift Express
+============================
+
+This git repository helps you get up and running quickly w/ a Dancer installation
+on OpenShift Express. The Dancer project name used in this repo is 'openshift'
+but you can feel free to change it.
+
+You can delete the database from your git repo after the first push (you probably
+should for security). On subsequent pushes, a 'python manage.py syncdb' is
+executed to make sure that any models you added are created in the DB. If you
+do anything that requires an alter table, you could add the alter statements
+in GIT_ROOT/.openshift/action_hooks/alter and then use
+GIT_ROOT/.openshift/action_hooks/build to execute that script (make susre to
+back up your database w/ rhc-snapshot first :) )
+
+
+Running on OpenShift
+----------------------------
+
+Create an account at http://openshift.redhat.com/
+
+Create a perl-5.10 application
+
+ rhc-create-app -a dancer -t perl-5.10
+
+Add this upstream seambooking repo
+
+ cd dancer
+ git remote add upstream -m master git://github.com/openshift/dancer-example.git
+ git pull -s recursive -X theirs upstream master
+
+Then push the repo upstream
+
+ git push
+
+That's it, you can now checkout your application at:
+
+ http://dancer-$yourdomain.rhcloud.com
+
@@ -0,0 +1,5 @@
+Test::Base
+YAML
+Dancer
+Plack::Handler::Apache2
+
No changes.
No changes.
@@ -0,0 +1,22 @@
+MANIFEST
+bin/app.pl
+config.yml
+environments/development.yml
+environments/production.yml
+views/index.tt
+views/layouts/main.tt
+MANIFEST.SKIP
+lib/openshift.pm
+public/css/style.css
+public/css/error.css
+public/images/perldancer-bg.jpg
+public/images/perldancer.jpg
+public/500.html
+public/404.html
+public/dispatch.fcgi
+public/favicon.ico
+public/dispatch.cgi
+public/javascripts/jquery.js
+t/002_index_route.t
+t/001_base.t
+Makefile.PL
@@ -0,0 +1,13 @@
+^\.git\/
+maint
+^tags$
+.last_cover_stats
+Makefile$
+^blib
+^pm_to_blib
+^.*.bak
+^.*.old
+^t.*sessions
+^cover_db
+^.*\.log
+^.*\.swp$
@@ -0,0 +1,21 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'openshift',
+ AUTHOR => q{YOUR NAME <youremail@example.com>},
+ VERSION_FROM => 'lib/openshift.pm',
+ ABSTRACT => 'YOUR APPLICATION ABSTRACT',
+ ($ExtUtils::MakeMaker::VERSION >= 6.3002
+ ? ('LICENSE'=> 'perl')
+ : ()),
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ 'YAML' => 0,
+ 'Dancer' => 1.3072,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'openshift-*' },
+);
@@ -0,0 +1,4 @@
+#!/usr/bin/env perl
+use Dancer;
+use openshift;
+dance;
@@ -0,0 +1,29 @@
+# This is the main configuration file of your Dancer app
+# env-related settings should go to environments/$env.yml
+# all the settings in this file will be loaded at Dancer's startup.
+
+# Your application's name
+appname: "openshift"
+
+# The default layout to use for your application (located in
+# views/layouts/main.tt)
+layout: "main"
+
+# when the charset is set to UTF-8 Dancer will handle for you
+# all the magic of encoding and decoding. You should not care
+# about unicode within your app when this setting is set (recommended).
+charset: "UTF-8"
+
+# template engine
+# simple: default and very basic template engine
+# template_toolkit: TT
+
+template: "simple"
+
+# template: "template_toolkit"
+# engines:
+# template_toolkit:
+# encoding: 'utf8'
+# start_tag: '[%'
+# end_tag: '%]'
+
@@ -0,0 +1,27 @@
+# configuration file for development environment
+
+# the logger engine to use
+# console: log messages to STDOUT (your console where you started the
+# application server)
+# file: log message to a file in log/
+logger: "console"
+
+# the log level for this environement
+# core is the lowest, it shows Dancer's core log messages as well as yours
+# (debug, warning and error)
+log: "core"
+
+# should Dancer consider warnings as critical errors?
+warnings: 1
+
+# should Dancer show a stacktrace when an error is caught?
+show_errors: 1
+
+# auto_reload is a development and experimental feature
+# you should enable it by yourself if you want it
+# Module::Refresh is needed
+#
+# Be aware it's unstable and may cause a memory leak.
+# DO NOT EVER USE THAT FEATURE IN PRODUCTION
+# OR TINY KITTENS SHALL DIE WITH LOTS OF SUFFERING
+auto_reload: 0
@@ -0,0 +1,17 @@
+# configuration file for production environment
+
+# only log warning and error messsages
+log: "warning"
+
+# log message to a file in logs/
+logger: "file"
+
+# don't consider warnings critical
+warnings: 0
+
+# hide errors
+show_errors: 0
+
+# cache route resolution for maximum performance
+route_cache: 1
+
@@ -0,0 +1,10 @@
+package openshift;
+use Dancer ':syntax';
+
+our $VERSION = '0.1';
+
+get '/' => sub {
+ template 'index';
+};
+
+true;
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+<title>Error 404</title>
+<link rel="stylesheet" href="/css/error.css" />
+<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
+</head>
+<body>
+<h1>Error 404</h1>
+<div id="content">
+<h2>Page Not Found</h2><p>Sorry, this is the void.</p>
+</div>
+<div id="footer">
+Powered by <a href="http://perldancer.org/">Dancer</a> 1.3072
+</div>
+</body>
+</html>
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+<title>Error 500</title>
+<link rel="stylesheet" href="/css/error.css" />
+<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
+</head>
+<body>
+<h1>Error 500</h1>
+<div id="content">
+<h2>Internal Server Error</h2><p>Wooops, something went wrong</p>
+</div>
+<div id="footer">
+Powered by <a href="http://perldancer.org/">Dancer</a> 1.3072
+</div>
+</body>
+</html>
@@ -0,0 +1,70 @@
+body {
+ font-family: Lucida,sans-serif;
+}
+
+h1 {
+ color: #AA0000;
+ border-bottom: 1px solid #444;
+}
+
+h2 { color: #444; }
+
+pre {
+ font-family: "lucida console","monaco","andale mono","bitstream vera sans mono","consolas",monospace;
+ font-size: 12px;
+ border-left: 2px solid #777;
+ padding-left: 1em;
+}
+
+footer {
+ font-size: 10px;
+}
+
+span.key {
+ color: #449;
+ font-weight: bold;
+ width: 120px;
+ display: inline;
+}
+
+span.value {
+ color: #494;
+}
+
+/* these are for the message boxes */
+
+pre.content {
+ background-color: #eee;
+ color: #000;
+ padding: 1em;
+ margin: 0;
+ border: 1px solid #aaa;
+ border-top: 0;
+ margin-bottom: 1em;
+}
+
+div.title {
+ font-family: "lucida console","monaco","andale mono","bitstream vera sans mono","consolas",monospace;
+ font-size: 12px;
+ background-color: #aaa;
+ color: #444;
+ font-weight: bold;
+ padding: 3px;
+ padding-left: 10px;
+}
+
+pre.content span.nu {
+ color: #889;
+ margin-right: 10px;
+}
+
+pre.error {
+ background: #334;
+ color: #ccd;
+ padding: 1em;
+ border-top: 1px solid #000;
+ border-left: 1px solid #000;
+ border-right: 1px solid #eee;
+ border-bottom: 1px solid #eee;
+}
+
Oops, something went wrong.

0 comments on commit cc89f0d

Please sign in to comment.