If you know your way around Rails, here's the very short version. Some additional requirements are necessary to make all the tests pass and all the features work, but this should be enough to stand up the app quickly.
- copy
config/application.example.yml
toconfig/application.yml
- copy
config/database.example.yml
toconfig/database.yml
- create a MySQL database,
dashboard
- install ruby 2.3.1 and nodejs
bundle install
rake db:migrate
rake campaign:add_campaigns
- install bower and yarn
bower install
for some javascript requirementsyarn
for more javascript requirementsgulp
to build assetsguard
orrails s
to start a server- localhost:3000 should load the home page
-
Pre-requisites for setup on OSX (Mac)
- You will need to have xcode installed in order to have
git
on your machine. If you rungit
and it is not there, you will be prompted to install xcode. - To install rvm, you'll first need a gpg utility. You can install the GPG Suite from gpgtools.org
- Homebrew will install itself when you run the rvm install command, if you don't have it already.
- You will need to have xcode installed in order to have
-
Pre-requisites for setup on Windows:
- Install Git from the official Windows package
-
Fork this repo, so that you can make changes and push them freely to GitHub.
-
Clone the new WikiEduDashboard repo and enter that directory.
-
On OSX/Debian, make sure you are in the "sudo" group.
-
Install Ruby 2.3.1 (RVM is recommended)
- OSX/Debian:
- From the WikiEduDashboard directory, run the curl script from rvm.io
rvm install ruby-2.3.1
- Windows:
- Use RailsInstaller
- Install Ruby DevKit
- OSX/Debian:
-
Install Node:
- Debian:
apt install nodejs npm
- OSX:
brew install node
(this assumes you are using homebrew) - Windows: Download the installer
- Debian:
-
Install Gems:
- $
gem install bundler
- $
bundle install
- If some gems fail to install, you may need to install some dependencies, such as:
libmysqlclient-dev libpq-dev libqtwebkit-dev
- $
-
Install NPM modules via Yarn:
- $
sudo npm install yarn -g
- $
yarn
- $
-
Install PhantomJS:
- $
sudo npm install -g phantomjs-prebuilt
- $
-
Install Bower and Bower modules:
- $
sudo npm install bower -g
- $
bower install
- $
-
Install Pandoc
- See the Pandoc installation guide for your environment's specifics.
- Only Pandoc itself is needed; no additional related components (eg, LaTeX) are required.
-
Add config files:
- Save
application.example.yml
anddatabase.example.yml
asapplication.yml
anddatabase.yml
, respectively, in theconfig
directory. The default settings indatabase.yml
will suffice for a development environment.
- Save
-
Create mysql development and test database:
- Install mysql-server
- Debian:
sudo apt-get install mysql-server
- OSX:
brew install mysql
- Windows: Install XAMPP
- Debian:
- Start a mysql command line:
- Debian:
sudo mysql
- OSX:
mysql.server start
thensudo mysql
- Windows:
C:\xampp\mysql\bin\mysql -u root
- Debian:
CREATE DATABASE dashboard DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE dashboard_testing DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
exit
- Install mysql-server
-
Install Redis:
- Debian:
sudo apt-get install redis-server
- OSX:
brew install redis
- Windows: Download the Windows port by the Microsoft Open Tech Group
- Debian:
-
Install Gulp (if not already installed)
sudo npm install -g gulp-cli
-
Install R:
- Debian:
sudo apt install r-base
- Also you can refer to this install R
- Debian:
-
Migrate the development and test databases $
rake db:migrate
$rake db:migrate RAILS_ENV=test
-
Create the campaigns specified in
application.yml
$rake campaign:add_campaigns
Set up OAuth integration (optional — skip unless you are working on WikiEdits features)
-
Start Zeus (optional)
-
Zeus (not available on Windows) is a tool to restart Rails services more quickly after files are changed.
$
zeus start
-
-
Start Redis (if not already running as daemon)
-
Redis is used by Sidekiq. Some features — especially related to making edits on Wikipedia — will not work when Redis is down. On a Linux-based system, it will probably be running as a daemon automatically after installation. On OSX, you may need to start it manually.
$
redis-server
OR, if you used homebrew to install redis:
$
redis-server /usr/local/etc/redis.conf
-
-
Start the server
-
OSX/Debian: Use guard. This tool starts the rails development server (on localhost:3000). It also watches the files, and will automatically restart the server when rails files are changed, and it will automatically run corresponding test files when applicable.
$
guard
-
Windows:
$
rails s
-
-
Start Gulp to compile assets
-
The default gulp command will build the project's javascripts and stylesheets (in lieu of the rails asset pipeline), and watch the assets directory, recompiling after changes to javascript, jsx and stylesheet files. Using
gulp build
instead will generate the minified production version of assets.$
gulp
-
-
The frontend is now visible at http://localhost:3000/
-
To set up test users and data, see User Roles
The living style guide illustrates many of the design building blocks of the dashboard, which you can use for creating new features: http://localhost:3000/styleguide
The Dashboard includes several rake tasks intended to keep the database synced with Wikipedia:
- Initialize:
rake batch:initialize
(Only to be run manually, initializes the database) - Constant update:
rake batch:update_constantly
(Runs every 15 minutes by default) - Daily update:
rake batch:update_daily
(Runs once a day by default)