The musi.clj has been made as a library of artists, albums and songs. It's a Clojure project generated using Luminus v1.16.7, Ring, Korma for database operations, Selmer library for HTML template rendering (similar to Django templating), Timbre for logging, Environ for using database configurations from a single file and Bootstrap and JavaScript for frontend development.
Luminus is a template for web applications. Luminus generates a project and wires in the libraries to support pretty much every aspect of web development including sessions, cookies, route-handling and template rendering.
Ring is a Clojure web applications library, which acts as an abstraction between our web application (musi.clj) and the underlying web server or servlet container.
Korma is a pure-Clojure DSL for SQL. However, be careful with Korma since their website is currently down for quite some time, which might indicate that the project has been canceled. Some Clojure enthusiasts are keeping the library up-to-date as much as they can.
Selmer is an HTML template rendering library modeled after the Django framework. Selmer allows us to generate dynamic pages, script loops and conditional rendering, extend other Selmer templates, and so on.
Timbre is a pure-Clojure logging library. There's not much else to say.
Environ allows us to create different application configurations for different environments.
Migratus is an API and plugin for Leiningen that automatically migrates , and rolls back, our database. In a nutshell, it allows us to create a series of SQL scripts, which will be executed in order (based on filename) against our database.
Bootstrap and JavaScript are pretty self-explanatory.
You will need Leiningen 2.0 or above and PostgreSQL installed.
These are the steps for running the application:
# psql -U postgres -d postgres -h localhost
to the database as though it were a user:
postgres=# CREATE ROLE musiclj LOGIN;
like p455w0rd. We can do this using the \password command.
postgres=# \password musiclj;
we should create the musiclj schema and assign our musiclj role to be a "super user" of that schema:
postgres=# CREATE SCHEMA AUTHORIZATION musiclj;
postgres=# GRANT ALL ON SCHEMA musiclj TO musiclj;
postgres=# GRANT ALL ON ALL TABLES IN SCHEMA hipstr TO hipstr;
postgres=# \q
After disconnecting from the PostgreSQL shell, we can test out our new user by logging in to the default database using the musiclj role.
Back at the terminal, relaunch psql, but this time using the musiclj role we created:
# psql -U musiclj -d postgres -h localhost
That is it for the postgres terminal part. You can type \dt to see all the tables you have in the schema. Now, for Migratus:
# lein migratus migrate
This will migrate any yet-to-be-run migration script inside our migrations directory.
# lein ring server
After that, just create an account in order to access the main pages of the website.
The project was developed as part of an assignment for the course Software Engineering Tools and Methodology on Master's studies - Software Engineering and Computer Sciences at the Faculty of Organizational Sciences, University of Belgrade, Serbia.