CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 11
Set up Feedback messages for Rabbit and Slack #104
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SLACK_API_TOKEN=REPLACE | ||
SLACK_SLASH_COMMAND_TOKEN=REPLACE | ||
RABBITMQ_HOST=REPLACE | ||
RABBITMQ_PORT=REPLACE | ||
RABBITMQ_USER=REPLACE | ||
RABBITMQ_PASSWORD=REPLACE | ||
|
||
DB_USER=REPLACE | ||
DB_PASSWORD=REPLACE | ||
DB_NAME=REPLACE | ||
DB_HOST=REPLACE |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,20 +24,31 @@ Install Elixir, see [installation](https://elixir-lang.org/install.html). | |
brew install elixir | ||
``` | ||
|
||
Install dependencies. | ||
Note: if you are using a `.env` file, you will probably want to prepend `dotenv` to each of the `mix` commands below. | ||
|
||
``` | ||
Install dependencies: | ||
|
||
``` | ||
mix deps.get | ||
``` | ||
|
||
Currently you need a VPN connection to the Artsy production environment to get a feed of notifications. | ||
|
||
Run server. | ||
Create and migrate your database: | ||
|
||
``` | ||
iex -S mix | ||
mix ecto.create | ||
mix ecto.migrate | ||
``` | ||
|
||
Start the app: | ||
|
||
```sh | ||
mix run --no-halt | ||
# or, if you want to enable pry debugging | ||
iex -S mix run --no-halt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thaaaaanks! 🙌 |
||
``` | ||
|
||
Currently you need to VPN to an Artsy environment to get a feed of notifications. | ||
|
||
You can `curl -v localhost:4000/slack -X POST` and get back something. | ||
|
||
## Create a Topic Branch | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
defmodule Aprb.Views.FeedbacksSlackView do | ||
|
||
def render(event) do | ||
%{ | ||
text: "#{event["subject"]["display"]} #{event["verb"]} #{event["properties"]["message"]} from #{event["properties"]["url"]}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you try this new view? We read There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh good to know. We couldn't figure out getting local APRb to talk to staging Rabbit, so maybe we can try now that all the PRs have been merged to staging. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Careful connecting a local consumer to staging RabbitMQ, as I think there have been problems disconnecting these later on when a real staging consumer wants to step in. @ashkan18 did I remember this correctly? What's the recommended practice around different environments and their bindings? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, basically there are two things we need to do when connecting locally to staging RabbitMQ, we need to first change the queue name locally to something like `"ashkan_local_aprb_#{topic}_queue" here so we don't consume staging events. This then will create a new queue in RabbitMQ staging, the issue is it won't delete the queue once we stop the connection, so we need to manually go to dashboard and delete the queue. I think there are few options we can use to delete the queue if nothing is connected but that may not make sense for staging/production cases. |
||
} | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
defmodule Aprb.Repo.Migrations.AddFeedbacksTable do | ||
use Ecto.Migration | ||
|
||
alias Aprb.{Repo,Topic} | ||
|
||
def change do | ||
changeset = Topic.changeset(%Topic{}, %{name: "feedbacks"}) | ||
Repo.insert!(changeset) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!