From e23228ee4b4ab0bcd90cce6e2d6703cf6264e05d Mon Sep 17 00:00:00 2001 From: xiahaoshawn Date: Mon, 11 Apr 2016 19:07:19 +0800 Subject: [PATCH 01/12] add test-travis --- test-travis | 1 + 1 file changed, 1 insertion(+) create mode 100644 test-travis diff --git a/test-travis b/test-travis new file mode 100644 index 000000000..0331e0131 --- /dev/null +++ b/test-travis @@ -0,0 +1 @@ +hello travis From 1045b7836aaa7c142930b8053a58cfeb555a4286 Mon Sep 17 00:00:00 2001 From: xiahaoshawn Date: Thu, 14 Apr 2016 14:35:25 +0800 Subject: [PATCH 02/12] Revert "add test-travis" This reverts commit e23228ee4b4ab0bcd90cce6e2d6703cf6264e05d. --- test-travis | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test-travis diff --git a/test-travis b/test-travis deleted file mode 100644 index 0331e0131..000000000 --- a/test-travis +++ /dev/null @@ -1 +0,0 @@ -hello travis From 652fb25c438bc873449032fc5e7c4fd44adc7272 Mon Sep 17 00:00:00 2001 From: xiahaoshawn Date: Thu, 14 Apr 2016 14:48:20 +0800 Subject: [PATCH 03/12] add docker service --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6e536c507..b78785fd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ go_import_path: github.com/vmware/harbor service: - mysql + - docker env: GO15VENDOREXPERIMENT=1 DB_HOST=127.0.0.1 DB_PORT=3306 DB_USR=root DB_PWD= @@ -26,3 +27,5 @@ script: - go list ./... | grep -v /vendor/ | xargs -L1 fgt golint - go list ./... | grep -v 'vendor' | xargs -L1 go vet - go list ./... | grep -v 'vendor' | xargs -L1 go test -v + - docker version + - docker-compose version From ea4acda3cd415913c1ef8060f8126d11ef933f6b Mon Sep 17 00:00:00 2001 From: xiahaoshawn Date: Thu, 14 Apr 2016 15:18:38 +0800 Subject: [PATCH 04/12] use standard environment --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index b78785fd6..d022aa409 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +sudo: required + language: go go: From b3075e46c2e4fad8159b2b5cfc4c90826383ef2e Mon Sep 17 00:00:00 2001 From: xiahaoshawn Date: Thu, 14 Apr 2016 15:47:02 +0800 Subject: [PATCH 05/12] use Trusty Beta image --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index d022aa409..1f487c054 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ sudo: required +dist: trusty language: go From 4cb5ed3ee5430bce1eebc3344b3c5d685e8941d4 Mon Sep 17 00:00:00 2001 From: xiahaoshawn Date: Thu, 14 Apr 2016 18:29:18 +0800 Subject: [PATCH 06/12] add comments of x-fowarded-XXX headers --- Deploy/config/nginx/nginx.https.conf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Deploy/config/nginx/nginx.https.conf b/Deploy/config/nginx/nginx.https.conf index 7e03b9585..71d7d25ab 100644 --- a/Deploy/config/nginx/nginx.https.conf +++ b/Deploy/config/nginx/nginx.https.conf @@ -45,9 +45,12 @@ http { location / { proxy_pass http://ui/; proxy_set_header Host $http_host; + + # Remove the following three lines if setting up harbor behind an nginx proxy or Elastic Load Balancing. proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; + proxy_buffering off; proxy_request_buffering off; } @@ -59,9 +62,12 @@ http { location /v2/ { proxy_pass http://registry/v2/; proxy_set_header Host $http_host; + + # Remove the following three lines if setting up harbor behind an nginx proxy or Elastic Load Balancing. proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; + proxy_buffering off; proxy_request_buffering off; @@ -70,9 +76,12 @@ http { location /service/ { proxy_pass http://ui/service/; proxy_set_header Host $http_host; + + # Remove the following three lines if setting up harbor behind an nginx proxy or Elastic Load Balancing. proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; + proxy_buffering off; proxy_request_buffering off; } From a01830d9e7857a6affbaf27addd9835ec366dd84 Mon Sep 17 00:00:00 2001 From: xiahaoshawn Date: Thu, 14 Apr 2016 18:56:44 +0800 Subject: [PATCH 07/12] Revert "use Trusty Beta image" This reverts commit b3075e46c2e4fad8159b2b5cfc4c90826383ef2e. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1f487c054..d022aa409 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ sudo: required -dist: trusty language: go From 68e78f7748b6c5ee9be96ff7fb8a5ffe2b306e35 Mon Sep 17 00:00:00 2001 From: xiahaoshawn Date: Thu, 14 Apr 2016 18:57:22 +0800 Subject: [PATCH 08/12] Revert "use standard environment" This reverts commit ea4acda3cd415913c1ef8060f8126d11ef933f6b. --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d022aa409..b78785fd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -sudo: required - language: go go: From da929df36ead8cd381ed957b206ebdc73eee3836 Mon Sep 17 00:00:00 2001 From: xiahaoshawn Date: Thu, 14 Apr 2016 18:58:17 +0800 Subject: [PATCH 09/12] Revert "add docker service" This reverts commit 652fb25c438bc873449032fc5e7c4fd44adc7272. --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b78785fd6..6e536c507 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ go_import_path: github.com/vmware/harbor service: - mysql - - docker env: GO15VENDOREXPERIMENT=1 DB_HOST=127.0.0.1 DB_PORT=3306 DB_USR=root DB_PWD= @@ -27,5 +26,3 @@ script: - go list ./... | grep -v /vendor/ | xargs -L1 fgt golint - go list ./... | grep -v 'vendor' | xargs -L1 go vet - go list ./... | grep -v 'vendor' | xargs -L1 go test -v - - docker version - - docker-compose version From 23170ce806ee04615542962c673be2613b06410a Mon Sep 17 00:00:00 2001 From: xiahaoshawn Date: Thu, 14 Apr 2016 19:01:07 +0800 Subject: [PATCH 10/12] update configure_https.md --- docs/configure_https.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/configure_https.md b/docs/configure_https.md index e366cb5d7..ff18f7217 100644 --- a/docs/configure_https.md +++ b/docs/configure_https.md @@ -120,3 +120,11 @@ After setting up HTTPS for Harbor, you can verify it by the follow steps: cp yourdomain.com.crt /etc/pki/ca-trust/source/anchors/reg.yourdomain.com.crt update-ca-trust ``` + +3. If setting up harbor behind an nginx proxy or elastic load balancing, harbor nginx will reset the values of x-fowarded-XXX headers from first layer nginx or elastic load balancing, and the requests will not be routed properly. +In this situation remove the following lines in "location /", "location /v2/" and "location /service/" sections. + ``` + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + ``` From c818b63183ab77c43ad9fbdc1c444eed9461b84d Mon Sep 17 00:00:00 2001 From: xiahaoshawn Date: Fri, 22 Apr 2016 15:12:08 +0800 Subject: [PATCH 11/12] document Nginx config when set uo Harbor behind other proxy --- Deploy/config/nginx/nginx.conf | 9 +++++++++ Deploy/config/nginx/nginx.https.conf | 12 ++++++------ docs/configure_https.md | 9 +-------- docs/installation_guide.md | 6 +++++- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Deploy/config/nginx/nginx.conf b/Deploy/config/nginx/nginx.conf index 8168137ea..8f3430e48 100644 --- a/Deploy/config/nginx/nginx.conf +++ b/Deploy/config/nginx/nginx.conf @@ -33,7 +33,10 @@ http { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings. proxy_set_header X-Forwarded-Proto $scheme; + proxy_buffering off; proxy_request_buffering off; } @@ -47,7 +50,10 @@ http { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings. proxy_set_header X-Forwarded-Proto $scheme; + proxy_buffering off; proxy_request_buffering off; @@ -58,7 +64,10 @@ http { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings. proxy_set_header X-Forwarded-Proto $scheme; + proxy_buffering off; proxy_request_buffering off; } diff --git a/Deploy/config/nginx/nginx.https.conf b/Deploy/config/nginx/nginx.https.conf index 71d7d25ab..c802943c1 100644 --- a/Deploy/config/nginx/nginx.https.conf +++ b/Deploy/config/nginx/nginx.https.conf @@ -45,10 +45,10 @@ http { location / { proxy_pass http://ui/; proxy_set_header Host $http_host; - - # Remove the following three lines if setting up harbor behind an nginx proxy or Elastic Load Balancing. proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings. proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; @@ -62,10 +62,10 @@ http { location /v2/ { proxy_pass http://registry/v2/; proxy_set_header Host $http_host; - - # Remove the following three lines if setting up harbor behind an nginx proxy or Elastic Load Balancing. proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings. proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; @@ -76,10 +76,10 @@ http { location /service/ { proxy_pass http://ui/service/; proxy_set_header Host $http_host; - - # Remove the following three lines if setting up harbor behind an nginx proxy or Elastic Load Balancing. proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings. proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; diff --git a/docs/configure_https.md b/docs/configure_https.md index 72382a549..7eed8db8b 100644 --- a/docs/configure_https.md +++ b/docs/configure_https.md @@ -124,11 +124,4 @@ After setting up HTTPS for Harbor, you can verify it by the follow steps: cp yourdomain.com.crt /etc/pki/ca-trust/source/anchors/reg.yourdomain.com.crt update-ca-trust ``` - -3. If setting up harbor behind an nginx proxy or elastic load balancing, harbor nginx will reset the values of x-fowarded-XXX headers from first layer nginx or elastic load balancing, and the requests will not be routed properly. -In this situation remove the following lines in "location /", "location /v2/" and "location /service/" sections. - ``` - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - ``` + \ No newline at end of file diff --git a/docs/installation_guide.md b/docs/installation_guide.md index 56d0c5152..ab9e78df5 100644 --- a/docs/installation_guide.md +++ b/docs/installation_guide.md @@ -203,4 +203,8 @@ $ rm -r /data/registry [Docker Compose command-line reference](https://docs.docker.com/compose/reference/) describes the usage information for the docker-compose subcommands. ### Persistent data and log files -By default, the data of database and image files in the registry are persisted in the directory **/data/** of the target machine. When Harbor's containers are removed and recreated, the data remain unchanged. Harbor leverages rsyslog to collect the logs of each container, by default the log files are stored in the directory **/var/log/harbor/** on Harbor's host. +By default, the data of database and image files in the registry are persisted in the directory **/data/** of the target machine. When Harbor's containers are removed and recreated, the data remain unchanged. Harbor leverages rsyslog to collect the logs of each container, by default the log files are stored in the directory **/var/log/harbor/** on Harbor's host. + +##Troubleshooting +1.When setting up Harbor behind another nginx proxy or elastic load balancing, remove the below line if the proxy already has similar settings. Be sure to remove the line under these 3 sections: "location /", "location /v2/" and "location /service/". +proxy_set_header X-Forwarded-Proto $scheme; From 5e222f7a9786a658addb396036f5a2ab16c780f3 Mon Sep 17 00:00:00 2001 From: Xia Hao Date: Fri, 22 Apr 2016 15:17:43 +0800 Subject: [PATCH 12/12] Update installation_guide.md --- docs/installation_guide.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/installation_guide.md b/docs/installation_guide.md index ab9e78df5..15b5c8c7e 100644 --- a/docs/installation_guide.md +++ b/docs/installation_guide.md @@ -207,4 +207,6 @@ By default, the data of database and image files in the registry are persisted i ##Troubleshooting 1.When setting up Harbor behind another nginx proxy or elastic load balancing, remove the below line if the proxy already has similar settings. Be sure to remove the line under these 3 sections: "location /", "location /v2/" and "location /service/". +``` proxy_set_header X-Forwarded-Proto $scheme; +```