$ virtualenv -p python3 venv
$ source venv/bin/activate
$ (venv) pip install -r requirements.txt
In order to set the Github Token API in the environment so that the About page can load, you must obtain a token from Github and set it in your environment.
- Go to https://github.com/settings/tokens
- Click "Generate New Token"
- Give it repo permissions
- Copy the token
$ brew install elasticsearch
$ brew services start elasticsearch
Elasticsearch should be running on http://localhost:9200. You can confirm this works with
$ curl localhost:9200
DATABASE_URL=postgres://localhost/db_name
ELASTICSEARCH_URL=<url>
GITHUB_API_TOKEN=<token>
$ cd backend/
$ export FLASK_APP=run.py
$ flask db_import
$ flask run
You must have a Github API Token in your local environment
$ cd backend/
$ python tests.py
If you want to run the application locally, you need to create the file .env.development.local
in the frontend directory.
This file is already within the gitignore as it should never be version controlled.
The file should contain the entry:
REACT_APP_API_HOST=http://127.0.0.1:5000
In a new terminal window from your running backend app:
$ cd frontend/
$ yarn install
$ yarn build-css
$ yarn start
$ yarn test
Our application uses Docker images to create an easily deployable application. We have packaged the docker commands within our deploy.py
script.
In order to use this script, you must first set the STAGE
environment variable. This can be done at call time.
Builds the base system for our application to run on. NOTE this does not need to be run every time. Unless part of the environment for the app changes, it will only need to be run once
Packages flask and react into an image that extends the base image. The compile time for app is significantly faster than the base image's compile time. Run this action when you are pulling from git to deploy updated frontend/backend
Executes the import_fixture.py
script within the docker image.
NOTE this command must be run after the application has been started
We also utilize Docker-Compose to handle both the database and application running/linking.
Once the deployment has been done, you can start the application with sudo docker-compose up -d
The -d
option detatches the window from the new process
To stop the application, use the command sudo docker-compose down
If building a fresh instance of our application on a DEV server, you would run:
$ STAGE=DEV ./deploy.py base app
$ sudo docker-compose up -d
$ ./deploy.py install-schema
At this point, the application will be running with sample data
If the frontend gets updated or a python route gets changed, we can run a simplified and (much) faster deployment process
$ sudo docker-composer down
$ STAGE=DEV ./deploy.py app
$ sudo docker-composer up -d
DEV
=> http://dev.runescrape.lol
PROD
=> http://runescrape.lol
LOCAL
=> localhost:5000