Permalink
Browse files

Working on CL-implemented server, to run it on Heroku

  • Loading branch information...
1 parent bb223a3 commit a47ff1a0e90371d7ff4f26381bc46eff84774f2c @avodonosov avodonosov committed Feb 13, 2013
Showing with 55 additions and 0 deletions.
  1. +1 −0 Procfile
  2. +10 −0 heroku-compile.lisp
  3. +29 −0 server/server.lisp
  4. +15 −0 test-grid-server.asd
View
@@ -0,0 +1 @@
+web: ASDF_OUTPUT_TRANSLATIONS=/: ./sbcl/sbcl-1.0.54-x86-64-linux/run-sbcl.sh --load quicklisp/setup.lisp --eval "(ql:quickload :test-grid-server)" --eval "(tg-server:start (make-instance :port $PORT :smtp-password $SMTP-PASSWORD))" --eval "(loop (sleep 1000))"
View
@@ -0,0 +1,10 @@
+(in-package :cl-user)
+
+(print ">>> Building system....")
+(require 'asdf)
+(asdf:disable-output-translations)
+(require-quicklisp)
+(ql:quickload :test-grid-server)
+(print ">>> Done building system")
+
+;; change the file just to invoke recompilation at heroku: 0
View
@@ -0,0 +1,29 @@
+(defpackage :test-grid-server
+ (:nicknames :tg-server)
+ (:use :cl)
+ (:export :start))
+
+(in-package :tg-server)
+
+(defclass tg-acceptor (hunchentoot:easy-acceptor)
+ ((smtp-password :type string
+ :initarg :smtp-password
+ :accessor smtp-password
+ :initform (error ":smtp-password is required"))))
+
+(hunchentoot:define-easy-handler (send-notification :uri "/send-notification")
+ (subject body)
+ (cl-smtp:send-email "smtp.gmail.com"
+ "cl.test.grid@gmail.com"
+ "cl-test-grid-notifications@googlegroups.com"
+ subject
+ body
+ :authentication (list :login
+ "cl.test.grid@gmail.com"
+ (smtp-password hunchentoot:*acceptor*))
+ :ssl t))
+
+(defun start (&key port smtp-password)
+ (hunchentoot:start (make-instance 'tg-acceptor
+ :port port
+ :smtp-password smtp-password)))
View
@@ -0,0 +1,15 @@
+;;; -*- Mode: LISP; Syntax: COMMON-LISP; indent-tabs-mode: nil; coding: utf-8; -*-
+;;; Copyright (C) 2011 Anton Vodonosov (avodonosov@yandex.ru)
+;;; See LICENSE for details.
+
+(asdf:defsystem #:test-grid-server
+ :version "1.0.1"
+ :serial t
+ :depends-on (#:hunchentoot
+ #:cl-smtp)
+ :components
+ ((:module "server"
+ :serial t
+ :components
+ ((:file "server")))))
+

0 comments on commit a47ff1a

Please sign in to comment.