-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat(web): dockerize web application #1253
Conversation
✅ Deploy Preview for reearth-cms ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
||
jobs: | ||
deploy_web: | ||
# TODO: Remove after dockerizing the web. | ||
deploy_web_gcs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
I changed it so that I could remove this block entirely after verifying our new Docker image without renaming the web (Docker) job.
web/vite.config.ts
Outdated
@@ -15,13 +15,6 @@ import { configDefaults } from "vitest/config"; | |||
|
|||
import pkg from "./package.json"; | |||
|
|||
let commitHash = ""; | |||
try { | |||
commitHash = execSync("git rev-parse HEAD").toString().trimEnd(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Because we built in Docker, it has no Git information.
✅ Deploy Preview for reearth-cms ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
b81e328
to
d98eddd
Compare
@@ -0,0 +1,11 @@ | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Allow listing is always good and safe.
# Default to Cloud Run port. | ||
# Ref: https://cloud.google.com/run/docs/reference/container-contract#port | ||
ENV PORT=8080 | ||
|
||
# Defaults Google Cloud Load Balancer header. | ||
# Ref: https://cloud.google.com/load-balancing/docs/https#target-proxies | ||
ENV REAL_IP_HEADER=X-Forwarded-For |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
IMHO, vendor-specific configurations should be configurable since we are an OSS product; in this case, we can pass -e
to override on execution.
d98eddd
to
ea3302e
Compare
Signed-off-by: KeisukeYamashita <[email protected]>
ea3302e
to
7fa43b3
Compare
log_format json escape=json '{' | ||
'"body_bytes_sent": "$body_bytes_sent",' | ||
'"http_referer": "$http_referer",' | ||
'"http_user_agent": "$http_user_agent",' | ||
'"remote_ip": "$remote_addr",' | ||
'"remote_user": "$remote_user",' | ||
'"request": "$request",' | ||
'"request_id": "$request_id",' | ||
'"request_method": "$request_method",' | ||
'"request_time": "$request_time",' | ||
'"request_uri": "$request_uri",' | ||
'"server_name": "$server_name",' | ||
'"status": "$status",' | ||
'"time": "$time_iso8601"' | ||
'}'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I accessed the container via curl
and it will be like this:
{"body_bytes_sent": "739","http_referer": "","http_user_agent": "curl/8.7.1","remote_ip": "xxx.xxx.xxx.xxx","remote_user": "","request": "GET / HTTP/1.1","request_id": "fde3377155ab9765825dff57cb2a83f6","request_method": "GET","request_time": "0.000","request_uri": "/","server_name": "_","status": "200","time": "2024-10-08T22:48:41+00:00"}
Co-authored-by: rot1024 <[email protected]>
|
||
- uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.GCP_SA_KEY }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workload Identity is not used... Later we want to change
Signed-off-by: KeisukeYamashita <[email protected]>
Signed-off-by: KeisukeYamashita <[email protected]>
Overview
I've Dockerized the web application to be portable and deployable to container runtimes (e.g. Cloud Run, Kubernetes). We aim to host the web on Cloud Run.
What I've done
I've containerised the application and implemented the deployment workflow.
What I haven't done
I haven't decommissioned our GCS stuff yet.
I've implemented it separately from the existing system so that we can deploy, test, and switch over without any impact.
How I tested
I've built in manually:
$ docker build . -t reearth-cms-web && docker run -e AUTH0_AUDIENCE="https://api.cms.dev.reearth.io" -e AUTH0_CLIENT_ID="xxx" -e AUTH0_DOMAIN="https://reearth-dev.auth0.com" -p 8080:8080 reearth-cms-web
Then, I accessed some of the paths and looks okay:
All returned the contents under
//usr/share/nginx/html
based on the request path.Screenshot
Which point I want you to review particularly
Memo
Note that I haven't added any cache configurations yet, perf tuning will be another PR.