This repository is the backend for my final project for NU CS 4550 Web Development. It is a JSON API built primarily using Ruby, Sinatra, Active Record, and Unicorn.
The frontend for this project is also hosted on GitHub.
To develop for this application, one needs to have git, Ruby 2.2.2, MySQL >= 5.6.4 installed on their system first. With these tools installed, run:
$ mysql.server start
$ gem install bundler
$ git clone https://github.com/nahiluhmot/tabular-backend.git ~/tabular-backend/
$ cd ~/tabular-frontend/
$ bundle install
$ bundle exec rake db:create db:migrate
$ bundle exec rakeThis should (successfully) run all of the automated tests. To start the web server, run:
$ bundle exec rake webThis repository is equipped to build docker image using its Dockerfile.
On a machine where docker is installed, you can build the image using the following command:
$ cd ~/tabular-backend/
$ docker build -t tabular-backend:latest .`This will produce an image whose default command is to run unicorn with the application code. This image expects that secret environment variables will be set which allow it to talk to the production database. See `config/database.yml to see which environment variables need to be set.
To run the production server, you can run:
$ docker run \
--name tabular-backend \
--detach \
tabular-backend:latest| Directory | Checked In? | Description |
|---|---|---|
app/ |
Yes | Main application code |
config/ |
Yes | Application configuration |
coverage/ |
No | Directory generated by tests which holds HTML files that display the application test coverage (> 99%!) |
spec/ |
Yes | Application tests |
tasks/ |
Yes | Application tasks |
config.ru |
Yes | Startup script for the web server |
Dockerfile |
Yes | docker configuration |
Gemfile |
Yes | Dependency constraints |
Gemfile.lock |
Yes | Dependency actual versions |
Rakefile |
Yes | Loads the rake tasks |
README.md |
Yes | Documentation |
unicorn.rb |
Yes | unicorn configuration |