Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[elixir] feat: add admin app #116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[elixir] feat: add admin app #116

wants to merge 1 commit into from

Conversation

grejdi-mbta
Copy link
Collaborator

@grejdi-mbta grejdi-mbta commented Feb 21, 2024

Copy link

Coverage of commit bfc97ab

Summary coverage rate:
  lines......: 93.4% (606 of 649 lines)
  functions..: 75.8% (194 of 256 functions)
  branches...: no data found

Files changed coverage rate: n/a

Download coverage report

@grejdi-mbta
Copy link
Collaborator Author

@paulswartz Would love initial thoughts here.

config :ex_aws,
# note: 'region' doesn't work. it's inherited from the profile
# region: [{:system, "AWS_REGION"}, {:awscli, "default", 30}, :instance_role],
access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, {:awscli, "default", 30}],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't need these now, but will eventually.


config :ex_aws,
# overwrite defaults here, so as to only look at instance role
access_key_id: :instance_role,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For RDS connection.

{Admin.Repo, []},
{Plug.Cowboy,
scheme: :https,
options: [
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: I need to move this to a config so it can be different on prod, but not sure what the best way to go about it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# config/config.exs
config :admin,
  cowboy_options: [ scheme: :https, ... ]

# lib/admin/application.ex
{Plug.Cowboy, Application.get_env(:admin, :cowboy_options)}


@template_dir "lib/admin/templates"

plug(Plug.SSL, rewrite_on: [:x_forwarded_proto, :x_forwarded_host, :x_forwarded_port])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we still accept 'http'?

render(conn, "index.html")
end

get "/admin" do
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like Guardian w/ Keycloak. Any good implemtations to look at? MyCharlie is using it in combination with Phoenix.

@@ -0,0 +1,14 @@
<!DOCTYPE html>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking of using Tailwind and HTMX. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tailwind seems fine. I'd go with LiveView if you're already in the Elixir world, but I haven't heard many bad things about HTMX either.

Copy link
Member

@paulswartz paulswartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused, and unfortunately there isn't much detail in the Asana ticket.

Is this an application that a developer will run on their local machine to control the Data Platform tables? If it's expected to be deployed to AWS, then I wouldn't create a parallel application: instead I'd add Phoenix to the existing application and put a load balancer in front of it to handle HTTPS.

{Admin.Repo, []},
{Plug.Cowboy,
scheme: :https,
options: [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# config/config.exs
config :admin,
  cowboy_options: [ scheme: :https, ... ]

# lib/admin/application.ex
{Plug.Cowboy, Application.get_env(:admin, :cowboy_options)}

@@ -0,0 +1,42 @@
defmodule Admin.Schema.CubicOdsTableSnapshot do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: these are the same tables that are maintained by the main application, correct? If so, having two different applications talking to the same database is definitely an anti-pattern.

@@ -0,0 +1,14 @@
<!DOCTYPE html>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tailwind seems fine. I'd go with LiveView if you're already in the Elixir world, but I haven't heard many bad things about HTMX either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants