"Give to each individual the power to support companies that share their values"
We are a community of Pandas who want to change the world by helping people judge at a glance wether companies are good or bad according to their own values.
To learn more about Karma Panda please contact one of the contributors.
If you wish to see the current production state of this project, please head to beta.karma-panda.org
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
You should have some things already installed on your machine:
docker-compose
— This will help you automatically setup the needed containers on your machine. Please note that a prerequisite for docker compose is having Docker CE already installednvm
npm
or yarn
— To install all the dependencies of the projectgit
— as the code version systemDuring the rest of the installation instructions we will suppose that you have fullfilled the prerequisites and that you chose to install npm. If you went with npm please replace all later occurences of the command npm
by yarn
.
For instance
npm install
Should be replaced by
yarn install
If you need help with anything, prerequisits install or actual Install, please contact Green Dirt.
To install the development environment on your machine and start running the project locally please start by:
Open a terminal on your machine and cd
to the folder where you want to clone the project. Note that the result of the cloning will be a directory as well with "karma" as the default name:
cd path-to/my-folder-containing-many-projects
From this directory, run the following command:
git clone https://github.com/Green-Dirt/karma
Wait until the cloning is over (this might take some time) and cd
to the cloned directory:
cd karma
From the karma directory, install the dependencies needed for the frontend part of the project (this might take some time as well):
cd frontend/
npm i
Then move to the server directory and install the dependencies needed for the backend part of the project (...aaaaand you guessed it, it might also take some time!):
cd ../server/
npm i
For security reasons, the environment variables are not commited to the github and should be installed individually on each machine. You'll need to create these files and paste inside some dummy variables for the project to work locally.
From the server directory, create a file named .env:
touch .env
Then paste inside the following content:
JWT_APP_SECRET="development-secret"
DATABASE_ENDPOINT="http://localhost:4466"
PRISMA_SCHEMA_FILENAME="prisma"
PRISMA_MANAGEMENT_API_SECRET="development-secret"
MYSQL_ROOT_PASSWORD="prisma"
We have to do the same with the database environment file. cd
to the database directory inside the server directory:
cd database/
From there, create a file named .env:
touch .env
Paste inside the following content:
PRISMA_MANAGEMENT_API_SECRET=development-secret
MYSQL_ROOT_PASSWORD=prisma
Inside the database directory start the docker containers that will host the server and database:
docker-compose up -d
Now got back to the server directory and then start the backend server:
cd ..
npm start
Open a new terminal window and go back to the server directory (if needed):
cd path-to/my-folder-containing-many-projects/karma/server
From there globally install the prisma cli and deploy the prisma service taking into acount the environment variables:
npm install -g prisma
prisma deploy -e .env
Go to the root directory of the frontend directory and start the frontend server:
cd ../frontend/
npm start
At that point, a window from your favorite browser should open at the following URI http://localhost:3000/
greeting you the companies that were seeded: Total, H&M and Mc Donalds.
If that's the case, celebrate, have a coffee and then get back to obviously saving the world!
Explain how to run the automated tests for this system
Explain what these tests test and why
Give an example
Explain what these tests test and why
Give an example
Move to the frontend folder
cd frontend
Add the .env file with production values to the directory. Also add the now.json file. Then build the project
npm run build
Move to the build folder and deploy to now, this will copy an url to your clipboard with the build online.
now
Once you tested the build and you are satisfied with it, alias it to the production url
now alias [build_url] [prod_url]
To update the servers, go to the server folder
cd server
Install the production now.json file. Deploy on now. This will copy a test url to your clipboard.
now
At the url, a graphql playground should appear. To test it and interact with it, you must first add a bearer token to the header. First generate the token by running the following prisma command
prisma token
Head back to the playground and copy the following inside the HTTP HEADERS tab at the bottom of the page
{
"Authorization": "Bearer [generated_token]"
}
You can now test the server. When you are happy with it, alias it to the correct production url
now alias [test_url] [server_production_url]
Move to the server folder
cd server
Provide yourself the .env.prod environment files and paste them inside the folder. Run the following command to update the prisma database.
prisma deploy -e .env.prod
If the docker container requires an update, please refer to the steps described here in this issue https://github.com/prisma/prisma-cloud-feedback/issues/202
For more info on the tech stack, the app/database architecture etc. please check the wiki
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
The workflow used is GitFlow. The different branches and their use is the following:
See also the list of contributors who participated in this project.
This project is licensed under the GNU AGPL v3.0 License - see the LICENSE file for details