Hello,
Using gitlab for few months now, I'd like to update the GITLAB_HOST environment variable to match my new reverse proxy configuration.
I tried to change the value in the docker-compose.yml file, in the container's config.json file, in the container itself, overriding values from config file, but it remains the same, localhost.
This is annoying only because of the localhost value in the clone text field. Do you know any way to achieve this ?
Same problem to me. Even when do logout it'll redirect to localhost:10080
@sagittarius-a @natsu90 after updating docker-compose.yml you need to stop and remove the existing gitlab container and recreate it. Assuming your docker-compose.yml is based off of https://github.com/sameersbn/docker-gitlab/blob/master/docker-compose.yml
docker-compose down
docker-compose up
@sameersbn Thanks, but it still use localhost:10080. Below is my settings. Should I change the port?
gitlab:
ports:
- "10080:80"
environment:
- GITLAB_HOST=gitlab.{domain}.com
- GITLAB_PORT=80
@natsu90 can you share the complete docker-compose.yml that will allow me to test?
@sameersbn I'm using the same exact settings from repo earlier, then I updated only GITLAB_HOST & GITLAB_PORT as above and do docker-compose down & up -d again but localhost:10080 is still seen in repo URL and in redirect after logout.
@natsu90 these are the only changes that are required.
environment:
- GITLAB_HOST=gitlab.{domain}.com
- GITLAB_PORT=80
I tested it using the latest image and found no issues. Here are my steps
# download default docker-compose.yml
wget https://raw.githubusercontent.com/sameersbn/docker-gitlab/master/docker-compose.yml
# launch
docker-compose up -d
# wait for gitlab to start, create repo, etc.
# update docker-compose.yml
sed -i 's/GITLAB_HOST=localhost/GITLAB_HOST=git.example.com/' docker-compose.yml
sed -i 's/GITLAB_PORT=10080/GITLAB_PORT=80/' docker-compose.yml
# stop and remove gitlab containers
docker-compose down
# start
docker-compose up
I don't know why it does not work for you. Can you try logging into the gitlab container using docker exec and checking the values of GITLAB_HOST and GITLAB_PORT using printenv GITLAB_HOST GITLAB_PORT. These should be according to the values set in the docker-compose.yml.
You can also access the instance directly using http://localhost:10080 and check if the git clone http urls are according to the GITLAB_HOST and GITLAB_PORT settings. If they are correct, then it may be a case of browser or reverse proxy caching.,
GITLAB_HOST & GITLAB_PORT from printenv looks fine. Wonder if related with this issue; https://github.com/docker/compose/issues/1793 since I renamed the parent folder.
When accessing http://192.168.1.2:10080, git clone http urls following the access url, instead of GITLAB_HOST & GITLAB_PORT that I've set.
since I renamed the parent folder.
This is probably it. Try listing all containers.
docker ps -a
Manually stop and remove the containers that have the prefix OLD_FOLDER_NAME_ in the container name and try again.
I am using nginx and have added the proxy_set_header options into the config. It now correctly uses http://gitlab.domain.com instead of http://localhost:10080.
location / {
proxy_pass http://localhost:10080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_read_timeout 300;
}
Closing the issue. Please reopen if the problem persists.
@i906 you're the best!!
Most helpful comment
I am using nginx and have added the
proxy_set_headeroptions into the config. It now correctly useshttp://gitlab.domain.cominstead ofhttp://localhost:10080.