We have a script to automate the process of setting up your developmental environment. Right now, it supports Debian-based systems(Debian, Ubuntu etc.), Fedora and MacOS.
Warning: If you run this python script on Windows system, it will run a still in Development script, which is not tested fully and might not work properly.
Note: We have a batch file for Windows which is still a Work-in-progress. If you are windows user, We would love your contribution in testing and developing the script for Windows platform. You can find the batch file under setup directory.
There are some basic requirements for the script to work:
- git (to clone the repository)
- python 3.5 or newer
- ruby 2.7.1
- apt (debian) or homebrew (MacOS)
- Clone the repository
- From the repository directory, run
python3 setup.py- The python file checks for your operating system and runs the corresponding system dependent script
- The script will ask for your root password and MySQL passwords.
- While installing MySQL, the MySQL installer might ask you to setup the root password
- In case of MacOS systems, the MySQL root password will be blank if the installer doesn't ask you to setup one.
- Wait for the installation to complete
- If you face any errors, you can find the log for the script in setup directory by the name of log.txt
In case of any errors please post your error logs on: WikiEducationFoundation#1709. You can also contact us on slack for any further queries.
- If you want to setup your own manual Database config(Advanced users)
- First, create your manual config file,
config/database.ymlfrom the sample file provided,config/database.example.yml - Run the script
- Run Migrations if needed.
- First, create your manual config file,
- If you face issues related to MySQL default password on your system
- Please confirm your Password for MySQL
- Delete
config/Database.yml - Run the script again.
- If you face the error that
Sorry! Your operating is not supported by this script- You can try running the system dependent scripts from setup directory, according to your system
- You can try manual installation
- If you're running Windows and experience
RUNAS ERROR- Try running a command prompt session as administrator (via right click), and run the batch script in that window i.e.,
win-setup.bat
- Try running a command prompt session as administrator (via right click), and run the batch script in that window i.e.,
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.
- Fork and clone our repo from https://github.com/WikiEducationFoundation/WikiEduDashboard.
- Install gems: run
bundle install - Copy
config/application.example.ymltoconfig/application.yml - Copy
config/database.example.ymltoconfig/database.yml - Now login into your database
- Either create a new user using
CREATE USER 'wiki'@'localhost' IDENTIFIED BY 'wikiedu' - or update
database.ymlwith valid credentials to connect to the database
- Either create a new user using
- Create a new database named as
dashboardusing the commandCREATE DATABASE dashboard. - Run
rake db:migrateto migrate all database tables. - Install yarn
- Run
yarnto download the required javascript packages - Building assets:
yarn startto built the development versionyarn buildto generate the production version
- Finally, start rails with
guardorrails sand open http://localhost:3000 in a web browser. - Now, you're up and running!!
-
Pre-requisites for setup on OSX (Mac)
- You will need to have xcode installed in order to have
giton your machine. If you rungitand 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 our repo from https://github.com/WikiEducationFoundation/WikiEduDashboard..
-
In the console, download a copy of your forked repo with
git clone https://github.com/your_username/WikiEduDashboard.gitwhereyour_usernameis your GitHub username. -
Enter the new WikiEduDashboard directory with
cd WikiEduDashboard. -
On OSX/Debian, make sure you are in the "sudo" group.
-
Install Ruby 2.7.1 (RVM is documented here; rbenv also works fine.)
- OSX/Debian:
- From the WikiEduDashboard directory, run the curl script from rvm.io
- Use rvm:
rvm install 2.7.1followed byrvm use 2.7.1 - or use rbenv:
rbenv install 2.7.1followed byrbenv local 2.7.1
- Windows:
- Use RailsInstaller
- Install Ruby DevKit
- OSX/Debian:
-
Install Node:
- Debian:
sudo apt install nodejs - 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 node modules via Yarn:
- $
yarn
- $
-
Install PhantomJS:
- $
sudo yarn global add phantomjs-prebuilt
- $
-
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:
- Either save
application.example.ymlanddatabase.example.ymlasapplication.ymlanddatabase.yml, respectively, in theconfigdirectory. The default settings indatabase.ymlwill suffice for a development environment. - Or you can copy
config/application.example.ymltoconfig/application.ymlby running the commandcp config/application.example.yml config/application.yml - and copy
config/database.example.ymltoconfig/database.ymlby running the commandcp config/database.example.yml config/database.yml
- Either save
-
Create mysql development and test database:
- Install mariadb-server (or mysql-server)
- Debian:
sudo apt-get install -y mariadb-server - OSX:
brew install mariadb - Windows: Install XAMPP
- Debian:
- Start a mysql command line:
- Debian:
sudo mysql - OSX:
brew services start mariadbthensudo mysql(If you receive the error message:Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)You may have a permissions issue. Try executing:sudo chown -R _mysql:mysql /usr/local/var/mysqlbefore restarting database server and logging in) - 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 mariadb-server (or mysql-server)
-
Install Redis:
- Debian:
sudo apt install redis-server - OSX:
brew install redis - Windows: Download the Windows port by the Microsoft Open Tech Group
- Debian:
-
(Optional) Set up a
post-mergehook to update all dependencies ifpackage.jsonorGemfilechanges.- Copy
.git-hooks/pull-update-depsto.git/hooks/post-merge
- Copy
- Migrate the development and test databases
- $
rake db:migrate - $
rake db:migrate RAILS_ENV=test
Set up OAuth integration (optional — skip unless you are working on WikiEdits features)
Running these tasks will take several minutes, and should populate your database with a few example events with editing activity.
- Create courses with users
- $
rake dev:populate- To populate your course with data, check Populating a course with data.
- Import revision and upload data
- $
rake batch:update_constantly - $
rake batch:update_daily
-
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-serverOR, 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
-
-
Compile assets
-
The
yarn startcommand 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. Usingyarn buildinstead will generate the minified production version of assets.$
yarn start
-
-
The frontend is now visible at http://localhost:3000/
-
Sign in and visit http://localhost:3000/campaigns to create a campaign.
-
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)