Skip to content

How to Install?

Joel Quiles edited this page May 16, 2017 · 4 revisions

Installation Instructions

Follow the below instructions if you want to install the application in your local machine or any server.

  1. Install the MySQL database: http://dev.mysql.com/doc/refman/5.7/en/installing.html
  2. Create a database and run the command in our migration.sql file to create the required tables: https://github.com/Code-for-Miami/fbi-api/blob/master/etc/migration.sql
  3. Populate the table with some sample data: https://github.com/Code-for-Miami/fbi-api/blob/master/etc/data/data-dump-sample.sql
  4. Install JRE (Java Runtime Environment): http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
  5. Install Leiningen (it's the Clojure dependencies manager): http://leiningen.org/
  6. Clone the repo: git clone https://github.com/Code-for-Miami/restaurant-inspections-api.git
  7. Now you run the following command to go to the repo folder and compile the project: cd restaurant-inspections-api && lein uberjar
  8. Now you just run the application, from the repository root directory, with the following command: PORT=8080 DATABASE_URL="jdbc:mysql://localhost:3306/DATABASE_HERE?user=USER_HERE&password=PASS_HERE" PRODUCTION=X java -jar target/restaurant-inspections-api.jar. If using the default environmental variables, you can start the application by running ./start.sh from the project directory.
  9. Now you can access the address: http://localhost:8080/list-counties and check if you have a list of some counties and related data!

PS: You can find a great tutorial here: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-clojure-web-application-on-ubuntu-14-04 --- it teaches you how to deploy Clojure apps on Ubuntu servers and you can replicate the instructions to deploy our project!

Environment Variables

This is the environment variables used by the application and default value if none is provided:

  • PORT: it's the server port, default value: 8080
  • DATABASE_URL: it's the database JDBC address, default value: jdbc:mysql://localhost:3306/cfm_restaurants?user=root
  • PRODUCTION: if it has any value it means it's not in development mode, so the code will have not dev features like hot reload etc. Default value: N/A.
  • CSV_FILES: it's a list of the Florida Restaurant Inspections CSV files, separated by comma, which are loaded every day by 4 am to update the database data with new inspections. Default value: ftp://dbprftp.state.fl.us/pub/llweb/1fdinspi.csv,ftp://dbprftp.state.fl.us/pub/llweb/2fdinspi.csv,ftp://dbprftp.state.fl.us/pub/llweb/3fdinspi.csv,ftp://dbprftp.state.fl.us/pub/llweb/4fdinspi.csv,ftp://dbprftp.state.fl.us/pub/llweb/5fdinspi.csv,ftp://dbprftp.state.fl.us/pub/llweb/6fdinspi.csv,ftp://dbprftp.state.fl.us/pub/llweb/7fdinspi.csv
Clone this wiki locally