Kunhatan engine core.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Birunda 5e0ebf15d3 Install instructions and Dockerfile update. 8 months ago
json-schemas router refactoring for better organization 10 months ago
scripts Install instructions and Dockerfile update. 8 months ago
src Install instructions and Dockerfile update. 8 months ago
tests Initial commit 1 year ago
.dockerignore dockerbuild 9 months ago
.gitignore backup tools and kunhatan cli modularization 9 months ago
Dockerfile Install instructions and Dockerfile update. 8 months ago
LICENSE.txt Lincense 1 year ago
README.markdown Install instructions and Dockerfile update. 8 months ago
kunhatan.asd improv vichan http import 9 months ago

README.markdown

Kunhatan

Usage

(ql:quickload :kunhatan)
(kunhatan:start-server :kport 8080)

Dependencies

  • SBCL >= 2.1.0
  • Quicklisp
  • Defrest
  • json-schema
  • ImageMagick
  • Gifsicle
  • cURL >= 7.74
  • rsync
  • file

Attention

ImageMagick must have the right policy to be able to generate PDF thumbnails! In your /etc/ImageMagick-7/policy.xml, before the add:

  <policy domain="coder" rights="read | write" pattern="PDF" />

Installation

You need the basic toolchain to compile C programs in your distro, in debian that would be the meta-package build-essential, on Archlinux, base-devel, and so on. Search the right meta-package for your distro.

Installing SBCL

Get the right SBCL version from the SBCL website, 2.1.0 or major and install it on your system.

With curl you can do this.

# Download link for the SBCL program binaries
SBCL_URL=http://prdownloads.sourceforge.net/sbcl/sbcl-2.1.0-x86-64-linux-binary.tar.bz2
cd /tmp
curl -O -R -L $SBCL_URL
tar -xf sbcl-2.1.0-x86-64-linux-binary.tar.bz2
cd sbcl-2.1.0-x86-64-linux
sudo ./install.sh # Install SBCL system-wide

If your distro do have a SBCL package with the right version, equal or major than 2.1.0, just use it.

Installing cURL

If you have a cURL version minor than 7.74, you can install a recent one downloading it and compiling from the cURL website. Just do:

CURL_URL=https://curl.haxx.se/download/curl-7.74.0.tar.bz2
cd /tmp
curl -O $CURL_URL
tar -xf curl-7.74.0.tar.bz2
cd curl-7.74.0
make
sudo make install
# Replace current curl with the new version
sudo mv /usr/bin/curl /usr/bin/curl.old
sudo ln -s /usr/local/bin/curl /usr/bin/curl

If your distro do have a cURL package with the right version, equal or major than 7.74, just use it.

Installing Quicklisp

Just download it from their website and install it with SBCL.

QUICKLISP_URL=https://beta.quicklisp.org/quicklisp.lisp

# Make a common-lisp directory on the user folder.
# That step is necessary to put the engine project on that folder later
# so ASDF can find and load the engine code from SBCL
mkdir ~/common-lisp/
cd ~/common-lisp/

curl -o setup.lisp $QUICKLISP_URL

# Install Quicklisp
sbcl --eval '(require "asdf")' \
     --load setup.lisp \
     --eval '(quicklisp-quickstart:install)'

# Add quicklisp to .sbclrc, so it will be loaded every time you
# open SBCL, you can do it by running (ql:add-to-init-file)
# inside the SBCL interpreter with setup.lisp loaded:
#   sbcl --load setup.lisp --eval '(ql:add-to-init-file)'
echo '
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
                                       (user-homedir-pathname))))
  (when (probe-file quicklisp-init)
      (load quicklisp-init)))' > ~/.sbclrc

Installing Kunhatan Lisp dependencies

The majority of kunhatan packages are installed automagically with quicklisp, but some packages aren't on Quicklisp's repos, so you need to install them manually.

Fortunatelly, I copied that packages to this gitea instance so you can easly install them, do the following inside your ~/common-lisp/ folder, you must have git installed.

git clone http://git.topkek.cf/birunda/json-schema
git clone http://git.topkek.cf/birunda/trivial-thumbnail
git clone http://git.topkek.cf/birunda/defrest
git clone https://github.com/nightfly19/cl-arrows
git clone https://github.com/fisxoj/sanity-clause

Symlinking folder

Now you just need to symlink the kunhatan engine folder to the ~/common-lisp/ folder so Quicklisp can see it. Go to where you cloned kunhatan-core and symlink it.

# Assuming you have cloned it on $HOME
ln -sf $HOME/kunhatan-core ~/common-lisp/

You can clone/copy it directly on ~/common-lisp/ folder too.

Post install

Create the basic folders expected from the engine:

# Inside the engine folder
cd ~/common-lisp/kunhatan-core/ # Or whatever you named it
mkdir ipdb # IP database files
mkdir db   # Database files
mkdir www  # Static files to be served

Running

You can run it loading :kunhatan from SBCL with Quicklisp.

sbcl --eval '(ql:quickload :kunhatan)' \ # Load the engine
     --eval '(kunhatan:start-kunhatan)' \ # Start REST server
     --eval '(kunhatan.daemon:start-daemon)' # Start daemon server

The first time you run this will take a little of time, Quicklisp will be compiling all the dependencies first, that will only happen once.

Development

Kunhatan is just a REST server with a web client, pretty straight forward. It can be split in the following parts:

  • REST Controller
  • Models
  • Rules
  • Client

Author

  • Birunda

Copyright (c) 2020 Birunda

License

Licensed under the WTFPL License.