| 1 | ;; -*- lisp -*- |
| 2 | |
| 3 | (in-package :common-lisp-user) |
| 4 | |
| 5 | #+cmu |
| 6 | (defun init-cmu-mp () |
| 7 | ;; this isn't strictly necessary, but scheduling feels very coarse |
| 8 | ;; without startup-idle-and-top-level-loops, leading to answer delays |
| 9 | ;; of about 1s per request. |
| 10 | (unless (find-if |
| 11 | #'(lambda (proc) (string= (mp:process-name proc) "Top Level Loop")) |
| 12 | (mp:all-processes)) |
| 13 | (mp::startup-idle-and-top-level-loops))) |
| 14 | |
| 15 | #+cmu |
| 16 | (init-cmu-mp) |
| 17 | |
| 18 | ;;;; * UCW server initialization "script" |
| 19 | |
| 20 | ;;;; This file is meant to be loaded by ucwctl, but you can use it a |
| 21 | ;;;; general "startup ucw" file as well. You should customize this |
| 22 | ;;;; script to load/prepare your application. |
| 23 | |
| 24 | ;;;; ** Loadup dependencies |
| 25 | |
| 26 | ;;;; Load arnesi first so we can set arnesi::*call/cc-returns* before |
| 27 | ;;;; ucw is compiled and loaded. |
| 28 | (asdf:oos 'asdf:load-op :arnesi) |
| 29 | (setf arnesi::*call/cc-returns* nil) |
| 30 | |
| 31 | ;;;; Load up UCW itself |
| 32 | (asdf:oos 'asdf:load-op :ucw) |
| 33 | |
| 34 | (in-package :it.bese.ucw-user) |
| 35 | |
| 36 | #+(and sbcl sb-unicode) |
| 37 | (setf (external-format-for :slime) :utf-8-unix |
| 38 | (external-format-for :url) :utf-8 |
| 39 | (external-format-for :http-emacsen) :utf-8-unix |
| 40 | (external-format-for :http-lispish) :utf-8) |
| 41 | |
| 42 | ;;;; Load the default applications systems |
| 43 | |
| 44 | (asdf:oos 'asdf:load-op :ucw.examples) |
| 45 | (asdf:oos 'asdf:load-op :ucw.admin) |
| 46 | (asdf:oos 'asdf:load-op :lisp-on-lines) |
| 47 | (asdf:oos 'asdf:load-op :lisp-on-lines.example) |
| 48 | |
| 49 | ;;;; Let there be swank. |
| 50 | (swank:create-server :port 4007) |
| 51 | |
| 52 | ;;;; Finally startup the server |
| 53 | |
| 54 | ;;;; ** Finally startup the server |
| 55 | |
| 56 | (ucw:create-server :backend :araneida |
| 57 | |
| 58 | ;; :httpd |
| 59 | ;; :mod-lisp |
| 60 | ;; :aserve |
| 61 | :host "merlin.tech.coop" |
| 62 | :port 8082 |
| 63 | :applications (list |
| 64 | lol::*lol-example-application*) |
| 65 | :inspect-components nil |
| 66 | :log-root-directory (make-pathname :name nil :type nil |
| 67 | :directory (append (pathname-directory *load-truename*) |
| 68 | (list :up "logs")) |
| 69 | :defaults *load-truename*) |
| 70 | :log-level +info+ |
| 71 | :start-p t) |
| 72 | |
| 73 | ;;;; ** Allocate one database connection per thread : |
| 74 | |
| 75 | (defmethod araneida:handle-request-response :around ((handler ucw::ucw-handler) method request) |
| 76 | (clsql:with-database (my-db '("localhost" "lol" "lol" "lol") :pool t) |
| 77 | (clsql:with-default-database (my-db) |
| 78 | (call-next-method)))) |
| 79 | |
| 80 | (publish-directory (server.backend *default-server*) #P"/home/drewc/src/site/lisp-on-lines/wwwroot/dojo/" "/dojo/") |
| 81 | (publish-directory (server.backend *default-server*) #P"/home/drewc/src/site/lisp-on-lines/wwwroot/prototype/" "/prototype/") |
| 82 | |
| 83 | (publish-directory (server.backend *default-server*) #P"/home/drewc/src/sunrise/wwwroot/" "/") |
| 84 | |
| 85 | |
| 86 | |