Skip to content
Film ratings Clojure web app using Duct
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
dev
resources/film_ratings
src/film_ratings
test/film_ratings/handler
.gitignore
Dockerfile
Dockerfile-migrations
README.md
deploy.sh
docker-compose.yml
ecs-params.yml
project.clj
requirements.txt
task-execution-assume-role.json
wait-for-it.sh

README.md

film-ratings

CircleCI

Simple web application to enter films and their ratings. Uses Duct micro-framework developed by Weavejester (James Greaves).

Developing

Setup

When you first clone this repository, run:

lein duct setup

This will create files for local configuration, and prep your system for the project.

Environment

To begin developing, start with a REPL.

lein repl

Then load the development environment.

user=> (dev)
:loaded

Run go to prep and initiate the system.

dev=> (go)
:duct.server.http.jetty/starting-server {:port 3000}
:initiated

By default this creates a web server at http://localhost:3000.

When you make changes to your source files, use reset to reload any modified files and reset the server.

dev=> (reset)
:reloading (...)
:resumed

Testing

Testing is fastest through the REPL, as you avoid environment startup time.

dev=> (test)
...

But you can also run tests through Leiningen.

lein test

Running in production mode

First you need to build the uberjar for the application that will be included in the docker container(s).

lein do clean, uberjar

You will need to set the DB_PASSWORD environment variable to a password for the postgresql database. You can then bring up the postgresql, migrations and web application docker instances using docker-compose.

docker-compose up -d

This will use the DB_PASSWORD to create a postgresql database. This database will use a volume mounted for the data in a directory ./postgresdata.

The docker-compose file starts two services:

1. Postgres database - with a start up script to create an empty
database if not already present.
2. FilmApp - runs migrations (if required) & starts the web
application listening on port 3000

Examining logs

To see the logs from the docker compose services you can use:

docker-compose logs
docker-compose logs --tail=20
docker-compose logs filmapp

The first command shows the entire logs for both services. The second shows the last 20 lines of the log for both services. The last command displays the logs for just the filmapp service.

Stopping running docker compose

To stop the docker compose services run:

docker-compose down

Legal

Copyright © 2018 Chris Howe-Jones

You can’t perform that action at this time.