Skip to content
New issue

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

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

Already on GitHub? # to your account

Jetty can't parse starting port #20

Open
chumaltd opened this issue Apr 24, 2020 · 2 comments
Open

Jetty can't parse starting port #20

chumaltd opened this issue Apr 24, 2020 · 2 comments

Comments

@chumaltd
Copy link

chumaltd commented Apr 24, 2020

Hi, I got errors at startup as follows:

Exception in thread "main" java.lang.NumberFormatException: For input string: "tcp://10.27.241.91:80"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at java.lang.Integer.parseInt(Integer.java:615)
	at JettyLauncher.getPort(JettyLauncher.java:165)
	at JettyLauncher.main(JettyLauncher.java:74)

I took gitbucket/gitbucket:4 image, running on Google Kubernetes Engine.

https://hub.docker.com/layers/gitbucket/gitbucket/4/images/sha256-65254a12c188aa9067ddab7ecba6eacb149fc4e15a12295200761295a8e4ac86?context=explore

So, I filled with "--port=8080" command line option, and it works.
I don't know what is suitable for default option, but some environment may need default port settings.

@eudika
Copy link

eudika commented Jun 7, 2024

I encountered the same issue while configuring my GitBucket instance on Kubernetes and was able to identify the cause. This issue is neither a problem with the Docker image nor GitBucket itself.

  • In my scenario, I had defined a Service resource named gitbucket to expose the port to the cluster.
  • Kubernetes automatically defines XXX_PORT variables for each Service, where XXX is the name of the Service. (c.f. here)
  • As a result, GITBUCKET_PORT was defined, and its value was not a single integer (e.g. tcp://10.27.241.91:80), leading to the Exception.

Apart from your approach, all of the following modifications in Kubernetes work:

  1. Rename the gitbucket Service (if you have one).
  2. Explicitly define the GITBUCKET_PORT variable to overwrite the generated one.
  3. Set pod.spec.enableServiceLinks to false to prevent the variable from being generated.

@chumaltd
Copy link
Author

chumaltd commented Jun 10, 2024

I think setting GITBUCKET_PORT env explicitly is a handy way.
For k8s users, a partial example looks like:

kind: StatefulSet
spec:
  template:
    spec:
      containers:
      - name: gitbucket
        env:
        - name: GITBUCKET_PORT
          value: 8080

Other env listed in Basic configurations should also work.
k8s users are growing, so the official docker doc is nice to have a starter description.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

2 participants