lnguyenfx / c964-dashboard

My dashboard implementation for Task 2, Part C of WGU's C964 Capstone project.

Home Page:https://c964-dashboard.herokuapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C954 Dashboard

This is a Flask React project for an interactive dashboard of an Ecuadorian grocery chain, as part of the requirement of WGU's C954 capstone project requirement. Follow the steps below to get the project running on your macine.

Getting started

  1. Clone this repository (only this branch)

    git clone https://github.com/lnguyenfx/c964-dashboard
  2. Install dependencies

    pipenv install --dev -r dev-requirements.txt && pipenv install -r requirements.txt
  3. Create a .env file based on the example with proper settings for your development environment

  4. Get into your pipenv and run your flask app

    pipenv shell
    flask run
  5. Run the following command from the project root to add a user to the local sqlite database.

    pipenv run python -m app.scripts.cli add_user --username=<username> --email=<email> --password=<password>
  6. To run the React App in development, checkout the README inside the react-app directory.


IMPORTANT! If you add any python dependencies to your pipfiles, you'll need to regenerate your requirements.txt before deployment. You can do this by running:

pipenv lock -r > requirements.txt

ALSO IMPORTANT! psycopg2-binary MUST remain a dev dependency because you can't install it on apline-linux. There is a layer in the Dockerfile that will install psycopg2 (not binary) for us.


Deploy to Heroku

  1. Before you deploy, don't forget to run the following command in order to ensure that your production environment has all of your up-to-date dependencies. You only have to run this command when you have installed new Python packages since your last deployment, but if you aren't sure, it won't hurt to run it again.

    pipenv lock -r > requirements.txt
  2. Create a new project on Heroku

  3. Under Resources click "Find more add-ons" and add the add on called "Heroku Postgres"

  4. Install the Heroku CLI

  5. Run

    heroku login
  6. Login to the heroku container registry

    heroku container:login
  7. Update the REACT_APP_BASE_URL variable in the Dockerfile. This should be the full URL of your Heroku app: i.e. "https://flask-react-aa.herokuapp.com"

  8. Push your docker container to heroku from the root directory of your project. (If you are using an M1 mac, follow these steps below instead, then continue on to step 9.) This will build the Dockerfile and push the image to your heroku container registry.

    heroku container:push web -a {NAME_OF_HEROKU_APP}
  9. Release your docker container to heroku

    heroku container:release web -a {NAME_OF_HEROKU_APP}
  10. Under Settings find "Config Vars" and add any additional/secret .env variables.

For M1 Mac users

(Replaces Step 8)

  1. Build image with linux platform for heroku servers. Replace {NAME_OF_HEROKU_APP} with your own tag:

    docker buildx build --platform linux/amd64 -t {NAME_OF_HEROKU_APP} .
    
  2. Tag your app with the url for your apps registry. Make sure to use the name of your Heroku app in the url and tag name:

    docker tag {NAME_OF_HEROKU_APP} registry.heroku.com/{NAME_OF_HEROKU_APP}/web
    
  3. Use docker to push the image to the Heroku container registry:

    docker push registry.heroku.com/{NAME_OF_HEROKU_APP}/web
    

About

My dashboard implementation for Task 2, Part C of WGU's C964 Capstone project.

https://c964-dashboard.herokuapp.com


Languages

Language:TypeScript 59.5%Language:Python 35.9%Language:HTML 2.0%Language:Dockerfile 1.2%Language:JavaScript 1.0%Language:CSS 0.3%Language:Shell 0.3%