Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanups

  • Loading branch information...
commit f284f73992784143ebc586e565c76be08987762d 1 parent 48403aa
@atgreen authored
View
18 app.asd
@@ -0,0 +1,18 @@
+(asdf:defsystem #:webapp
+ :description "Bobo is Secret Agent."
+ :author "Anthony Green <green@spindazzle.org>"
+ :version "0"
+ :serial t
+ :components ((:file "package")
+ (:file "irc")
+ (:file "oauth2-google")
+ (:file "tropo")
+ (:file "bobo"))
+ :depends-on (:cl-irc
+ :hunchentoot
+ :puri
+ :cl-json
+ :drakma
+ :babel
+ :bordeaux-threads
+ :trivial-timers))
View
5 data/run-lisp.sh
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-D=`dirname $0`
-SBCL_HOME=`(cd $D; pwd)` $D/sbcl --core $D/sbcl-dist.core --load $D/asdf.fasl --userinit $D/sbclrc
-
View
BIN  data/sbcl-dist.core.gz
Binary file not shown
View
3  data/sbclrc
@@ -1,6 +1,3 @@
-(require :sb-posix)
-
-
;;; The following lines added by ql:add-to-init-file:
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
View
52 init-app
@@ -15,7 +15,7 @@ Usage: $0
Run this script in the root directory of your openshift app's git repo.
-Report bugs and patches to <green@moxielogic.com>."
+Report bugs and patches to <green@spindazzle.org."
if test $# != 0; then
echo "$0: too many arguments$usage" >&2
@@ -27,14 +27,56 @@ if ! test -d diy; then
exit 1
fi
-cd diy
curl -O http://beta.quicklisp.org/quicklisp.lisp
HOME=`pwd` sbcl --load quicklisp.lisp --eval "(quicklisp-quickstart:install)" --eval "(quicklisp:quickload :hunchentoot)" --eval "(quit)"
-cd ..
+cat > .openshift/action_hooks/pre_build <<EOF
+#!/bin/sh
+# Make sure we have decompressed the sbcl core file
+cd \$OPENSHIFT_REPO_DIR/../data
+if test -f sbcl-dist.core.gz; then
+ gzip -d sbcl-dist.core.gz
+fi
+EOF
+chmod +x .openshift/action_hooks/pre_build
cat > .openshift/action_hooks/start <<EOF
#!/bin/sh
-cd $OPENSHIFT_REPO_DIR/diy
-HOME=`pwd` ../../data/run-lisp.sh
+cd \$OPENSHIFT_REPO_DIR
+HOME=\`pwd\` SBCL_HOME=\`(cd ../data; pwd)\` nohup ../data/sbcl \
+ --core ../data/sbcl-dist.core \
+ --load ../data/asdf.fasl \
+ --userinit ../data/sbclrc \
+ --eval "(require :webapp)" --eval "(webapp:start-webapp)" > \${OPENSHIFT_LOG_DIR}/webapp.log 2>&1 &
+EOF
+chmod +x .openshift/action_hooks/start
+
+cat > .openshift/action_hooks/build <<EOF
+#!/bin/sh
+if ! test -d \${OPENSHIFT_DATA_DIR}/.cache; then
+ mkdir -p \${OPENSHIFT_DATA_DIR}/.cache;
+fi
+cd \${OPENSHIFT_REPO_DIR}
+ln -s \${OPENSHIFT_DATA_DIR}/.cache .
+HOME=`pwd` SBCL_HOME=\${OPENSHIFT_DATA_DIR} \${OPENSHIFT_DATA_DIR}/sbcl --core \${OPENSHIFT_DATA_DIR}/sbcl-dist.core --userinit \${OPENSHIFT_DATA_DIR}/sbclrc --eval "(require :webapp)" --eval "(quit)"
EOF
+chmod +x .openshift/action_hooks/build
+
+cat > .openshift/action_hooks/stop <<EOF
+#!/bin/sh
+kill \`ps -ef | grep sbcl | grep -v grep | awk '{ print \$2 }'\` > /dev/null 2>&1
+exit 0
+EOF
+chmod +x .openshift/action_hooks/stop
+
+SRCDIR=`dirname $0`
+
+cp $SRCDIR/*.lisp .
+cp $SRCDIR/*.asd .
+
+cat > .gitignore <<EOF
+.cache
+*~
+EOF
+
+git add .gitignore .openshift *
View
26 package.lisp
@@ -0,0 +1,26 @@
+;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: WEBAPP; Base: 10 -*-
+
+;;; Copyright (C) 2012 Anthony Green <green@spindazzle.org>
+
+;;; Webapp is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3, or (at your
+;;; option) any later version.
+;;;
+;;; Webapp is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with webapp; see the file COPYING3. If not see
+;;; <http://www.gnu.org/licenses/>.
+
+;;;; package.lisp
+
+(defpackage #:webapp
+ (:use #:hunchentoot #:cl)
+ (:shadow #:package)
+ (:export #:start-webapp))
+
+(in-package #:webapp)
View
2  upload-sbcl
@@ -19,7 +19,7 @@ usage="
Usage: $0 USER@APP-NAMESPACE.rhcloud.com APP
-Report bugs and patches to <green@moxielogic.com>."
+Report bugs and patches to <green@spindazzle.org>."
if test $# != 2; then
echo "$0: missing arguments$usage" >&2
View
9 webapp.asd
@@ -0,0 +1,9 @@
+(asdf:defsystem #:webapp
+ :description "This is my webapp template."
+ :author "Anthony Green <green@spindazzle.org>"
+ :version "0"
+ :serial t
+ :components ((:file "package")
+ (:file "webapp"))
+ :depends-on (:hunchentoot))
+
View
32 webapp.lisp
@@ -0,0 +1,32 @@
+;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: WEBAPP; Base: 10 -*-
+;;;
+;;; Copyright (C) 2012 Anthony Green <green@spindazzle.org>
+;;;
+;;; Webapp is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3, or (at your
+;;; option) any later version.
+;;;
+;;; Webapp is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with Webapp; see the file COPYING3. If not see
+;;; <http://www.gnu.org/licenses/>.
+
+;; Top level for webapp
+
+(in-package :webapp)
+
+(defun start-webapp ()
+ (let ((openshift-ip (sb-ext:posix-getenv "OPENSHIFT_INTERNAL_IP"))
+ (openshift-port (sb-ext:posix-getenv "OPENSHIFT_INTERNAL_PORT")))
+ (format t "** Starting hunchentoot @ ~A:~A~%" openshift-ip openshift-port)
+ (hunchentoot:start
+ (make-instance 'hunchentoot:easy-acceptor
+ :address openshift-ip
+ :port openshift-port))
+ (loop
+ (sleep 3000))))
Please sign in to comment.
Something went wrong with that request. Please try again.