Image gallery in yesod
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.
Handler
Migrations added migration script Dec 3, 2016
Settings changed modes Oct 3, 2015
app changed modes Oct 3, 2015
config search is working again! Oct 20, 2017
deploy changed modes Oct 3, 2015
messages changed modes Oct 3, 2015
src removing unneccessary logs from purescript code Dec 19, 2016
static better tagging Oct 22, 2017
templates stretch links to item frame in admin interface Nov 1, 2017
tests changed modes Oct 3, 2015
.gitignore first drafts Nov 27, 2016
Application.hs search is working again! Oct 20, 2017
ChangeLog.md adding changelog Jul 25, 2017
Foundation.hs modernize to yesod-core >= 1.6 Mar 20, 2018
Helper.hs pdf support implemented Oct 31, 2017
Import.hs fixing licences to actual datatypes Aug 6, 2017
LICENSE Create LICENSE Nov 20, 2017
Licence.hs fixing licences to actual datatypes Aug 6, 2017
Makefile slowly working its way forward Nov 30, 2016
Model.hs switcheroo Mar 19, 2018
README.md dependency update Mar 18, 2018
Scale.hs fixing scaling issues with #46 Mar 24, 2017
Settings.hs making things work Sep 9, 2016
bower.json first drafts Nov 27, 2016
devel.hs changed modes Oct 3, 2015
eidolon.cabal modernize to yesod-core >= 1.6 Mar 20, 2018

README.md

eidolon

Introduction

A image gallery service written in Haskell as a yesod webapp.

Visit the test instance at eidolon.nek0.eu

Installation

Dependencies

Build dependencies

A working Haskell capable environment. For that you will need ghc and cabal-install, which you can install with:

sudo apt-get install ghc cabal-install

Now you can set up your cabal with cabal update and follow its instructions. With this you will have also installed the latest GHC Haskell compiler on your system.

Additionally to Haskell and its dependencies you will need the following software and libraries:

  • alex
  • happy
  • unzip
  • libpq-dev
  • postgresql
  • libfftw3-dev
  • npm
  • nodejs-legacy
  • libpoppler-glib-dev
  • libcairo2-dev
  • libgtk2.0-dev
  • libmagic-dev

Which can be installed through

sudo apt-get install alex happy unzip libpq-dev postgresql npm nodejs-legacy libpoppler-glib-dev libcairo2-dev libgtk2.0-dev libfftw3-dev libmagic-dev

Additionally you need bower, purescript and pulp:

npm install -g bower
npm install -g purescript
npm install -g pulp

For migrations also install:

  • libmagic-dev

Elasticsearch dependencies

WARNING: THIS SECTION IS ONLY VALID FOR VERSIONS >= 0.0.5 and < 0.1.0.0

Since version 0.0.5 there is an Elasticsearch integration for Eidolon. To Be able to run eidolon , you need to install elasticsearch additionally with:

sudo apt-get install elasticsearch

On how to configure your elasticsearch server, look into the elasticsearch documentation.

Building

Get the source with

git clone https://github.com/nek0/eidolon.git

Build your sandbox with

cabal sandbox init

Build the source with

make all

Everything should work automagically from there.

Deploying

First you need to set up your database, which just needs to be created. Additionally you connect to your database (with psql or similar) and activate the pg_trgm extension to the database with

CREATE EXTENSION pg_trgm;

After compiling you will find an executable called eidolon in dist/build/eidolon/eidolon. Copy or link it anywhere you want. The executable needs to be accompanied by the folders config and static and their contents. It's best to copy them to your desired destination.

Also check config/settings.yml and set the values there according to your configuration. The field contactEmail is optional, you can comment it out, but be aware. In certain jurisdictions you are required to give some contact information.

It may also be necessary to create a reverse proxy to your gallery. I would recommend using nginx.

Customizing

Unfortunately the gallery is not highly customizable, but you can change most of its appearance by changing the files static/css/main.css. Especially the default background image can be changed by replacing static/css/img/bg.jpg.

Starting

You can start the gallery now by running the executable. You need to provide a settings file as argument, normally found in config/settings.yml

Since eidolon will block your console, I recommend wrapping a init-script around it. how you can do that is written in my blog.

Migrations

0.0.3-0.0.4

  • do not start or restart your eidolon service before migration
  • run migration script from your run location (where your static folder with all the images is located)
    • if you are building in a sandbox run runghc -package-db/full/path/to/sandbox/XXX-ghc-version-packages.conf.d /path/to/eidolon/Migrations/0.0.3-0.0.4/Migration.hs
      • Note: No space between the option -package-db and its argument
    • without sandbox: runghc /path/to/eidolon/Migrations/0.0.3-0.0.4/Migration.hs
  • start or restart your eidolon service

0.0.4-0.0.5

  • run migration script from your run location (where your static folder with all the images is located)
    • if you are building in a sandbox run runghc -package-db/full/path/to/sandbox/XXX-ghc-version-packages.conf.d /path/to/eidolon/Migrations/0.0.4-0.0.5/Migration.hs
      • Note: No space between the option -package-db and its argument
    • without sandbox: runghc /path/to/eidolon/Migrations/0.0.4-0.0.5/Migration.hs
  • start or restart your eidolon service

0.0.7-0.1.0.0

You have two options to accomplish the migration:

  1. Build the migration binary with cabal exec -- ghc --make Migrations/0.0.7-0.1.0.0/Migration.hs and run the executable in your run location.
  2. Link the static/data/ folder from your link location in the same location in the project directory and run cabal exec -- runghc Migrations/0.0.7-0.1.0.0/Migration.hs

0.1.2.4-0.1.3.0

  • Stop Eidolon
  • Log into your database and issue this command: ALTER TABLE "comment" DROP COLUMN "author_slug";
  • Start Eidolon

0.1.3.3-0.1.4.0

  • Stop eidolon
  • Compile migration script with cabal exec -- ghc --make Migrations/0.1.3.3-0.1.4.0/Migration.hs
  • Copy or move compiled script to run location and execute
  • Follow the prompts of the script
  • Start eidolon

0.1.4.0-0.1.5.0

  • Stop eidolon
  • Compile migration script with cabal exec -- ghc --make Migrations/0.1.4.0-0.1.5.0/Migration.hs
  • Copy or move compiled script to run location and execute
  • Follow the prompts of the script
  • Start eidolon

0.1.5.6-0.1.6.0

  • Just restart eidolon. It handles the rest automagically.

0.1.6.1-0.1.7.0

  • No database changes. Just restart eidolon.

0.1.7.2-0.1.8.0

  • No database changes, just new dependencies to install.

0.1.8.8-0.1.9.0

  • Run ALTER TABLE "token" DROP COLUMN "user"; and truncate token; from your postgres console.
  • You can drop the table activator from the database. It is no longer needed.

0.1.9.3-0.1.10.0

  • Nothing to do, just internal changes.

0.1.10.0-0.1.11.0

  • Only new dependencies to install. You might also want to check out the new function to repopulate the thumbnail images, if you have some of them corrupted by unhandled EXIF data.

0.1.11.2-0.1.11.3

  • Activate the pg_trgm extension for your database with CREATE EXTENSION pg_trgm;.

Acknowledgements: