Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

128 lines (88 sloc) 3.675 kB

Photon

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

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

TODO:

  • 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 example.com

Prepare the user:

useradd -m -s /bin/bash example.com
su - example.com
# install RVM
curl -L get.rvm.io | 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://github.com/rhaamo/photon.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 example.com)

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

Setup nginx:

cp /home/example.com/photon/vendor/example.com.conf /etc/nginx/conf.d/example.com.conf
vim /etc/nginx/conf.d/example.com.conf
# Edit to match your needs

Setup init script:

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

User right fix:

# You will probably need this
chmod o+x /home/example.com
chown -R :nginx /home/example.com/photon/public # 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

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

Stop unicorn:

/etc/init.d/unicorn_example.com stop

Update app:

su - example.com
cd photon
git pull
bundle install
rake db:migrate
rake assets:clean assets:precompile
exit

Start unicorn:

/etc/init.d/unicorn_example.com 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

Contact me using Github or use the following addresse:

  • rhaamo .at. leloop .dot. org

License

MIT License, see LICENSE file.

Jump to Line
Something went wrong with that request. Please try again.