making server buildable
This commit is contained in:
parent
bc15f05603
commit
ec3bde1191
16
Makefile
Normal file
16
Makefile
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
all: build-server
|
||||||
|
|
||||||
|
build-server:
|
||||||
|
sbcl --eval '(ql:quickload "deploy")' --eval '(asdf:load-asd "/home/chris/dev/tfcconnection/tfcserver.asd")' --eval '(ql:quickload :tfcserver)' --eval '(push :deploy-console *features*)' --eval "(asdf:make :tfcserver)" --eval '(quit)'
|
||||||
|
|
||||||
|
serve:
|
||||||
|
hugo server --noHTTPCache
|
||||||
|
|
||||||
|
css:
|
||||||
|
NODE_ENV=development ./themes/blowfish/node_modules/tailwindcss/lib/cli.js -c ./themes/blowfish/tailwind.config.js -i ./themes/blowfish/assets/css/main.css -o ./assets/css/compiled/main.css --jit -w
|
||||||
|
|
||||||
|
build-site:
|
||||||
|
rm -rf public && NODE_ENV=production ./themes/blowfish/node_modules/tailwindcss/lib/cli.js -c ./themes/blowfish/tailwind.config.js -i ./themes/blowfish/assets/css/main.css -o ./assets/css/compiled/main.css --jit && hugo --gc --minify
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf public
|
26
default.nix
26
default.nix
|
@ -2,9 +2,25 @@
|
||||||
stdenv,
|
stdenv,
|
||||||
lib,
|
lib,
|
||||||
hugo,
|
hugo,
|
||||||
go
|
go,
|
||||||
|
sbcl,
|
||||||
|
sbclPackages,
|
||||||
|
makeWrapper,
|
||||||
|
openssl
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
sbcl' = sbcl.withPackages (ps: with ps; [
|
||||||
|
hunchentoot
|
||||||
|
dexador
|
||||||
|
clack
|
||||||
|
jzon
|
||||||
|
serapeum
|
||||||
|
openssl
|
||||||
|
openssl.out
|
||||||
|
openssl.dev
|
||||||
|
]);
|
||||||
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "tfcconnection";
|
name = "tfcconnection";
|
||||||
pname = "tfcconnection";
|
pname = "tfcconnection";
|
||||||
|
@ -12,16 +28,22 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
hugo
|
hugo
|
||||||
go
|
go
|
||||||
|
sbcl'
|
||||||
];
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
hugo
|
make
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShell = import ./shell.nix { inherit pkgs; };
|
devShell = import ./shell.nix { inherit pkgs; };
|
||||||
|
defaultPackage = pkgs.callPackage ./default.nix { };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
(require :asdf)
|
(ql:quickload '(hunchentoot clack dexador com.inuoe.jzon serapeum bordeaux-threads))
|
||||||
(require :hunchentoot)
|
|
||||||
(require :dexador)
|
|
||||||
(require :serapeum)
|
|
||||||
(require :clack)
|
|
||||||
(require :com.inuoe.jzon)
|
|
||||||
;; (load "~/quicklisp/setup.lisp")
|
|
||||||
;; (ql:quickload :cffi :silent t)
|
|
||||||
;; (ql:quickload '(hunchentoot clack dexador com.inuoe.jzon serapeum))
|
|
||||||
|
|
||||||
(uiop:define-package tfc-server
|
(defpackage tfc-server
|
||||||
(:use :cl :uiop :com.inuoe.jzon :clack))
|
(:use :cl :uiop :com.inuoe.jzon :clack))
|
||||||
|
|
||||||
(in-package :tfc-server)
|
(in-package :tfc-server)
|
||||||
|
@ -19,7 +11,10 @@
|
||||||
(defvar *stream*)
|
(defvar *stream*)
|
||||||
(defvar *auth-token* "boFFRM68vvXbO-DO7S9YDg86lHX027-hd07mn0dh")
|
(defvar *auth-token* "boFFRM68vvXbO-DO7S9YDg86lHX027-hd07mn0dh")
|
||||||
|
|
||||||
(defvar *server* (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242)))
|
(defvar *server*)
|
||||||
|
|
||||||
|
(defun start-server (port)
|
||||||
|
(setq *server* (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port port))))
|
||||||
|
|
||||||
(defun post-health-form (data-list)
|
(defun post-health-form (data-list)
|
||||||
"Takes the health form as an alist and posts it to nocodb"
|
"Takes the health form as an alist and posts it to nocodb"
|
||||||
|
@ -136,3 +131,19 @@
|
||||||
(post-health-form *last-list-data*)
|
(post-health-form *last-list-data*)
|
||||||
(format nil "thankyou"))))))
|
(format nil "thankyou"))))))
|
||||||
|
|
||||||
|
(defun main ()
|
||||||
|
(start-server 4242)
|
||||||
|
(format t "Server has started on port 4242~&")
|
||||||
|
(handler-case (bt:join-thread (find-if (lambda (th)
|
||||||
|
(search "hunchentoot" (bt:thread-name th)))
|
||||||
|
(bt:all-threads)))
|
||||||
|
(#+sbcl sb-sys:interactive-interrupt
|
||||||
|
#+ccl ccl:interrupt-signal-condition
|
||||||
|
#+clisp system::simple-interrupt-condition
|
||||||
|
#+ecl ext:interactive-interrupt
|
||||||
|
#+allegro excl:interrupt-signal
|
||||||
|
() (progn
|
||||||
|
(format *error-output* "Aborting.~&")
|
||||||
|
(hunchentoot:stop *server*)
|
||||||
|
(uiop:quit)))
|
||||||
|
(error (c) (format t "Woops, an unknown error occured:~&~a~&" c))))
|
Binary file not shown.
Before Width: | Height: | Size: 679 KiB |
18
tfcserver.asd
Normal file
18
tfcserver.asd
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#-asdf3.1 (error "requires asdf 3.1")
|
||||||
|
|
||||||
|
(defsystem "tfcserver"
|
||||||
|
:version "0.1.0"
|
||||||
|
:author "Chris Cochrun"
|
||||||
|
:license "AGPLV3"
|
||||||
|
:depends-on ("hunchentoot" "dexador" "serapeum" "clack" "com.inuoe.jzon" "bordeaux-threads") ;; <== list of Quicklisp dependencies
|
||||||
|
:components ((:module "src"
|
||||||
|
:components
|
||||||
|
((:file "main"))))
|
||||||
|
:description "Restful server to handle website pieces"
|
||||||
|
:long-description "Restful server to handle website pieces"
|
||||||
|
;; :in-order-to ((test-op (test-op "tfcserver-test")))
|
||||||
|
:defsystem-depends-on (:deploy) ;; (ql:quickload "deploy") before
|
||||||
|
:build-operation "deploy-op" ;; leave as is
|
||||||
|
:build-pathname "tfcapi"
|
||||||
|
:entry-point "tfc-server::main"
|
||||||
|
)
|
Loading…
Reference in a new issue