Skip to content

heroku-examples/tdx-advanced-functions

Repository files navigation

Route Planner with Charging Stations

Architecture

architecture

Apex Utility Classes

apex-utility-classes

Salesforce Schema

salesforce-schema

Deployment Instructions

  1. Create a Scratch Org
sfdx force:org:create -s -f config/project-scratch-def.json -a routeplannerdemo
  1. Push Source to Org
sfdx force:source:push -f
  1. Assign Permission Sets
sfdx force:user:permset:assign -n RoutePlanner
sfdx force:user:permset:assign -n Functions
  1. Import Sample Data
sfdx force:data:tree:import -p data/Account-Service__c-plan.json
  1. Create a Compute Environment to Deploy Functions
sf env create compute -o routeplannerdemo -a routeplannerenv
  1. Deploy Functions
sf deploy functions -o routeplannerdemo
  1. Create Heroku Application for Data Resources
heroku create <app-name>
  1. Add Heroku User Collaborator to Functions Account
sf env compute collaborator add --heroku-user username@example.com
  1. Create Postgres and Redis Resources
 heroku addons:create heroku-postgresql:hobby-dev
 heroku addons:create heroku-redis:hobby-dev
  1. Attach Data Resources to Compute Environment
heroku addons:attach <example-postgres-database> --app <example-compute-environment-name>
heroku addons:attach <example-redis-database> --app <example-compute-environment-name>
  1. Deploy MQTT Heroku App

Setup Monorepo and Node.js Buildpacks:

heroku buildpacks:add https://github.com/lstoll/heroku-buildpack-monorepo -a <app-name>
heroku buildpacks:add heroku/nodejs -a <app-name>

Deploy Application using the Monorepo buildpack

heroku config:set APP_BASE=apps/pulsar-mqtt-broker
git push https://git.heroku.com/<heroku-app-name>.git main
  1. Setup MQTT_URL env variable
sf env var set MQTT_URL=wss://<heroku-app-name>.herokuapp.com
  1. Load Charging Stations Dataset
cd scripts
npm install
heroku config --shell -a <app-name> > .env
node create-db.js

About

TDX 22: Advanced Salesforce Functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published