Craig Oates
d9f52f22bc
|
8 months ago | |
---|---|---|
db | 8 months ago | |
scripts | 8 months ago | |
src | 8 months ago | |
static | 8 months ago | |
templates | 8 months ago | |
tests | 11 months ago | |
.gitignore | 8 months ago | |
README.org | 11 months ago | |
app.lisp | 11 months ago | |
larder.web.asd | 8 months ago |
README.org
larder.web
A recipe-based blogging website. It's built on top of Caveman2 and uses PostgreSQL as its main database. The site, also, uses Meilisearch to provide the search features.
Usage
Installation
At the time of writing, I've only used this system on Debian 11 (bullseye), with the Steel Bank Common Lisp (SBCL) implementation (for Common Lisp) and Quicklisp (package manager). For a guide on how to install and set up Common Lisp and Quicklisp on your machine, please use the following link:
- Lisp Cookbook (Getting Started Guide)
# Change the path to were you normally store you git repositories.
cd ~/dev/
# Using SSH
git clone git@git.abbether.net:larder/larder.web.git
# Using HTTP
git clone https://git.abbether.net/larder/larder.web.git
cd larder.web
# Change paths to match your environment...
ln -s ~/dev/larder.web ~/quicklisp/local-projects/
NOTE: You can clone the repository straight into ~/quicklisp/local-projects/
to avoid creating a symbolic-link, like in the example above.
# To avoid the extra step in the example above.
cd ~/quicklisp/local-projects/
git clone https://git.abbether.net/larder/larder.web.git
cd larder.web
Because the system uses PostegreSQL, you will need to create the database before you can start the server. For information on how to install PostegreSQL onto a computer running Debian, click the following link:
# You can use your preferred Relational Database Management System (RDMS) if
# you're more comfortable using that. In this example, I'll use PSQL and create
# the databases using the shell.
sudo -u postgres psql
The system has various configurations it can run in. They are:
development
(this is the default)production
test
They are set using environment-variables. This part of the code-base will be expanded on later. For now, you just need to know they exist.
-- To create the database used when the APP_ENV is set to 'development'.
create user larder with password 'lwebdb';
create database larderdev;
grant all privileges on database larderdev to larder;
-- To create the database used when the APP_ENV is set to 'production'.
create user larder with password 'lwebdb';
create database larderdev;
grant all privileges on database larderdev to larder;
-- Delete the database when the APP_ENV is set to 'production'.
drop database larderprod with (force);
-- To create the database used when the APP_ENV is set to 'test'.
create user larder with password 'lwebdb';
create database lardertest;
grant all privileges on database lardertest to larder;
-- To close PSQL...
\q
The user
, password
and database
values are the default values. You can
change them to what you prefer. If you do that, though, you will need to update
the various configuration settings in src/config.lisp
, so they match.
Caveman2 projects can switch out the underlying server. The default one is
Hunchentoot, but this system uses Woo. Because of this, you need to install
additional packages from apt-get
.
sudo apt update
sudo apt install libev-dev gcc libc6-dev
Depending on your system, there is a chance you might need to install more packages. Unfortunately, I can't predict what you have and don't have. So, I might be leaving you hanging here. My apologies if so.
When it comes to dealing with JSON, this system uses a package call
jzon
. Unfortunately, at the time of writing, this package is not in the
Quicklisp repository. Because of this, you will need to clone the repository and
add it to your ~/quicklisp/local-projects/
directory manually. To do that,
use the code below.
cd ~/quicklisp/local-projects/
git clone https://github.com/Zulu-Inuoe/jzon.git
For information on this package, use the following link:
- jzon (GitHub repository)
You should now be able to run the website.
Installing Meilisearch
To be written…
Running the Website
At the time of writing, the system has been developed in Emacs with SLIME. There are alternative development environments for running Common Lisp systems, but I don't have any experience using them. Because of this, I'm going to stick to documenting how to run the website from within Emacs, with SLIME.
C-x C-f ~/quicklisp/local-projects/larder.web/larder.web.asd
(opens the system definition file)M-x slime
(start SLIME)
;; In the SLIME buffer...
(ql:quickload :larder.web)
(larder.web:start :server 'woo :port 5000 :debug t)
;; I tend to lean on the defaults and use...
(larder.web:start :server 'woo)
;; You can replace ~'woo~ with ~'hunchentoot~ but the preference is ~'woo~.
If all has gone well you can then go to http://localhost:5000 in your browser and view the site.
Author
- Craig Oates (craig@craigoates.net)
Copyright
Copyright (c) 2023 Craig Oates (craig@craigoates.net)