A photo gallery app in Clojure with tag-based organization
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.
Joseph Graham 44a6f49955
fix the order tags are displayed on both the upload and tag_manager pages
2 weeks ago
.vscode initial commit 3 months ago
env initial commit 3 months ago
resources fix the order tags are displayed on both the upload and tag_manager pages 2 weeks ago
src/clj/xyloobservations re-factor the code to be a bit more readable 4 weeks ago
test/clj/xyloobservations initial commit 3 months ago
.gitignore initial commit 3 months ago
Aptfile add an Aptfile for heroku-buildpack-apt 1 month ago
COPYING added COPYRIGHT 2 weeks ago
Capstanfile initial commit 3 months ago
Dockerfile initial commit 3 months ago
Procfile initial commit 3 months ago
README.md Update 'README.md' 2 weeks ago
project.clj got the pipeline to actually upload the image 1 month ago



I made this app for my personal photo gallery. I wanted elegant tag-based organization for my photos.

It's based on Luminus and I designed it to work with PostgreSQL.

Running this code

Here I explain briefly how you may run this code on your workstation for development.


Create a PostgreSQL database and user, and create a file dev-config.edn with credentials. An example of how that might look:

{:dev true
 :port 3000
 ;; when :nrepl-port is set the application starts the nREPL server on load
 :nrepl-port 7000
 ; set your dev database connection URL here
 :database-url "postgresql://localhost/dbname?user=dbuser&password=dbpass"

 ;; s3 or filesystem
 :image-store "filesystem"

 ;; the url s3 or your webserver exposes the images
 :url-prefix "https://example.com/"}

 ;; if storing on filessytem
 ;; this should be a writeable directory where your webserver will serve the images
 :img-path "/var/www/html/images/"

 ;; ;; if storing in s3.
 ;; ;; you will need to setup the bucket for public access
 ;; :aws-access-key ""
 ;; :aws-secret-key ""
 ;; :aws-region "eu-west-2"
 ;; :bucket-name ""

To start a web server for the application, run:

lein repl

Now you should be able to access the app at http://localhost:3000/.

For uploading images there is an admin interface which you can access at /login. To create credentials for this type these in the repl (after running (start)):

(in-ns 'xyloobservations.authfunctions)
 (create-user! "youruser" "yourpass")


If you are willing to comply with the requirements of the Affero GPL you may use this code for your own photo gallery. In addition to applying appropriate config for your environment you will need to modify some of the templates to customise it for your site. In-particular base.html and about.html.

For general info on hosting Luminus apps check out the luminus docs. However I designed this to be hosted on Heroku.

xyloobservations can store it's images either in an S3 bucket or on the filesystem. If you want to use s3 you will need to specify the aws credentials and bucket-name.

For using s3, dev-config.edn will look something like this:

 :url-prefix "https://bucketname.s3.eu-west-2.amazonaws.com/"

 :aws-access-key ""
 :aws-secret-key ""
 :aws-region "eu-west-2"
 :bucket-name ""

If configuring with environment variables the settings are upper-case and use under-scores. Setting the variables for Heroku looks something like:

heroku config:set IMAGE_STORE=s3
heroku config:set URL_PREFIX=https://bucketname.s3.eu-west-2.amazonaws.com/
heroku config:set AWS_ACCESS_KEY=
heroku config:set AWS_SECRET_KEY=
heroku config:set AWS_REGION=eu-west-2
heroku config:set BUCKET_NAME=
heroku config:set CLOUDAMQP_APIKEY=
heroku config:set CLOUDAMQP_URL=

Also note for Heroku you need:

If you find your dyno is running out of memory when uploading images, this can limit imagemagick's memory usage:

heroku config:set MAGICK_AREA_LIMIT=30MB


Copyright © 2022 Joseph Graham

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.