Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
23 stars 12 forks source link

[Task] Deploy OC stack 2023-09-14 #2128

Closed tschaffter closed 1 year ago

tschaffter commented 1 year ago

What product(s) is this feature for?

OpenChallenges

Description

Previous stack

Commit ID:

ubuntu@openchallenges-preview-instance:~/sage-monorepo$ git rev-parse HEAD
00549552d5e673b49d21debc31612827f73d7740

App config excerpt:

APP_VERSION="1.1.0-alpha"
DATA_UPDATED_ON="2023-08-23"

Docker images:

ubuntu@openchallenges-preview-instance:~/sage-monorepo$ docker images
REPOSITORY                                                     TAG       IMAGE ID       CREATED        SIZE
ghcr.io/sage-bionetworks/openchallenges-image-service          edge      bfadeba6b4e0   3 weeks ago    322MB
ghcr.io/sage-bionetworks/openchallenges-organization-service   edge      9f1cf4c393f0   3 weeks ago    355MB
ghcr.io/sage-bionetworks/openchallenges-challenge-service      edge      5eff1b33b2f6   3 weeks ago    357MB
ghcr.io/sage-bionetworks/openchallenges-app                    edge      194bb3df17a6   3 weeks ago    27MB
ghcr.io/sage-bionetworks/openchallenges-config-server          edge      50974331954f   6 weeks ago    307MB
ghcr.io/sage-bionetworks/openchallenges-apex                   edge      8da2b9c4c593   6 weeks ago    42.7MB
ghcr.io/sage-bionetworks/openchallenges-vault                  edge      4e076959741f   6 weeks ago    230MB
ghcr.io/sage-bionetworks/openchallenges-elasticsearch          edge      ce348c2d1b93   6 weeks ago    622MB
ghcr.io/sage-bionetworks/openchallenges-api-docs               edge      58bd040f9b64   6 weeks ago    33.6MB
ghcr.io/sage-bionetworks/openchallenges-mariadb                edge      7c8bae4d4f04   6 weeks ago    384MB
ghcr.io/sage-bionetworks/openchallenges-api-gateway            edge      3940537dce7e   6 weeks ago    322MB
ghcr.io/sage-bionetworks/openchallenges-service-registry       edge      2fa8fbd37f93   6 weeks ago    321MB
ghcr.io/sage-bionetworks/openchallenges-zipkin                 edge      9eb6d33828b2   3 months ago   157MB
ghcr.io/sage-bionetworks/openchallenges-thumbor                edge      92aa7db974ed   4 months ago   606MB

Update stack

Pull current commit on main

git pull

Update app config in apps/openchallenges/app/.env.

Remove the containers:

docker rm -f $(docker ps -aq)

Remove the images:

docker rmi -f $(docker images -aq)

Pull the edge images and start the stack:

OPENCHALLENGES_VERSION=edge ./docker/openchallenges/serve-detach.sh openchallenges-apex

Note Elasticsearch nodes may fail to start on first try. In that case, run the command again until all the containers are healthy.

New stack

Commit ID:

ubuntu@openchallenges-preview-instance:~/sage-monorepo$ git rev-parse HEAD
0c441eba0bcb8ee15ec80a5c552c570fd13ccd9d

App config excerpt:

APP_VERSION="1.2.0-alpha"
DATA_UPDATED_ON="2023-09-14"

Docker images:

ubuntu@openchallenges-preview-instance:~/sage-monorepo$ docker images
REPOSITORY                                                     TAG       IMAGE ID       CREATED          SIZE
ghcr.io/sage-bionetworks/openchallenges-image-service          edge      cee174febaf2   9 minutes ago    322MB
ghcr.io/sage-bionetworks/openchallenges-organization-service   edge      f65379d6496d   9 minutes ago    355MB
ghcr.io/sage-bionetworks/openchallenges-challenge-service      edge      4ace04285f6c   9 minutes ago    357MB
ghcr.io/sage-bionetworks/openchallenges-app                    edge      accaacfe5b9c   9 minutes ago    28.1MB
ghcr.io/sage-bionetworks/openchallenges-api-gateway            edge      3d4efa0d2646   13 minutes ago   322MB
ghcr.io/sage-bionetworks/openchallenges-config-server          edge      50974331954f   6 weeks ago      307MB
ghcr.io/sage-bionetworks/openchallenges-apex                   edge      8da2b9c4c593   6 weeks ago      42.7MB
ghcr.io/sage-bionetworks/openchallenges-vault                  edge      4e076959741f   6 weeks ago      230MB
ghcr.io/sage-bionetworks/openchallenges-elasticsearch          edge      ce348c2d1b93   6 weeks ago      622MB
ghcr.io/sage-bionetworks/openchallenges-api-docs               edge      58bd040f9b64   6 weeks ago      33.6MB
ghcr.io/sage-bionetworks/openchallenges-mariadb                edge      7c8bae4d4f04   6 weeks ago      384MB
ghcr.io/sage-bionetworks/openchallenges-service-registry       edge      2fa8fbd37f93   6 weeks ago      321MB
ghcr.io/sage-bionetworks/openchallenges-zipkin                 edge      9eb6d33828b2   3 months ago     157MB
ghcr.io/sage-bionetworks/openchallenges-thumbor                edge      92aa7db974ed   4 months ago     606MB

Anything else?

No response

Code of Conduct

tschaffter commented 1 year ago

Cross-Origin Request Blocked

The new endpoint added to fetch the plot data is blocked.

Logs from the browser console on the home page:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://dev.openchallenges.io/api/v1/challengeAnalytics/challengesPerYear. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 302.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://dev.openchallenges.io/api/v1/challengeAnalytics/challengesPerYear. (Reason: CORS request did not succeed). Status code: (null).

ERROR 
Object { headers: {…}, status: 0, statusText: "Unknown Error", url: "https://dev.openchallenges.io/api/v1/challengeAnalytics/challengesPerYear", ok: false, name: "HttpErrorResponse", message: "Http failure response for https://dev.openchallenges.io/api/v1/challengeAnalytics/challengesPerYear: 0 Unknown Error", error: error }

Solution

The issue was that the API gateway image was deprecated. I had to temporarily limit the number of images built and published by the CI workflow, which included the removal of the API gateway. However, the code of the API gateway changed recently to allow requests to get the plot data. The CI workflow now builds again the image of the API gateway.

Another reason that could have led to this issue could have been that the remote config was out of date. However, I remembered updated the config in both the branch test-2 (used in development) and private-preview (used in prod) when configuring the API gateway to allow the new endpoint.