1. Get set up with Heroku

  2. Set up redis as a daemonized process redis-server --daemonize yes

  3. Make a local database named vha_dev with your username, which should be the same as your default system user name as given by whoami. On windows you'll need to do this another way.

    createdb -h localhost -U `whoami` -w vha_dev
    
  4. Test your database connection in Postico. Your username will be different

    Untitled

  5. Create an .env file and .env.local file with the following contents. Go to https://dashboard.heroku.com/apps/virtual-hospitals-africa/settings and copy environment variables from there

    SELF_URL=https://localhost:8000
    DATABASE_URL=postgres://willweiss@localhost:5432/vha_dev
                          # ^ replace with your actual database username
    
    # You'll need these from the live project
    GOOGLE_CLIENT_ID=$COPIED_FROM_HEROKU
    GOOGLE_CLIENT_SECRET=$COPIED_FROM_HEROKU
    GOOGLE_MAPS_API_KEY=$COPIED_FROM_HEROKU
    
    WHATSAPP_BEARER_TOKEN=$COPIED_FROM_HEROKU
    WHATSAPP_FROM_PHONE_NUMBER=$COPIED_FROM_HEROKU
    WHATSAPP_WEBHOOK_VERIFY_TOKEN=$COPIED_FROM_HEROKU
    
  6. Migrate the database now that you have .env set to point to local.

    $ deno task local db:reset
    
    migration "20230101120000_updated_at.ts" was executed successfully
    migration "20230101130000_postgis.ts" was executed successfully
    migration "20230101144040_facilities.ts" was executed successfully
    migration "20230126000000_patients.ts" was executed successfully
    migration "20230127024002_whatsapp_conversation.ts" was executed successfully
    migration "20230127203321_health_workers.ts" was executed successfully
    migration "20230127203322_appointments.ts" was executed successfully
    migration "20230316155657_health_worker_google_tokens.ts" was executed successfully
    migration "20230622135716_employment.ts" was executed successfully
    migration "20230629120430_add_media.ts" was executed successfully
    migration "20230629185250_patient_nearest_facilities_view.ts" was executed successfully
    
  7. Run the app locally

    $ deno task start
    
  8. See that upon logging in at https://localhost:8000 there’s a record of you in your local database

    Untitled