diff --git a/Dockerfile b/Dockerfile index 1aa7899..8f21ff2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ -FROM java:8-alpine +FROM openjdk:8 MAINTAINER Aaron Fischer -ADD target/uberjar/yenu.jar /yenu/app.jar +ADD yenu.jar /yenu/app.jar EXPOSE 3000 -CMD ["java", "-jar", "/yenu/app.jar"] +WORKDIR "/yenu" +CMD ["java", "-jar", "app.jar"] diff --git a/README b/README new file mode 100644 index 0000000..1a06b30 --- /dev/null +++ b/README @@ -0,0 +1,71 @@ + + + + oooo ooo .ooooo. ooo. .oo. oooo oooo + `88. .8' d88' `88b `888P"Y88b `888 `888 + `88..8' 888ooo888 888 888 888 888 + `888' 888 .o 888 888 888 888 + .8' `Y8bod8P' o888o o888o `V88V"V8P' + .o..P' + `Y8P' the image sharing tool for friends. + + + yenu is a simple tool to share images among a trusted group of people. No + complicated setup, no fancy features nobody really uses, no role management, + no cloud, no bullshit. Just sharing images to people you like and store + your data where you want it to be. + +--{ INSTALL }------------------------------------------------------------------ + Create the database schema and all needed folders. You need to execute + this only once for initial setup. IF you upgrade the yenu version (replace + the yenu.jar file), it is sometimes needed to run the migrate step again. + + $ java -jar yenu.jar migrate + + Start the application with the following command in a screen session or + write a systemd init file for that. + $ java -jar yenu.jar + + If you like docker, you can use docker-compose to boot up the application + and send it to the background. + $ docker-compose up -d + + +--{ CONFIGURATION }------------------------------------------------------------ + The application is configured with the yenu.properties file. Open the file + in your preferred editor and change the variables as you like. You can change + the basepath, port and other stuff like the user password and the creator + password. + + +--{ WHERE IS MY DATA? }-------------------------------------------------------- + All your images are placed in the data/gallery/ directory, next to the + yenu.jar. When uploading a image, the raw file is placed into the raw/ folder, + if you need the original later (pull out some metadata like GPS coordinates, + scale it into other formats, print it etc.) In the normal/ folder there are + the scaled down images for the details page. The thumbnails/ folder contains + the quare images for the thumbnail preview. + + The database used is a SQLite3 database, stored in the yenu.db file. You + can open the database at any time with your favourite sqlite3 client. + + $ sqlite3 yenu.db + > .tables + > SELECT * FROM images; + > ... + + +--{ WHERE CAN IS RUN THIS THING? }--------------------------------------------- + Quick answer: Wherever you want. You can boot up a Amazon S3 node and deploy + it there or you put it on your RaspberryPi and host it yourself from your + own internet connection from home (preferred way!). You can also rent a + vServer and deploy it there. All you need is a Java RE and a internet + connection. + + +--{ LICENSE, RIGHTS AND AUTHOR }----------------------------------------------- + This tool is written by Aaron Fischer (aaron-fischer.net). It is free to use + and is placed under the GPL v.3. The images, comments and other metadata + belongs to you. Make sure, you store the data on a place you trust and make + backups. + diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..5e06fef --- /dev/null +++ b/deploy.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# Compile +lein uberjar + +# Clean +rm -rf dist + +# Package +mkdir dist +cp target/uberjar/yenu.jar dist/ +cp yenu.properties dist/ +cp Dockerfile dist/ +cp docker-compose.yml dist/ +cp README dist/ + +tar czf yenu-release.tar.gz dist/* diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d150baf --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +app: + build: . + command: java -jar /yenu/app.jar + ports: + - "127.0.0.1:80:3000" + volumes: + - ./data:/yenu/data + - ./yenu.properties:/yenu/yenu.properties + - ./yenu.db:/yenu/yenu.db diff --git a/src/clj/yenu/layout.clj b/src/clj/yenu/layout.clj index b8ccf68..0e6c7b3 100644 --- a/src/clj/yenu/layout.clj +++ b/src/clj/yenu/layout.clj @@ -22,10 +22,12 @@ (filter/add-filter! :parse-date #(time/to-time-zone (time-format/parse %) (time/default-time-zone))) (defn footer [] - (let [first-year (subs (:created_at (db/get-first-year)) 0 4) - recent-year (subs (:created_at (db/get-recent-year)) 0 4) - copy (if (= first-year recent-year) first-year (str first-year " - " recent-year))] - (str "© " copy " " (clojure.string/join ", " (:authors env))))) + (if (= (:count (db/get-image-count) 0)) + (clojure.string/join ", " (:authors env)) + (let [first-year (subs (:created_at (db/get-first-year)) 0 4) + recent-year (subs (:created_at (db/get-recent-year)) 0 4) + copy (if (= first-year recent-year) first-year (str first-year " - " recent-year))] + (str "© " copy " " (clojure.string/join ", " (:authors env)))))) (defn render-file [template & [params]] (content-type diff --git a/src/clj/yenu/routes/core.clj b/src/clj/yenu/routes/core.clj index 629fa40..25bb50c 100644 --- a/src/clj/yenu/routes/core.clj +++ b/src/clj/yenu/routes/core.clj @@ -54,7 +54,7 @@ (page (inc current) (= current num) "disabled" (h/html "Weiter " [:span.fa.fa-arrow-right]))]))) (defn index-page [current request] - (let [image-count 25 + (let [image-count (:images_per_page env) offset (* (dec current) image-count) pages (number-of-pages image-count) images (db/get-all-images {:offset offset :count image-count})]