-
Notifications
You must be signed in to change notification settings - Fork 1
Get app running locally
Note: These are not instructions for a production deploy and don't account for building releases or anything similar, just the minimum steps to get the app running for QA in dev mode locally.
To get the app running for testing:
- Clone the repo. Run
mix deps.get
from the root of the repo to fetch dependencies. - Set some ENV Vars. Sample (replace with your DB and API URL:
export DATABASE_URL_DEV=postgresql://postgres:postgres@localhost:5432/alert_concierge_dev
export API_URL="https://dev.api.mbtace.com/"
export GUARDIAN_AUTH_KEY=abc123
Set your AWS keys (for email/sms) in prod.secret.exs, using prod.secret.exs.example as a reference.
-
Also, navigate into
apps/concierge_site/mail_inlining
and runyarn install
-
Run
elixir touch_templates.exs
from the root directory -
Make sure that your node version is on
v7.10.1
and runyarn install
inside the directoryapps/concierge_site/assets
-
Seed some subscriptions by changing
priv/repo/seeds.exs
and runningmix run priv/repo/seeds/exs
. A sample script create a user, subscriptions, and informed entities for those subscriptions:
alias MbtaServer.{Repo, User}
alias MbtaServer.AlertProcessor.Model.{InformedEntity, Subscription}
user = %User{
email: "bfauble@intrepid.io",
role: "user"
}
{:ok, user} = Repo.insert(user)
subscription_1 = Subscription.create_changeset(%Subscription{}, %{
user_id: user.id,
alert_priority_type: :low,
relevant_days: [:weekday],
start_time: ~T[04:00:00],
end_time: ~T[12:00:00]
})
subscription_2 = Subscription.create_changeset(%Subscription{}, %{
user_id: user.id,
alert_priority_type: :medium,
relevant_days: [:weekday, :sunday],
start_time: ~T[12:00:00],
end_time: ~T[20:00:00]
})
subscription_3 = Subscription.create_changeset(%Subscription{}, %{
user_id: user.id,
alert_priority_type: :high,
relevant_days: [:weekday, :saturday],
start_time: ~T[20:00:00],
end_time: ~T[03:59:59]
})
{:ok, sub_1} = Repo.insert(subscription_1)
{:ok, sub_2} = Repo.insert(subscription_2)
{:ok, sub_3} = Repo.insert(subscription_3)
sixteen_bus = %InformedEntity{
route: "16",
route_type: 3,
subscription_id: sub_1.id
}
fitchburg_line = %InformedEntity{
route: "CR-Fitchburg",
route_type: 2,
subscription_id: sub_2.id
}
concord = %InformedEntity{
trip: "CR-Weekday-Fall-16-414",
stop: "Concord",
route_type: 2,
route: "CR-Fitchburg",
subscription_id: sub_2.id
}
south_acton = %InformedEntity{
trip: "CR-Weekday-Fall-16-414",
stop: "South Acton",
route_type: 2,
route: "CR-Fitchburg",
subscription_id: sub_2.id
}
red_line = %InformedEntity{
route_type: 1,
route: "Red",
subscription_id: sub_3.id
}
davis = %InformedEntity{
route_type: 1,
route: "Red",
stop: "place-davis",
subscription_id: sub_3.id
}
harvard = %InformedEntity{
route_type: 1,
route: "Red",
stop: "place-harsq",
subscription_id: sub_3.id
}
Repo.insert(sixteen_bus)
Repo.insert(fitchburg_line)
Repo.insert(concord)
Repo.insert(south_acton)
Repo.insert(red_line)
Repo.insert(davis)
Repo.insert(harvard)
-
Create, Migrate, Seed DB:
mix ecto.setup
-
Start the app with
mix phx.server
. This will start up the alert parser and should begin processing alerts against the seeded subscriptions