Skip to content

GamePalsDoinCode/scrumsistant

Repository files navigation

Build Status Coverage Status

scrumsistant

Assistant for Scrum Stuff

Frontend

The frontend uses typescript and angular. See here for instructions on how to get started and here for how to run the code after.

Backend

The backend uses python and redis. See here for instructions on how to get started and here for how to run the code after.

Getting Started

First Time Running Code

Using Docker

  • If you can install docker and docker compose (and make I guess) then you can simply make run! After setting up the local settings. Then to add a user run sudo docker-compose exec flask bash - this will drop you into a place you can run scripts

Frontend

  • NPM
    • Make sure you have node.js and npm installed
  • Angular CLI
  • Frontend Package Dependencies
    • Run npm ci to install any libraries we need. You will need to do this again whenever new dependencies are added. Here's why we use this instead of npm install.
  • TSLint
    • Run npm install tslint typescript -g to install tslint
  • Prettier

Backend

  • Python Virtual Environment
    • Danny:
      • virtualenv. It has a list of wrappers for itself at the bottom, w/e works for you
      • [in home dir] virtualenv scrumenv -p python3.8 [assumes python3.8 is installed and on PATH]
      • source scrumenv/bin/activate [on windows there should be an activate.bat somewhere approximately there that you have to run]
      • protip - my alias is scrum='source /home/danny/scrum/bin/activate && cd /home/danny/scrumsistant'
    • Mike:
  • Backend Python Package Dependencies
    • After setting up and activating your virtual environment, install all of the python libraries we need using pip install -r requirements.txt in the backend dir. You will need to do this again whenever new dependencies are added.
    • We use pip-tools to freeze our requirements (don't worry, it's included in the requirements). So any time you need to add a new requirement, please add it to the requirements.in file, then run pip-compile requirements.in (or pip-compile.exe requirements.in for the Windows heathens) to produce a requirements.txt file with the properly frozen further level requirements.
  • Code Formatting Enforcement
  • Redis
    • Install redis and, if you're feeling fancy, make it a "proper service".
      • Windows note: I executed the installation commands from the first link in WSL, but now I can only run redis in Ubuntu. This is fine for me but perhaps you would like to find a better solution. Please do!
    • Start the redis server locally
  • Postgres And Migrations
    • Figure out how to install postgres on your system
    • Make a db and configure the postgres related local settings as shown below
    • From backend run alembic upgrade head - this will run the existing migrations
    • To make a new migration, make changes to the db_schema.py file and run alembic revision --autogenerate -m 'message about the change'. Then examine the generated file (the command will print out where it is), and if good, commit it. Be sure to then run the upgrade command to apply it!
  • Local Settings
    • Create a backend/local_settings.py file, and populate it like so:
    import os
    SERVER_NAME = 'me'
    
    REDIS_HOST = os.environ.get('REDIS_URL', 'localhost')
    REDIS_PASSWORD = ''
    REDIS_PORT = 6379
    REDIS_DB = 0
    REDIS_CONNECTION_URL = f'redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}/{REDIS_DB}'
    
    POSTGRES_HOST = os.environ.get('POSTGRES_HOST', 'localhost')
    POSTGRES_PASSWORD = os.environ.get('POSTGRES_PASSWORD', [INSERT YOUR PASSWORD FOR A LOCAL POSTGRES HERE, OR JUST USE '' IF ONLY RUNNING IN DOCKER])
    POSTGRES_USER = os.environ.get('POSTGRES_USER', [INSERT YOUR USER FOR A LOCAL POSTGRES HERE, OR JUST USE '' IF ONLY RUNNING IN DOCKER])
    POSTGRES_URL = f'postgres://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_HOST}:5432/scrumsistant'
    
    
    
    FLASK_SECRET_KEY = '' # GENERATE A SECRET KEY
    • Generate a secret key like so and then put it in your local_settings.py file
  • Make A User
    • The code requires you have a user before logging in. In the scripts directory run python create_user.py {email} {password}, which will make a user record in your local redis db.

Each Time You Run Code

Backend

  • Redis (port 6379)
    • Run redis-cli to make sure redis is running locally
  • Websocket Server (port 8000)
    • In root, python runserver.py
  • Flask Server (port 5000)
    • In backend, ./run_flask.sh

Frontend

  • Angular Server (port 4200)
    • In frontend, ng serve

Now you should be able to go to http://localhost:4200/ and login with the user you created earlier.

Coding Standards

Formatting

Frontend

We are using tslint to lint our code. Install it as per the instructions above, and then run tslint --project /path/to/project --config /path/to/project/tslint.json in the frontend directory to run the linter and show you any errors that need to be fixed. If you are using VS Code, consider installing the extension.

Backend

We are formatting our backend code according to the standards imposed by the fascist maintaining black. We are also using the isort library. You can easily set up your IDE to auto-run these tools whenever you save, which I suggest (and can help with).

Enforced formatting via pre-commit hooks

We are also using a cool python library called pre-commit that will generate the file .git/hooks/pre-commit in your project to automatically do this formatting for you whenever you commit code.

Please set this up prior to contributing on the backend by installing pre-commit (it's in the requirements.txt so should happen when running pip install -r requirements.txt) and then running pre-commit install, which will actually make the hook file (based on the rules we set up for it in .pre-commit-config.yaml).

Now, whenever you commit, if your code doesn't adhere to the standards you'll get a scary message like black..........fail and then a message that black reformatted your code. Don't be too scared, just configure your IDE to auto-run them ahead of time if you don't want to be called a failure every time you make commits.

About

Assistant for Scrum Stuff

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •