Go to file
joshua stein 8a76402c1b Merge pull request #75 from srgpqt/master
replace some raw sql with database-agnostic activerecord queries
2013-12-30 13:47:53 -08:00
app replace some raw sql with database-agnostic activerecord queries 2013-12-30 16:23:59 -05:00
config add a footer link bar, add /privacy and /about 2013-10-18 15:55:20 -05:00
db record and show which comments were posted by e-mail, for no particular reason 2013-12-28 12:00:29 -06:00
extras use activerecord query interface instead of deprecated finder methods 2013-12-25 16:43:50 -05:00
lib back out 9ece666 removing utf8mb4 hacks, no longer needed 2013-05-26 12:32:54 -05:00
log initial work on conversion from php tree 2012-06-16 20:15:46 -05:00
public fixed mixed indent style (should be 2 soft spaces as per project guidelines) 2013-12-23 18:19:47 -05:00
script record and show which comments were posted by e-mail, for no particular reason 2013-12-28 12:00:29 -06:00
spec fixed mixed indent style (should be 2 soft spaces as per project guidelines) 2013-12-23 18:19:47 -05:00
vendor initial work on conversion from php tree 2012-06-16 20:15:46 -05:00
.gitignore add a footer link bar, add /privacy and /about 2013-10-18 15:55:20 -05:00
.rbenv-version production is running ruby 1.9.3-p429 now 2013-05-26 12:38:56 -05:00
.rspec initial work on conversion from php tree 2012-06-16 20:15:46 -05:00
config.ru initial work on conversion from php tree 2012-06-16 20:15:46 -05:00
CONTRIBUTING.md update readme/contributing to explain about non-lobste.rs use 2013-02-24 19:52:09 -06:00
Gemfile rails 3.2.16 and assorted gem updates 2013-12-03 16:14:18 -06:00
Gemfile.lock rails 3.2.16 and assorted gem updates 2013-12-03 16:14:18 -06:00
LICENSE bump copyright to 2013 2013-02-24 19:37:14 -06:00
Rakefile initial work on conversion from php tree 2012-06-16 20:15:46 -05:00
README.md don't hardcode "Lobsters" and "lobste.rs" everywhere, use Rails.application.{name,domain} 2013-06-30 01:50:23 -05:00

###Lobsters Rails Project

This is the source code to the site operating at https://lobste.rs. It is a Rails 3 codebase and uses a SQL (MariaDB in production) backend for the database and Sphinx for the search engine.

While you are free to fork this code and modify it (according to the license) to run your own link aggregation website, this source code repository and bug tracker are only for the site operating at lobste.rs. Please do not use the bug tracker for support related to operating your own site unless you are contributing code that will also benefit lobste.rs.

####Contributing bugfixes and new features

Please see the CONTRIBUTING file.

####Initial setup

  • Install Ruby 1.9.3.

  • Checkout the lobsters git tree from Github

       $ git clone git://github.com/jcs/lobsters.git
       $ cd lobsters
       lobsters$ 
    
  • Run Bundler to install/bundle gems needed by the project:

       lobsters$ bundle
    
  • Create a MySQL (other DBs supported by ActiveRecord may work, only MySQL and MariaDB have been tested) database, username, and password and put them in a config/database.yml file:

        development:
          adapter: mysql2
          encoding: utf8mb4
          reconnect: false
          database: lobsters_dev
          socket: /tmp/mysql.sock
          username: *username*
          password: *password*
    
        test:
          adapter: sqlite3
          database: db/test.sqlite3
          pool: 5
          timeout: 5000
    
  • Load the schema into the new database:

        lobsters$ rake db:schema:load
    
  • Create a config/initializers/secret_token.rb file, using a randomly generated key from the output of rake secret:

        Lobsters::Application.config.secret_token = 'your random secret here'
    
  • (Optional, only needed for the search engine) Install Sphinx. Build Sphinx config and start server:

        lobsters$ rake thinking_sphinx:rebuild
    
  • Define your site's name and default domain, which are used in various places, in a config/initializers/production.rb or similar file:

        class << Rails.application
          def domain
            "example.com"
          end
    
          def name
            "Example News"
          end
        end
    
        Rails.application.routes.default_url_options[:host] = Rails.application.domain
    
  • Create an initial administrator user and at least one tag:

        lobsters$ rails console
        Loading development environment (Rails 3.2.6)
        irb(main):001:0> u = User.new(:username => "test", :email => "test@example.com", :password => "test")
        irb(main):002:0> u.is_admin = true
        irb(main):003:0> u.is_moderator = true
        irb(main):004:0> u.save
    
        irb(main):005:0> t = Tag.new
        irb(main):006:0> t.tag = "test"
        irb(main):007:0> t.save
    
  • Run the Rails server in development mode. You should be able to login to http://localhost:3000 with your new test user:

        lobsters$ rails server