I'm now starting to use Rockets for projects at work, so I need a way to create the user database from scratch. Anyone wanting to start using the newLISP on Rockets Blog source code will need to do the same thing. So our desires align!
I've created a simple installation script called setup-rockets.lisp. It needs to be run from the command line:sudo newlisp setup-rockets.lisp
This will ask you a few questions (database, name, password, etc) and set up a new database for you with the right tables and create an admin user. Obviously you never want this to be run by someone else over the web, so make sure that it can't be viewed over your web server (either by permissions, or by using my Apache .htaccess directive that excludes all files ending in .lisp from being viewed (.lsp files are fine though!)
# Prevent framework source from being accessed
<Files ~ "\.lisp$">
Order allow,deny
Deny from all
</Files>
# Prevent database files from being accessed
<Files ~ "\.db$">
Order allow,deny
Deny from all
</Files>
chown www-data:www-data DATABASENAME.db
chmod 755 DATABASENAME.db
; get all existing posts
(set 'total-posts (int (first (first (query (string "SELECT Count(*) FROM Posts WHERE PostType='Blog post'"))))))
(set 'total-pages (/ total-posts Blog:posts-per-page))
Views: 6492