Photon - Rails3 Photo Gallery
Ruby JavaScript CoffeeScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Photon is a rails app to publish a blog and photo gallery

Blog part is simple, gallery part permit to have collection of albums.


  • EXIF parsing
  • MAP for GPS position of pictures
  • Tag support for blog and images
  • Perhaps a Flickr import task

Deploying your own Photon instance

Assumming you:

  • will use a dedicated user with RVM
  • will use unicorn and nginx
  • will use it under

Prepare the user:

useradd -m -s /bin/bash
su -
# install RVM
curl -L | bash -s stable
rvm install ruby-1.9.3
rvm use --default ruby-1.9.3
echo "export RAILS_ENV=production" >> ~/.bash_profile

Clone photon:

git clone git://

Setup photon:

cd photon
bundle install
cp config/database.yml.sample config/database.yml
# Edit config/database.yml as you wishes, it use by default an MySQL or sqlite3 database
rake db:create db:migrate
# Seeds the database
rake db:seed
# Precompile assets
rake assets:precompile
# Create temp dirs, or unicorn can't start (no pids, logs, sessions, sockets dirs by default)
rake tmp:create

Setup unicorn:

cd ~
cp photon/vendor/unicorn.rb unicorn.rb
vim unicorn.rb
# here you need to change config at the top to match your app user (here

Exit from the user '', and do the rest as 'root' or privileged user

Setup nginx:

cp /home/ /etc/nginx/conf.d/
vim /etc/nginx/conf.d/
# Edit to match your needs

Setup init script:

cp /home/ /etc/init.d/
vim /etc/init.d/
# Edit top script and variables to match your needs
chmod +x /etc/init.d/
chkconfig --add && chkconfig on # on redhat/centos to add at runlevel

User right fix:

# You will probably need this
chmod o+x /home/
chown -R :nginx /home/ # or www-data
# Basically all you need is that 'www-data' or 'nginx' user or group can traverse the home directory
# and pick stuff in the 'public' app folder.
# And also edit your /etc/nginx/nginx.conf config file to use
user nginx nginx;
# or www-data www-data;, else nginx will run uder user www-data or nginx and group nobody, and cannot pick static files or unicorn socket.


Updating is easy, assuming you have a setup like the deploying section you have to do:

Stop unicorn:

/etc/init.d/ stop

Update app:

su -
cd photon
git pull
bundle install
rake db:migrate
rake assets:clean assets:precompile

Start unicorn:

/etc/init.d/ start

Flickr Import

There is a basic things to import all your Collections and Sets from Flickr to Photon, to use it start to get an API key from Flickr then edit 'flickr.rb' and add API key and API secret in it then run it.

Access the URL and paste the token to the terminal, you will get a personnal Token and Secret, you need to put the four things (API key, API secret, personnal key, personnal secret) in 'lib/tasks/flickr_import.rake' and then run:

rake flickr:clean # will entirely drop all collections, albums and existing images
rake flickr:import # will import stuff

Not managed:

  • Tags
  • Favorites
  • Crashs


Contact me using Github or use the following addresse:

  • rhaamo .at. leloop .dot. org


MIT License, see LICENSE file.