Setting up developer environment

From MMS Wiki
Revision as of 12:03, 24 September 2018 by Velochy (talk | contribs) (Android Dev)
Jump to: navigation, search

Install packages:

All sorts of warnings are normal in the steps below. Especially during npm and pip package installation and when running db:sync

sudo apt-get update
sudo apt-get install -y git-core python2.7-dev curl libfontconfig1-dev libc6 libgc-dev ocaml make xdg-utils libpq-dev \
  postgresql-client libav-tools python-pip fluidsynth graphicsmagick sox libsox-fmt-mp3 s3cmd nodejs npm libjpeg-dev redis-tools

Install core NPM packages

sudo npm install -g bower grunt-cli cordova protractor

Install HaXe


haxelib setup
haxelib install lime
haxelib run lime setup
# ln -s hxMath.h hxMath.h.h # In the right directory

Docker setup

sudo apt-get install -y
sudo groupadd docker # May already exist
sudo usermod -aG docker USERNAME
# log out and in again

Download Docker files

docker pull redis
docker pull postgres

One last bit of configuration

echo "" | sudo tee --append /etc/hosts

Internal setup

Setup: Clone repo:

git clone https://[USERNAME]
cd MMS
# clone mms-haxe into MMS/haxe/
git clone https://[USERNAME] haxe

Install pip packages

sudo pip install -r matchmysound/requirements.txt

Install bower packages

cd matchmysound
bower install

Install node (build) packages

cd ../grunt
npm install

Set up DB (need to have ./ start db running in other terminal)

cd ..
./ target matchmysound
# ./ start db # in another terminal or with &
./ db:create
./ db:sync

Start up the environment (separate windows)

./ start db redis api celery
./ start client

If client isn't acting up, then `python start` should be sufficient!

A useful thing to do is to make MMS/tmp/web folder into a ramfs disk. ~128m should suffice. /etc/fstab line for that is:

 ramfs       /home/<USERNAME>/MMS/tmp/web ramfs   nodev,nosuid,noexec,nodiratime,size=128M   0 0

If you see ENOSPC error, it is a problem with too many inotify watches. Solution:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

if you see sslwrap error, it is a gevent thing. 1.0.2 fixes it for Python 2.7.9 but if you have 2.7.8 that has the bug backported into it, just go to /usr/local/lib/python2.7/dist-packages/gevent/ and change PYGTE279 to True.

E2E Tests

Install Selenium browser drivers

sudo webdriver-manager update 

If it still complains about not finding them, you need to set the local npm to use the global protractor

 cd grunt/node_modules; rm -rf protractor; ln -s /usr/local/lib/node_modules/protractor protractor


Needed to get exercise creation working. Firstly:

 git clone

Then do "Install dependencies" and "Compiling the code" at:

For Mac (OSX): (loosely based on

Download Qt installer and use it to install Qt 5.4 (anything later won't work). Then:

brew install libogg libsndfile libvorbis pkg-config portaudio jack lame cmake git
cd MuseScore
make -f Makefile.osx clean
make -f Makefile.osx
make -f Makefile.osx install

then copy mscore from MuseScore/applebuild directory to "Applications" (as you normally install stuff on OSX) And then create a symlink so it could be used from commandline with:

ln -s /Applications/ /usr/local/bin/mscore

Editor (sublime)

Under Project - edit project, set

   "settings": {
       "expand_tabs_on_save": true,
       "trim_trailing_white_space_on_save": true


  • Index project using search in ctrl-shift-p
  • goto definition using ctrl+win+alt+l
  • jump to definition win+ctrl+l

Set user configuration to ignore temporary dirs - Preferences - Package Settings - AngularJS - Settings - User


Install Anaconda for python linting, goodies

Set user configuration in Anaconda to set max length a bit higher (note that you should still strive for 80)

   "pep8_max_line_length": 100

Set Anaconda User Key bindings

   {"command": "anaconda_goto", "keys": ["super+ctrl+alt+l"]},
   {"command": "anaconda_find_usages", "keys": ["super+alt+d"]},
   {"command": "anaconda_doc", "keys": ["alt+d"]},
   {"command": "anaconda_auto_format", "keys": ["super+a"]},
   {"command": "anaconda_goto", "keys": ["g", "d"],
           { "key": "selector", "operator": "equal", "operand": "source.python" },
           { "key": "setting.command_mode", "operand": true },
           { "key": "setting.is_widget", "operand": false }


  • goto definition using ctrl+win+alt+l
  • show docstring alt+d
  • find usages of function win+alt+d
  • autoformat file win+r (this cleans up a lot of the formatting-related pep8 warnings, good when refactoring and cleaning old code)

Mac (incomplete)

  • Install XCode

- Not command line tools. If you installed those, uninstall them and xcode-select -s the Xcode app

brew install graphicsmagick postgresql libsass openssl redis libav

  • Install a few extra brew packages that require special flags.
 brew install sox --with-libvorbis
 brew install fluid-synth --with-libsndfile
 brew install python --with-brewed-openssl
  • Install pip

easy_install pip celery

  • Install latest Java JDK to get java command
  • Do steps NPM, Haxelib, Docker files from the main guide
  • Continue to "Internal Setup"

- pip should be done not with sudo, but with --user flag instead, if problems occur

haxelib 3,2,81 version needs to have a symlink like "latest" as cordova plugin xml parser has a bug which dies on commas in path name. Also, XCode project needs "Build settings" -> "Other linker flags" -> '-stdlib=libc++' for compile to work.

You may also occasionally need to do

export IPHONE_VER=10.0

Windows 10 (WSL)

First, follow this guide to set up WSL. Restart.

Then follow with the standard linux installation (but make sure to put it somewhere in /mnt/)

Docker needs to be set up both inside WSL and in windows proper. Standard docker install requires pro version for Hyper V support. To get around this, install "Docker toolbox" instead Then do

 docker-machine env

in PowerShell, and copy those lines over to the end of your .bashrc (changing path to /mnt/c/User/.... from C:\User\...)

While there, also add the line (required for pip binaries):

 export PATH=$PATH:~/.local/bin

Now we also need to add the following to current_project.json:


If Bower gives you trouble,

 chown [username] -r ~/.config

Node also needs

 sudo apt-get install nodejs-legacy

If node-sass is acting up, do

 npm rebuild node-sass

Hosts file for windows is at C:\Windows\System32\Drivers\etc\hosts . To edit it, right-click notepad and choose "Run as Administrator" NB! Hosts file for linux (/etc/hosts) needs the same update too!

Android Dev

HaXe needs to be at least 3.3.0. You need to install gradle with apt-get You also need Android studio (which in turn requires JDK 1.8). Once that is installed, navigate to "Configuration" -> "SDK manager" -> "SDK Tools" and install:

NDK SDK ver 22 SDK build tools ver 22 SDK and Build Tools of <newest>

Also, add this to your .bashrc

 export ANDROID_HOME=/home/velochy/Android/Sdk
 export PATH=$PATH:/home/velochy/Android/Sdk/tools