Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

UI component routing setup in config.json #31

Closed
rustyShacklefurd opened this issue Sep 14, 2023 · 6 comments
Closed

UI component routing setup in config.json #31

rustyShacklefurd opened this issue Sep 14, 2023 · 6 comments

Comments

@rustyShacklefurd
Copy link
Contributor

Currently the UI component has the ability to set SERVER_URL, REPOSITORY_SERVER_URL, and HASHSCAN_URL. When setting up the UI, Server, and Repository components to work in helm a loadbalancer is created that routes $LB_URL/server to the server component, $LB_URL/repository routes to the repository component, and $LB_URL defaults to the UI component.
However, we are using config.json to set UI components with these values

    {
    "SERVER_URL": "$LB_URL/server",
    "REPOSITORY_SERVER_URL": "$LB_URL/repository",
    "HASHSCAN_URL": "$HASHSCAN_URL",
    }

Each time that these configurations are added all calls the $LB_URL return 500s

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: IPv6 listen already enabled
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2023/09/13 20:52:41 [notice] 1#1: using the "epoll" event method
2023/09/13 20:52:41 [notice] 1#1: nginx/1.25.2
2023/09/13 20:52:41 [notice] 1#1: built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r10)
2023/09/13 20:52:41 [notice] 1#1: OS: Linux 5.15.107+
2023/09/13 20:52:41 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2023/09/13 20:52:41 [notice] 1#1: start worker processes
2023/09/13 20:52:41 [notice] 1#1: start worker process 22
2023/09/13 20:52:41 [notice] 1#1: start worker process 23
2023/09/13 20:52:41 [notice] 1#1: start worker process 24
2023/09/13 20:52:41 [notice] 1#1: start worker process 25
2023/09/13 20:52:41 [notice] 1#1: start worker process 26
2023/09/13 20:52:41 [notice] 1#1: start worker process 27
2023/09/13 20:52:41 [notice] 1#1: start worker process 28
2023/09/13 20:52:41 [notice] 1#1: start worker process 29
130.211.1.64 - - [13/Sep/2023:20:53:06 +0000] "GET / HTTP/1.1" 500 177 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)" "162.142.125.11, 34.98.119.6"
2023/09/13 20:53:06 [error] 22#22: *9 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 130.211.1.64, server: localhost, request: "GET / HTTP/1.1", host: "34.98.119.6"
2023/09/13 20:54:05 [error] 23#23: *26 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.3.75, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.3.75 - - [13/Sep/2023:20:54:05 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.159.213.122, 34.98.119.6"
2023/09/13 20:54:05 [error] 23#23: *27 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 130.211.1.90, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
130.211.1.90 - - [13/Sep/2023:20:54:05 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.184.124.165, 34.98.119.6"
35.191.31.98 - - [13/Sep/2023:20:54:06 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.159.213.122, 34.98.119.6"
2023/09/13 20:54:06 [error] 23#23: *28 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.31.98, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
2023/09/13 20:54:06 [error] 23#23: *31 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.3.212, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.3.212 - - [13/Sep/2023:20:54:06 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "54.93.162.220, 34.98.119.6"
35.191.10.230 - - [13/Sep/2023:20:54:06 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "54.93.34.50, 34.98.119.6"
2023/09/13 20:54:06 [error] 23#23: *33 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.10.230, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.3.77 - - [13/Sep/2023:20:54:07 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "54.93.162.220, 34.98.119.6"
2023/09/13 20:54:07 [error] 23#23: *34 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.3.77, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.8.89 - - [13/Sep/2023:20:54:08 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "54.93.162.220, 34.98.119.6"
2023/09/13 20:54:08 [error] 23#23: *35 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.8.89, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
2023/09/13 20:54:08 [error] 23#23: *36 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.32.25, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.32.25 - - [13/Sep/2023:20:54:08 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "35.159.20.214, 34.98.119.6"
2023/09/13 20:54:08 [error] 23#23: *37 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.17.210, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.17.210 - - [13/Sep/2023:20:54:08 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.194.167.153, 34.98.119.6"
35.191.8.77 - - [13/Sep/2023:20:54:10 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.159.213.122, 34.98.119.6"
2023/09/13 20:54:10 [error] 23#23: *38 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.8.77, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
2023/09/13 20:54:24 [error] 25#25: *42 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.19.115, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.19.115 - - [13/Sep/2023:20:54:24 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.159.213.122, 34.98.119.6"
35.191.3.137 - - [13/Sep/2023:20:54:25 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "35.159.20.214, 34.98.119.6"
2023/09/13 20:54:25 [error] 25#25: *43 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.3.137, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
2023/09/13 20:54:26 [error] 25#25: *47 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.19.120, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.19.120 - - [13/Sep/2023:20:54:26 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.194.167.153, 34.98.119.6"
35.191.14.8 - - [13/Sep/2023:20:54:36 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.184.124.165, 34.98.119.6"
2023/09/13 20:54:36 [error] 25#25: *51 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.14.8, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.15.142 - - [13/Sep/2023:20:54:36 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.159.213.122, 34.98.119.6"
2023/09/13 20:54:36 [error] 25#25: *52 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.15.142, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
2023/09/13 20:54:37 [error] 25#25: *53 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 130.211.1.71, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
130.211.1.71 - - [13/Sep/2023:20:54:37 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.194.172.177, 34.98.119.6"
35.191.3.145 - - [13/Sep/2023:20:54:37 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.159.213.122, 34.98.119.6"
2023/09/13 20:54:37 [error] 25#25: *54 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.3.145, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.3.79 - - [13/Sep/2023:20:54:37 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.184.124.165, 34.98.119.6"
2023/09/13 20:54:37 [error] 25#25: *55 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.3.79, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
2023/09/13 20:54:37 [error] 25#25: *56 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.26.127, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.26.127 - - [13/Sep/2023:20:54:37 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.184.124.165, 34.98.119.6"
2023/09/13 20:54:38 [error] 26#26: *57 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.3.214, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.3.214 - - [13/Sep/2023:20:54:38 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.194.167.153, 34.98.119.6"
2023/09/13 20:54:38 [error] 26#26: *58 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.1.228, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.1.228 - - [13/Sep/2023:20:54:38 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "54.93.162.220, 34.98.119.6"
2023/09/13 20:54:39 [error] 26#26: *59 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 130.211.1.66, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
130.211.1.66 - - [13/Sep/2023:20:54:39 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "3.75.234.26, 34.98.119.6"
2023/09/13 20:55:39 [error] 24#24: *78 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.26.127, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.26.127 - - [13/Sep/2023:20:55:39 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "3.125.123.57, 34.98.119.6"
2023/09/13 20:55:40 [error] 24#24: *79 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.3.97, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.3.97 - - [13/Sep/2023:20:55:40 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "18.194.172.177, 34.98.119.6"
35.191.15.167 - - [13/Sep/2023:20:55:41 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "3.75.234.26, 34.98.119.6"
2023/09/13 20:55:41 [error] 24#24: *80 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.15.167, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
2023/09/13 20:55:49 [error] 24#24: *84 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.3.140, server: localhost, request: "GET / HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.3.140 - - [13/Sep/2023:20:55:49 +0000] "GET / HTTP/1.1" 500 177 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0" "23.24.140.141, 34.98.119.6"
2023/09/13 20:55:53 [error] 24#24: *85 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.3.134, server: localhost, request: "GET / HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.3.134 - - [13/Sep/2023:20:55:53 +0000] "GET / HTTP/1.1" 500 177 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0" "23.24.140.141, 34.98.119.6"
2023/09/13 20:55:55 [error] 24#24: *86 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.3.134, server: localhost, request: "GET / HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.3.134 - - [13/Sep/2023:20:55:55 +0000] "GET / HTTP/1.1" 500 177 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0" "23.24.140.141, 34.98.119.6"
2023/09/13 20:58:09 [error] 29#29: *129 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.14.14, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.14.14 - - [13/Sep/2023:20:58:09 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "35.89.180.52, 34.98.119.6"
2023/09/13 20:58:12 [error] 29#29: *130 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.8.87, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.8.87 - - [13/Sep/2023:20:58:12 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "54.218.176.113, 34.98.119.6"
2023/09/13 21:05:45 [error] 22#22: *266 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.12.199, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.12.199 - - [13/Sep/2023:21:05:45 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "35.93.140.148, 34.98.119.6"
2023/09/13 21:05:45 [error] 22#22: *267 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.8.5, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.8.5 - - [13/Sep/2023:21:05:45 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "52.34.223.67, 34.98.119.6"
2023/09/13 21:05:46 [error] 22#22: *271 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.26.156, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.26.156 - - [13/Sep/2023:21:05:46 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "54.191.182.221, 34.98.119.6"
35.191.10.124 - - [13/Sep/2023:21:05:49 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "54.191.182.221, 34.98.119.6"
2023/09/13 21:05:49 [error] 22#22: *272 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.10.124, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
2023/09/13 21:07:03 [error] 23#23: *294 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.26.102, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.26.102 - - [13/Sep/2023:21:07:03 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "3.238.252.46, 34.98.119.6"
2023/09/13 21:07:06 [error] 25#25: *297 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 35.191.2.84, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "sourcify-integration.hedera-devops.com"
35.191.2.84 - - [13/Sep/2023:21:07:06 +0000] "GET /favicon.ico HTTP/1.1" 500 177 "-" "Slack-ImgProxy (+https://api.slack.com/robots)" "3.238.127.14, 34.98.119.6"`


I suspect that having both nginx and a loadbalancer in front is creating an issue b/c when it is configured to call back to the original `$LB_URL`.  For the helm/kubernetes deployments it would be preferred to instead of going back through the loadbalancer to route directly to the other sourcify components.  To set that the configuration would be
    {
    "SERVER_URL": "http://sourcify-server:5555",
    "REPOSITORY_SERVER_URL": "http://sourcify-repository:10000",
    "HASHSCAN_URL": "https://hashscan-latest.hedera-devops.com/",
    }

This setup would allow for UI to routed the server and repository using kubernetes service routing and remove the need to go back through the lb + nginx.
@rustyShacklefurd
Copy link
Contributor Author

After making the changes described above I see different routing based (presumably) on User Agent

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: IPv6 listen already enabled
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2023/09/14 15:29:11 [notice] 1#1: using the "epoll" event method
2023/09/14 15:29:11 [notice] 1#1: nginx/1.25.2
2023/09/14 15:29:11 [notice] 1#1: built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r10)
2023/09/14 15:29:11 [notice] 1#1: OS: Linux 5.15.107+
2023/09/14 15:29:11 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2023/09/14 15:29:11 [notice] 1#1: start worker processes
2023/09/14 15:29:11 [notice] 1#1: start worker process 22
2023/09/14 15:29:11 [notice] 1#1: start worker process 23
2023/09/14 15:29:11 [notice] 1#1: start worker process 24
2023/09/14 15:29:11 [notice] 1#1: start worker process 25
2023/09/14 15:29:11 [notice] 1#1: start worker process 26
2023/09/14 15:29:11 [notice] 1#1: start worker process 27
2023/09/14 15:29:11 [notice] 1#1: start worker process 28
2023/09/14 15:29:11 [notice] 1#1: start worker process 29
35.191.15.136 - - [14/Sep/2023:15:29:54 +0000] "GET /ui HTTP/1.1" 200 970 "-" "curl/7.79.1" "23.24.140.141, 34.98.119.6"
35.191.31.105 - - [14/Sep/2023:15:33:58 +0000] "GET /ui HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0" "23.24.140.141,

Above curl gets a 200 while Mozilla gets a 304. When using the browser I do not get any UI loaded, just a blank white page.

@rustyShacklefurd
Copy link
Contributor Author

GCP routing setup:

Default route - server
/server -> server
/repository -> repository
/ui -> ui

UI routing is redirecting everything back to the index.html page.

/ # cat /usr/share/nginx/html/_redirects
/* /index.html 200/ #
/ # cat /usr/share/nginx/html/index.html
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="twitter:card" content="summary"/><meta name="twitter:site" content="@sourcifyeth"/><meta name="og:title" content="sourcify.eth"/><meta name="og:description" content="Decentralized, open-sourced, automated contract verification service and an initiative for more human-friendly contract interactions."/><meta name="og:image" content="https://sourcify.dev/sourcify_blue_rounded.png"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>sourcify.eth</title><script defer="defer" src="./static/js/main.d81f2659.js"></script><link href="./static/css/main.1e7b84bc.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>/ #

Current config.json

{"HASHSCAN_URL":"https://hashscan-latest.hedera-devops.com/","REPOSITORY_SERVER_URL":"http://sourcify-repository:10000","SERVER_URL":"http://sourcify-server:5555","UI_DOMAIN_NAME":"https://sourcify-integration.hedera-devops.com/ui"}

@rustyShacklefurd
Copy link
Contributor Author

rustyShacklefurd commented Sep 15, 2023

GCP routing setup:

Default route - ui
/server -> server
/repository -> repository
/ui -> ui

Now the UI loads fine but there is an issue retrieving things like chains. When the default routing was set as it is in the comment above then getting the chains info was to https://sourcify-integration.hedera-devops.com/chains and get this response

➜  prompt git:(main) ✗ curl https://sourcify-integration.hedera-devops.com/chains
[{"name":"Hedera Mainnet","chainId":295,"rpc":["https://mainnet.hashio.io/api"],"supported":true,"monitored":false},{"name":"Hedera Testnet","chainId":296,"rpc":["https://testnet.hashio.io/api"],"supported":true,"monitored":false},{"name":"Hedera Previewnet","chainId":297,"rpc":["https://previewnet.hashio.io/api"],"supported":true,"monitored":false},{"name":"Hedera Local","chainId":298,"rpc":["http://localhost:7546"],"supported":true,"monitored":false}]

When changing the routing at the loadbalancer the same response should be just need /server appended to it. So now the same path should be https://sourcify-integration.hedera-devops.com/server/chains but this is the response

➜  prompt git:(main) ✗ curl https://sourcify-integration.hedera-devops.com/server/chains
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="twitter:card" content="summary"/><meta name="twitter:site" content="@sourcifyeth"/><meta name="og:title" content="sourcify.eth"/><meta name="og:description" content="Decentralized, open-sourced, automated contract verification service and an initiative for more human-friendly contract interactions."/><meta name="og:image" content="https://sourcify.dev/sourcify_blue_rounded.png"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>sourcify.eth</title><script defer="defer" src="./static/js/main.d81f2659.js"></script><link href="./static/css/main.1e7b84bc.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>%

This response is the index.html from the UI component.
A clearer example is try curling curl https://sourcify-integration.hedera-devops.com/server versus curl https://sourcify-integration.hedera-devops.com/server/. The first URL will hit the server component and respond correctly (cannot GET /server) but the second URL will respond with the index.html from the UI.

@rustyShacklefurd
Copy link
Contributor Author

GCP routing setup:

Default route - ui
/server -> server
/server/* -> server
/repository -> repository
/ui -> ui
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /server/chains</pre>
</body>
</html>

This time its routing to the server component but the query isn't what server is expecting so it returns 404s

@svienot
Copy link
Contributor

svienot commented Sep 18, 2023

Issues with the configuration file that the ui is using:

  • the UI_DOMAIN_NAME needs to be provided with an environment variable, not from this config file. This value is used by the server to configure CORS by allowing this domain as an origin. The value needs to be set to the fully qualified domain name of the ui. Here this would be: sourcify-integration.hedera-devops.com

  • using HTTP URLs for SERVER_URL and REPOSITORY_SERVER_URL does not work because the browser refuses to load an insecure resource from a page loaded over HTTPS. We get this error:
    index.tsx:35 Mixed Content: The page at 'https://sourcify-integration.hedera-devops.com/' was loaded over HTTPS, but requested an insecure resource 'http://sourcify-server:5555/session/data'. This request has been blocked; the content must be served over HTTPS.

@rustyShacklefurd
Copy link
Contributor Author

Solution: these requests from UI are from a browser based display and therefore have to be reachable via the internet. Having the server and repository as back-ends for a web-app is not sufficient because UI is not populating this display but the browser is reaching out and getting this information. Work on pull request #26 made the adjustments to have both components reachable.

@github-project-automation github-project-automation bot moved this from Sprint BackLog to Done in Smart Contract Sprint Board Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants