gitbucket / gitbucket-docker

Docker image of GitBucket which is an open source GitHub server powered by Scala
https://github.com/gitbucket/gitbucket-docker/pkgs/container/gitbucket
58 stars 23 forks source link

Jetty can't parse starting port #20

Open chumaltd opened 4 years ago

chumaltd commented 4 years ago

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 commented 2 months ago

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.

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 commented 2 months ago

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.