Money Bee Backend

Backend API for a fintech money management application.

The frontend can be found at: https://github.com/sreilly64/js-moneymanagement-frontend

Running locally

  1. Clone project and navigate to root directory where the project was cloned.
mkdir /Users/$(your_username)/Dev/
cd /Users/$(your-username)/Dev/
git clone https://github.com/sreilly64/js-moneymanagement-backend.git
cd js-moneymanagement-backend
  1. Ensure Postgres database is running.
psql
# CREATE DATABABASE jsmoney
  1. Build and test.
./mvnw clean package
  1. Run project locally.
export DB_URL=jdbc:postgresql://localhost:5432/jsmoney
export DB_UN=postgres
export DB_PW=password
./mvnw spring-boot:run -Dspring-boot.run.jvmArguments="-Dspring.profiles.active=cloud"

Deployment

Pre-Deployment

  1. Create heroku account
  2. Download heroku cli and follow instructions on the page.
  3. Create database service.
  4. Connect to DB from local client (optional).

Create heroku app

User the cli to create your cloud application

cd ~/js-moneymanagement-backend
$ heroku create

Add a cloud database

Create a PostgreSQL database

heroku addons:create heroku-postgresql

Login to https://data.heroku.com/ to view your cloud database. From there, select your database, navigate to the "Settings" tab and acquire your database credentials: connection URL, username, and password.

Connect to DB from local client.

Use the credentials from the "Add a cloud database" section, to create a database connection using your favorite client.

Deployment

  1. Login to heroku cli
$ heroku login
  1. From the project's root directory, issue the command to push the applications.
$ git push heroku master
  1. Set environment variables.

Set environment variables using the following format:
cf set-env APP_NAME ENV_VAR_NAME ENV_VAR_VALUE

heroku config:set DB_UN=<actual_user_name>
heroku config:set DB_PW=<actual_password>
heroku config:set DB_URL=<actual_url>
  1. Start application.
web npm start

Maintenance / management

Heroku CLI usage

Docs

Troubleshooting

  • Tail logs
heroku logs -t
  • Validate app status
heroku apps:info
  • ssh into container
heroku run bash -a <APPNAME>