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

From Hapi.js to Elixir/Phoenix #104

Closed
4 of 5 tasks
SimonLab opened this issue Feb 28, 2022 · 8 comments
Closed
4 of 5 tasks

From Hapi.js to Elixir/Phoenix #104

SimonLab opened this issue Feb 28, 2022 · 8 comments
Assignees
Labels
epic A feature idea that is large enough to require a sprint (5 days) or more and has smaller sub-issues.

Comments

@SimonLab
Copy link
Member

SimonLab commented Feb 28, 2022

As mention in #94 we want to move the project to Elixir/Phoenix to make it easier to maintain and fix bugs.

The following branch already contains the initial work to create a new Phoenix application

  • Update gitignore to make sure to remove the deps folder.

  • I don't think this project will use any of the emails, dashboard, liveview, gettext or ecto features. We could create the new Phoenix application with the following flags: `mix phx.new labels --no-mailer --no-ecto --no-dashboard --no-live --no-gettext
    see:
    image
    However this step is not required and we might end up using at least the database later on: Update labels to the latest Heroku stack by 1 November 2020 #94 (comment)

  • Once the Phoenix project is initialized we can deploy it to Fly.io and use continuous deployment to add features.

  • Add Github authentication using the Auth app:
    image
    We want to make sure that only Github authentication is used as we need the Github token for API requests.

  • Use elixir-auth-github for authentication

@SimonLab SimonLab added the epic A feature idea that is large enough to require a sprint (5 days) or more and has smaller sub-issues. label Feb 28, 2022
@SimonLab
Copy link
Member Author

SimonLab commented Feb 28, 2022

I've also just noticed the Phoenix application has been created with the name app:

app: :app,

We can make it more specific and rename (or recreate the project) with the name labels.
The easier way to do this is do delete the files (except the hapi app folder) and recreate the Phoenix application with mix phx.new . --app labels

@SimonLab
Copy link
Member Author

Trying to deploy the new Phoenix labels app on Fly.io by following https://fly.io/docs/getting-started/elixir/
fly launch:
image

I'm not sure which organization to select (or if we need to create a new one), I'll need to read a bit more about Fly organization first

@nelsonic
Copy link
Member

@SimonLab good point on only needing GitHub Auth for this App. 👍
We either need the means to select which OAuth providers to use for a given app in the Auth UI or we just use https://github.com/dwyl/elixir-auth-github directly in the labels App. one is obviously considerably more work than the other. 💭

@SimonLab
Copy link
Member Author

SimonLab commented Mar 1, 2022

First "dummy" version deployed on Fly.io: https://labels.fly.dev/

  • flyctl launch
  • I've added the appication to the existing Hits organization. First I've created a new org "labels" however this ask for payment card and thought it would add more running cost
Would you like to setup a Postgresql database now? Yes
For pricing information visit: https://fly.io/docs/about/pricing/#postgresql-clusters
Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk

@nelsonic feel free to remove the app or the postgres as I'm not sure if there will be more cost added by the labels app.

? Would you like to deploy now? Yes
Deploying labels
  • flyctl status: Hostname = labels.fly.dev
  • flyctl open:
    image

I'm now reading the continuous deployment documentation: https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

@SimonLab
Copy link
Member Author

SimonLab commented Mar 1, 2022

Continuous deployment done with the following commit: b6814dc
This create a "Fly Deploy" Github action which deploys the application on every push to the repository. We'll change this action to make sure to only deploy when a PR is merge to main similar to the Hits action: https://github.com/dwyl/hits/blob/main/.github/workflows/ci.yml

@SimonLab
Copy link
Member Author

SimonLab commented Jul 4, 2022

I'm adding elixir-auth-github as we only want Github for authentication and we can manage the scope to use when using the user token with the Github API to create the labels (see #104 (comment))

I'm currently creating an authentication module Plug to manage login/logout, see https://hexdocs.pm/phoenix/plug.html#module-plugs

@SimonLab SimonLab self-assigned this Jul 5, 2022
@SimonLab SimonLab added the awaiting-review An issue or pull request that needs to be reviewed label Jul 5, 2022
@SimonLab
Copy link
Member Author

SimonLab commented Jul 7, 2022

The Phoenix application is now deployed at https://labels.fly.dev/

@SimonLab SimonLab closed this as completed Jul 7, 2022
@SimonLab SimonLab removed the awaiting-review An issue or pull request that needs to be reviewed label Jul 7, 2022
@nelsonic
Copy link
Member

nelsonic commented Jul 7, 2022

Great work @SimonLab 🚀 Thank you! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic A feature idea that is large enough to require a sprint (5 days) or more and has smaller sub-issues.
Projects
None yet
Development

No branches or pull requests

2 participants