Configuring development environment - Gibbo3771/slave-free-chocolate GitHub Wiki

Rails

I recommend using rbenv to manage Ruby versions. The application uses ruby 2.6.1. One you have cloned the repo to your machine, go to the root directory and run in your terminal:

rbenv install 2.6.1 && rbenv local 2.6.1
gem install bundler
bundle install

React Frotnend

Go to the client directory and run npm install to install the React dependencies.

Run the migrations

All you have to do now is run the migrations. In your terminal run rails db:setup. The dataset runs purely off seed files, so expect this to take a fair amount of time if you happen to arrive later in the apps life.

Run and make sure it works

You can now go back to the root of the application and run the following command in your terminal to spin everything up rake start:development. This will run the React front end on port 3000 and the Rails API on port 3001.

Seed some data

You can run rails db:seed to inject some develop/testing data into the database.

Rails Admin

The applications is using Rails Admin as a CMS and is currently the easiest way in adding and verifying the behaviour/structure of data. You can login to it by going to /admin and use the following credentials:

  • username: admin
  • password: password

At the moment, the login is handled by HTTPBasic Auth. If you're feeling up to changing this, it would be nice to have proper JWT authentication and a nice login page for admins. This will allow trusted contributors work on the live database without shared credentials.