A tool to reveal the individual and team contributions that employees have made to its projects.
You will need our master key to work with the application. More details can be found on our Encrypted Credentials wiki page.
Here's how to get your master key setup:
- To maintain security around this key, it will be shared via the Keybase app
- Ping our Slack
#oddball-tools
room, and request for someone to send you the key via Keybase - Create a file
config/master.key
file in your local Magnifier repo (this file is already part of our.gitignore
file) - Add the
master
key to the file
Run bin/setup
to install dependencies, copy git hooks and bootstrap local development db.
At its core, Magnifier is comprised of a Rails backend, and a React frontend. Here are the associated dependencies you'll need:
Once you've ensured that you have all of the above installed, here are the steps to getting the app up and running locally:
Clone the repo and cd
into the magnifier
directory
You will need our master key to run the app. See the Master Key section for more details.
yarn install
bin/setup
rails s
Visit http://localhost:3000/
RAILS_MASTER_KEY=$(cat config/master.key) docker-compose build
RAILS_MASTER_KEY=$(cat config/master.key) docker-compose run web rake db:create
RAILS_MASTER_KEY=$(cat config/master.key) docker-compose run web rake db:schema:load
RAILS_MASTER_KEY=$(cat config/master.key) docker-compose up
In a terminal in the same directory
RAILS_MASTER_KEY=$(cat config/master.key) docker-compose exec web guard
React-rails is configured, without react router currently
All components are visible in app/javascript/components
I've followed the paradigm introduced by Dan Abramov back in 2015 around smart and dumb components. Further reading on this topic is available here
- To generate a react component *
rails g react:component $COMPONENT_NAME
Currently there is no connection from React to Rails, in a seperate PR, once the graphql stuff is implemented we can connect the apollo-provider to our graphql endpoint.
Currently using regular old css, but I brought in Tail Wind CSS to make things a little easier
All routes are listed in app/javascript/routes.js
. We are currently use react-router@v4
be aware the API has changed significantly since 3.0, reading their quick start guide (available_here) will be immensely helpful.
There is a great example on how to do client side auth routing that we should bring in: https://reacttraining.com/react-router/web/example/auth-workflow
Prettier is currently configured with eslint, please google "Eslint format on save + your specific text editor" in order to take advantage of this
There are currently two scripts that can be ran
npm run eslint:fix
automatically reformats all js filesnpm run eslint
- for use on CI, lints all files and shows results
Magnifier uses RSpec for its backend test suite.
$ rspec
Magnifier uses the Guard::RSpec gem to automatically run your specs. To use it run:
$ bundle exec guard
Application can currently be built and run with docker.
To run the docker container locally, you'll need to inject the
RAILS_MASTER_KEY
via the environment. After ensuring the key is present in
your current session with env | grep RAILS_MASTER_KEY
, you can build the
container with:
docker build -t magnifier:latest --build-arg RAILS_MASTER_KEY=$RAILS_MASTER_KEY .
The first time building will take a few minutes, based on your internet speed.
After the container has been built, run it locally with:
docker run -p 3000:3000 -e DATABASE_URL=postgresql://[email protected]/github-magnifier_development magnifier
For the following commands, first use docker ps
to list the active containers and get the name of the container
Run a bash console
docker exec -it <container name> /bin/bash
- to get bash shell
Run a rails console
docker exec -it <container name> bundle exec rails c
Currently we are using rails to serve the static assets, long term this will probably need to change and switch to using nginx or something similar