harness / gitness

Gitness is an Open Source developer platform with Source Control management, Continuous Integration and Continuous Delivery.
https://gitness.com
Apache License 2.0
32.09k stars 2.8k forks source link

environment variable for docker-compose #3388

Closed AmsellemJoseph closed 11 months ago

AmsellemJoseph commented 11 months ago

Hey,

I've just deployed gitness with docker-compose, everything seems ok, but when I want de deploy a new pipeline, I have this error:

fatal: unable to access 'http://host.docker.internal:3000/git/my-workspace/my-repository.git'

Here is my docker-compose

version: "3.3"
services:
  gitness:
    image: "harness/gitness:latest"
    restart: always
    ports:
      - "172.17.0.1:53521:3000"
    environment:
      - GITNESS_URL_API=https://${DOMAIN}/api
      - GITNESS_URL_GIT=https://${DOMAIN}/git
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./storage/gitness:/data"

and my env var is: DOMAIN=my.domain.com

Maybe I missed an environment variable or something.

Thx a lot for your responses.

johannesHarness commented 11 months ago

Hey @AmsellemJoseph, thank you for your interest in Gitness!

It seems you are exposing Gitness on the docker container on port 53521, so the build containers can't reach Gitness on the default port 3000. We just released a new Gitness image with some improved environment variables for configuring Gitness on different ports / domains - which should open up multiple options to fix your problem :)

The simplest option would probably be to explicitly configure the build containers to connect to port 53521.\ You can do that by adding the following environment variable to your docker-compose file:

- GITNESS_URL_CONTAINER=http://host.docker.internal:53521

Another option would be to have Gitness listen on the same port you expose on the container (which will change the default port used by build containers to reach gitness). For that you can to do the following changes to your yaml:

ports:
      - "172.17.0.1:53521:53521"
environment:
      - GITNESS_HTTP_PORT= 53521
      ...
AmsellemJoseph commented 11 months ago

Hey @johannesHarness, thanks a lot, it works perfectly!!