Last updated: November 1st, 2020 (by Julian)
This repo is home to the server-side code for Blueprint's Mee Panyar Project. For the client-side analgous to this repo, follow this link.
- Make a copy of the
.env.example
file and rename the copy to be.env
. - Fill out the
.env
file with the relevant information. Some are already filled out for you.- You can find the Mee Panyar airtable base ID at: https://airtable.com/api if you have access to the base.
- You can generate an Airtable API key on the accounts page of airtable https://airtable.com/account
- The environment variable
SERVER_URL
is used to run scripts in thescript/
folder. Point it at the backend instance (default tolocalhost:4000
on development andhttps://meepanyar-node.herokuapp.com
in production). - You will now need to paste your Azure credentials into
.env
. Please look at the wiki page labelled Setting up Azure Storage to get the environment variable values forAZURE_STORAGE_CONNECTION_STRING
andAZURE_STORAGE_ACCOUNT_NAME
- Paste your
AZURE_STORAGE_CONNECTION_STRING
into.env
. This will enable photos. Your backend cannot start without a value in this string. You can get this value by going to the "Access Keys" section of your Azure Storage Account. Copy and paste theConnection String
from there. - Paste your Azure Storage Account Name into
.env
environment variableAZURE_STORAGE_ACCOUNT_NAME
. Make sure to have followed the "Setting up Azure Storage" documentation so that photos are properly persisted
- Paste your
- You do not need to touch any fields already filled out in
.env.example
- Generate public and private RSA keys and place them in the config folder.
- Starting in the
meepanyar-node
folder, - run
cd config
- Generate a private key into a file
jwt.key
by runningopenssl genrsa -out jwt.key 2048
- Generate the corresponding public key into a file
jwt.key.pub
by runningopenssl rsa -in jwt.key -outform PEM -pubout -out jwt.key.pub
- Starting in the
- Run
npm install
to install all the necessary packages (bazel, airlock, etc...)
To run this repo locally, make sure to first follow the steps in local setup. After, you can start the server (defaulted to run on localhost:4000) by running npm start
while in the root directory meepanyar-node
.
Your terminal should respond with: info: 🚀 Airlock mounted and running on port 4000
- Airlock is set to run on
localhost:4000
by default. You can specify another port for Airlock to run on by specifying aPORT
variable in.env
(example:PORT=5000
) - Airlock is set to accept the origin
localhost:3000
which is the default port that the react development server runs on. If you are sending requests to airlock from a different port (which can happen if you are using production builds that run onlocalhost:5000
), you may add origins to theallowedOrigins
to whitelist them.