You will need to:
- Install git, a distributed version control system. Read the Github Git Guides to learn how to use git.
- Install Ruby, a programming language. You can use MRI Ruby 1.8.7, or Phusion REE (Ruby Enterprise Edition). Your operating system may already have it installed or offer it as a pre-built package.
- Install RubyGems 1.3.x or newer, a tool for managing software packages for Ruby.
- Install SQLite3, a database engine. Your operating system may already have it installed or offer it as a pre-built package.
- Install Bundler, a Ruby dependency management tool. You should run
gem install bundler
as root or an administrator after installing Ruby and RubyGems. - Checkout the source code. Run
git clone git://github.com/activate/ActivateHub.git
, which will create anActivateHub
directory with the source code. Go into this directory and run the remaining commands from there. - Install nokogiri dependencies: sudo apt-get install libxslt-dev libxml2-dev
- Install pg dependencies: sudo apt-get install libpq-dev
- Install sqlite gem dependencies: sudo apt-get install libpq-dev
- Install Bundler-managed gems, the actual libraries that this application uses, like Ruby on Rails. You should run
bundle
, which may take a long time to complete. - Optionally specify the theme to use, see the Customizing section for details.
- Optionally setup API keys for external services so that maps will be displayed, see the API Keys section for details.
- Start the search service if needed, see the Search engine section for details.
To run ActivateHub in development
mode, which automatically reloads code as you change it:
- Follow the Setup instructions above.
- Initialize your database, run
bundle exec rake db:migrate db:test:prepare
- Start the Ruby on Rails web application by running
rails server
(UNIX) orruby script/rails /server
(Windows). - Open a web browser to http://localhost:3000/ to use the development server
- Read the Rails Guides to learn how to develop a Ruby on Rails application.
- When done, stop the Ruby on Rails server (e.g.
rails server
) by pressingCTRL-C
.
Windows is not exactly a supported development environment. However, if you got an error running "bundle" involving bluecloth, you may be able to past it by running the following commands (per this StackOverflow answer). These apply a patch to the Bluecloth source and rebuild it.
gem install bluecloth -v '2.2.0'
- (This will fail!)
pushd C:\Ruby193\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0
git clone https://gist.github.com/1539611.git
git apply .\1539611\gistfile1.diff --ignore-space-change
rake gem
- Run any commands "rake gem" tells you to.
mkdir ~/tmp
cp pkg\bluecloth-2.2.0.gem ~/tmp
popd
pushd ~/tmp
gem install bluecloth-2.2.0.gem --platform=ruby
popd
To run ActivateHub in production
mode, which runs more quickly, but doesn't reload code:
-
Follow the Setup instructions above. Don't forget to do things like create the theme and secrets files.
-
Setup a firewall to protect ports used by your search engine, see the Search engine section for details.
-
Initialize your database, run
bundle exec rake RAILS_ENV=production db:migrate
-
Run
bundle exec rake clear
to clear your cache after updating your application's code. -
Setup a production web server using Phusion Passenger, Thin, Unicorn, Rainbows, etc. These will be able to serve more users more quickly than using the built-in server (e.g.
rails server
). -
Run the following commands to compile core and theme-based assets into the public/ directory:
bundle exec rake assets:precompile
First-time database setup run:
rake db:setup
If database has existing data run:
rake db:reset
If you want to customize your ActivateHub, do NOT just start modifying files in app
, public
and themes/default
. Please read the instructions in themes/README.txt
for how to use the theming system.
This application runs with insecure settings by default to make it easy to get started. These default settings include publicly-known cryptography keys that can allow attackers to gain admin privileges to your application. You should create a config/secrets.yml
file with your secret settings if you intend to run this application on a server that can be accessed by untrusted users, read the config/secrets.yml.sample file for details.
A default set of blacklist words is provided in config/blacklist.txt. You can create your own by adding a config/blacklist-local.txt file with one regular expression per line (see config/blacklist.txt for examples).
The application uses a number of API keys to communicate with external services.
-
Yahoo! Upcoming: To import events from Upcoming, the application can use a public key, but for production use, you should really get and use your own API key. See the
config/secrets.yml.sample
file'supcoming_api_key
section for details. -
Google Maps: To use Google's geocoder, and to use Google to display maps, you must get an API key. See
config/secrets.yml.sample
for details.
Calagator can use a number of map tile providers when displaying maps. This can be configured in config/secrets.yml
.
You can specify the search engine to use in your config/secrets.yml
file:
Default search engine which uses SQL queries. Requires no additional setup, dependencies or service. Does not provide relevance-based sorting. Provides substring matches.
Optional search engine that uses the Sunspot gem. Requires additional setup, dependencies and service. Provides relevance-based sorting. Does not provide substring matches.
To use, you will need to install Java 1.6.x, a programming language used to run the search service.
You can start the Solr search service a command like:
bundle exec rake RAILS_ENV=production sunspot:solr:start
You will then need to initially populate your records by running commands like:
bundle exec rake RAILS_ENV=production sunspot:reindex:calagator
You can stop the Solr search service a command like:
bundle exec rake RAILS_ENV=production sunspot:solr:stop
You should setup a firewall to protect the ports that the Solr search service runs on. These ports are described in the config/sunspot.yml
file.
Is there something wrong, unclear or outdated in this documentation? Please get in touch so we can make it better. If you can contribute improved text, we'd really appreciate it.
Error message: when running bundle exec rake db:migrate db:test:prepare: undefined method timezone' for #<Site:0x00000005a39300>/var/lib/gems/1.9.1/gems/activemodel-3.2.16/lib/active_model/attribute_methods.rb:407:in
method_missing'