Skip to content

Setting Up MathSpring

Nishank Jain edited this page May 15, 2019 · 1 revision

(Written by Neeraj Menon)

Required Software

Install all of these first:

  1. Apache Tomcat; 7 or later should be fine. Remember where you install this. This will run the webserver for you.

  2. MySQL; You probably want MySQL workbench as well, which some installations of this will add automatically. If you already have a favorite application for connecting to and working with databases, then you can use that instead of Workbench.

  3. Java SE Development Kit (JDK). You may have this already.

  4. Eclipse. this is the developing environment that will make configuring and running Mathspring the easiest. You should be able to use the latest version, which you can get for free. Since this newer version is compatible on a AWS service, its best to download the AWS plugins available for eclipse to make build /deployment on AWS easier.

  5. A GitHub account.

Configuring Mathspring

  1. Configure a connection to the Mathspring database. Get login credentials from Neeraj Menon. This will be helpful for troubleshooting the local test database you set up next.

  2. Get a copy of the database-- ask Neeraj Menon for the link to this. Make sure you have MySQL running (on Windows this can be done by starting the service manually or with MySQL notifier). Import the database into your local server (there are some troubleshooting steps for this below).

  3. Use git to checkout from this repository, [https://github.com/nsmenon/mathspring-V2]. You could use any inbuilt git plugin Egit or Command Line to do this.

  4. Update context.xml with the correct passwords for the databases.

Troubleshooting the configuration

You can run into a lot of issues during configuration, hopefully these fixes can iron it out for you.

  • It is best to run the database import through MySQL Workbench.
  • If the import fails due to ROW_FORMAT, you may need to manually edit the database import file-- any InnoDB tables with ROW_FORMAT = FIXED need to be changed to ROW_FORMAT = COMPACT.
  • You may be missing some database tables, which you'll have to manually copy over. In MySQL Workbench you can copy create statements for the tables and paste them into the statement field for your local copy, and then copy the row data and paste that.
  • Sometimes, mismatch of lowercase and uppercase in the query and table definitions may cause spurious table does not exist errors. To resolve this issue, drop the database, edit /etc/mysql/my.cnf and add lower_case_table_names = 1 under the [mysqld] section. Follow this with a reimport of the database dump.
  • Some packages may be set to Java 1.5. You can fix this in IntelliJ's main settings, Compiler > Java Compiler, and removing the custom settings for each of the packages.

Working with GitHub

When changing code, some of the configuration files in Eclipse will get changed, but these changes should NOT be committed to GitHub. In general, anything in the .settings folder should not be committed. When you are ready to commit, don't just commit all changes; review the files changed and make sure you understand the significance of those changes, and whether they should actually be committed to the repository or are just a hack on your end (for example, a print statement used for debugging or a modification to show just options your interested in somewhere in the UI). This will also help you make atomic commits.

If seeing these files in the changed files list bothers you, you hide them by using git update-index --assume-unchanged <file> in the git shell. However, this has the drawback that if someone does accidentally commit them, when pulling their commits you will need to manually save another copy, use git update-index --no-assume-unchanged <file>, pull the commit, then --assume-unchanged again, and finally copy your local version back over it. You can check which files are assume-unchanged by using git ls-files -v | grep '^h'

Clone this wiki locally