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

Feature: Set port config while creating initial devfile #4448

Closed
ryanj opened this issue Feb 19, 2021 · 15 comments
Closed

Feature: Set port config while creating initial devfile #4448

ryanj opened this issue Feb 19, 2021 · 15 comments
Labels
area/init Issues or PRs related to `odo init` kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/Medium Nice to have issue. Getting it done before priority changes would be great.

Comments

@ryanj
Copy link

ryanj commented Feb 19, 2021

/kind feature

Which functionality do you think we should add?

It would be really nice to have a --port option for odo create that would allow users to modify and/or extend the catalog devfile examples. This currently works for --s2i, but is not yet available for devfiles.

Why is this needed?

The default nodejs devfile example (from the registry catalog) binds to 3000 by default. This works well for the --starter repo, but binding to port 3000 is not used exclusively by all nodejs projects. Users can run odo config set Ports 8080 as a workaround, but this seems to append additional port info instead of replacing the older config.

Here is a clip from my resulting devfile.yaml using odo v2.0.5 (e8030b1):

- container:
    endpoints:
    - name: http-3000
      targetPort: 3000
    - name: port-8080-tcp
      protocol: tcp
      targetPort: 8080

Currently, users who take this approach will end up with two routes after running odo push. Clicking on the "Open URL" decorator in the Topology view fails - unless the user cleans up the invalid port config using oc delete route http-3000-frontend

Ideally, users should be able to set the port config during the initial devfile creation step, via odo create nodejs component_name --port 8080

See the "frontend" component here for an example nodejs app that binds to 8080: https://learn.openshift.com/introduction/developing-with-odo/

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Feb 19, 2021
@dharmit
Copy link
Member

dharmit commented Feb 19, 2021

@girishramnani this is exactly what you were talking about yesterday.

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 20, 2021
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 19, 2021
@dharmit
Copy link
Member

dharmit commented Jun 22, 2021

/remove-lifecycle rotten

@kadel can you PTAL?

@openshift-ci openshift-ci bot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Jun 22, 2021
@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 20, 2021
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 20, 2021
@dharmit
Copy link
Member

dharmit commented Oct 25, 2021

/remove-lifecycle rotten

@kadel can you PTAL?

/remove-lifecycle rotten

@kadel can you please help set priority on this one?

@openshift-ci openshift-ci bot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Oct 25, 2021
@ryanj
Copy link
Author

ryanj commented Aug 15, 2022

Any updates on this? It's needed to support our default nodejs example app

@serenamarie125
Copy link

hey @dharmit @kadel will this work with odo v3?

@ryanj
Copy link
Author

ryanj commented Aug 15, 2022

I've tried using --port 8080, and I've tried the alternative, moving the app to :3000 via --env PORT=3000.

Both options (--port and --env) don't seem to get reflected in the devfile.yaml that is generated. I tried with odo version 2.5.0 and version 3.0.0beta2

Our example app runs on :8080 by default, and can be configured using the PORT env variable: https://github.com/sclorg/nodejs-ex

Let me know if you have any tips on how to set it up using odo and a local copy of the git repo:

  1. git clone https://github.com/sclorg/nodejs-ex
  2. cd nodejs-ex
  3. odo init nodejs frontend --port 8080

Or alternatively...

  1. odo init nodejs frontend --env PORT=3000

I'm able to successfully edit the resulting devfile.yaml to include my PORT=3000 environment setting. But, I'm not able figure out how to add these environment variables (or how to use the --port option) using odo's command line flags.

@dharmit
Copy link
Member

dharmit commented Aug 16, 2022

With odo v3, there's yet no direct way of passing a flag to odo init command to get this done, but you could do it via interactive mode.

In the directory where your code resides, run odo init (make sure there's no devfile.yaml file in this directory) without any arguments. odo will ask you a bunch of questions. First, it will ask you if the language/framework it detected based on the code in your pwd is correct. If not, you can interactively change the framework.

Next, it will let you modify env vars for the "runtime" container. By default, port for this is 3000. You should delete the port and add 8080. All of this through interactive mode.

@ryanj ryanj changed the title Feature: Set port config while creating initial devfile odo create nodejs component --port 8080 Feature: Set port config while creating initial devfile odo init nodejs --port 8080 Aug 17, 2022
@ryanj ryanj changed the title Feature: Set port config while creating initial devfile odo init nodejs --port 8080 Feature: Set port config while creating initial devfile odo init nodejs frontend --port 8080 Aug 17, 2022
@ryanj
Copy link
Author

ryanj commented Aug 17, 2022

Thanks @dharmit, @serenamarie125

This works for me in interactive mode with v3.0.0beta2

Looking forward to a non-interactive way to generate a devfile as well - which might also resolve #4435

@rm3l rm3l added this to odo Project Oct 3, 2022
@rm3l rm3l moved this to To Do 📝 in odo Project Oct 3, 2022
@rm3l rm3l removed the status in odo Project Oct 3, 2022
@kadel kadel added the priority/Medium Nice to have issue. Getting it done before priority changes would be great. label Feb 8, 2023
@kadel
Copy link
Member

kadel commented Feb 8, 2023

more info how to approach this is in #6211 (comment)

@kadel kadel added the area/init Issues or PRs related to `odo init` label Feb 8, 2023
@rm3l rm3l changed the title Feature: Set port config while creating initial devfile odo init nodejs frontend --port 8080 Feature: Set port config while creating initial devfile: odo init nodejs frontend --port 8080 Jun 22, 2023
@rm3l rm3l changed the title Feature: Set port config while creating initial devfile: odo init nodejs frontend --port 8080 Feature: Set port config while creating initial devfile: odo init --port 8080 Jun 22, 2023
@rm3l rm3l changed the title Feature: Set port config while creating initial devfile: odo init --port 8080 Feature: Set port config while creating initial devfile Jun 22, 2023
Copy link
Contributor

github-actions bot commented Nov 1, 2023

A friendly reminder that this issue had no activity for 90 days. Stale issues will be closed after an additional 30 days of inactivity.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 1, 2023
Copy link
Contributor

github-actions bot commented Dec 2, 2023

This issue was closed because it has been inactive for 30 days since being marked as stale.

@github-actions github-actions bot added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Dec 2, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2023
@github-project-automation github-project-automation bot moved this to Done ✅ in odo Project Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/init Issues or PRs related to `odo init` kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/Medium Nice to have issue. Getting it done before priority changes would be great.
Projects
Archived in project
Development

No branches or pull requests

6 participants