-
Notifications
You must be signed in to change notification settings - Fork 7
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
HMS-3414 build: update ephemeral cluster #27
Closed
avisiedo
wants to merge
12
commits into
podengo-project:main
from
avisiedo:hms-3414-update-ephemeral
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cd73092
feat(HMS-3165): update frontend.yaml description
avisiedo f046c74
build(HMS-3165): add python dependencies
avisiedo fc98a86
build(HMS-3165): add .venv
avisiedo d1961c7
build(HMS-3165): add bonfire config template
avisiedo 401cb53
build(HMS-3165): script to deploy in ephe
avisiedo d43db62
build(HMS-3165): align jest with platform docs
avisiedo 9d1d2e1
build(HMS-3165): frontend container
avisiedo 8a4c3f4
build(HMS-3165): update Dockerfile
avisiedo 8a33c47
build(HMS-3165): update makefile
avisiedo a32c9be
build(HMS-3165): add .dockerignore
avisiedo 9d87a7c
fix(HMS-3165): container metadata files
avisiedo 4d0986d
build(HMS-3414): update ephemeral cluster
avisiedo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Ignore /secrets directory content | ||
secrets | ||
|
||
# Ignore common directories | ||
.git | ||
dist | ||
bin | ||
node_modules | ||
.venv | ||
config/bonfire.yaml | ||
.npm | ||
.cache | ||
.devcontainer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,5 @@ coverage | |
.env | ||
secrets | ||
bin | ||
.venv | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
{$CADDY_TLS_MODE} | ||
auto_https disable_redirects | ||
servers { | ||
metrics | ||
} | ||
} | ||
|
||
:9000 { | ||
metrics /metrics | ||
} | ||
|
||
:8000 { | ||
{$CADDY_TLS_CERT} | ||
log | ||
|
||
# Handle main app route | ||
@app_match { | ||
path /apps/idmsvc* | ||
} | ||
handle @app_match { | ||
uri strip_prefix /apps/idmsvc | ||
file_server * { | ||
root /opt/app-root/src/dist/stable | ||
browse | ||
} | ||
} | ||
|
||
# Handle beta app route | ||
@beta_match { | ||
path /beta/apps/idmsvc* | ||
} | ||
handle @beta_match { | ||
uri strip_prefix /beta/apps/idmsvc | ||
file_server * { | ||
root /opt/app-root/src/dist/preview | ||
browse | ||
} | ||
} | ||
|
||
# Handle preview app route | ||
@preview_match { | ||
path /preview/apps/idmsvc* | ||
} | ||
handle @preview_match { | ||
uri strip_prefix /preview/apps/idmsvc* | ||
file_server * { | ||
root /opt/app-root/src/dist/preview | ||
browse | ||
} | ||
} | ||
|
||
handle /beta/ { | ||
redir /beta/apps/chrome/index.html permanent | ||
} | ||
|
||
handle /preview/ { | ||
redir /preview/apps/chrome/index.html permanent | ||
} | ||
|
||
handle / { | ||
redir /apps/chrome/index.html permanent | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM registry.redhat.io/rhel9/nodejs-16:1-110 AS builder | ||
# https://github.com/cypress-io/cypress/issues/25236 | ||
# TODO Set env variable indicated into the URL | ||
USER root | ||
WORKDIR /opt/app-root/src | ||
COPY package*.json . | ||
RUN npm install | ||
COPY src src | ||
COPY *.js . | ||
COPY tsconfig.json tsconfig.json | ||
RUN npm run build | ||
|
||
COPY build/package/gen.app.info.sh gen.app.info.sh | ||
RUN mv dist target \ | ||
&& mkdir dist \ | ||
&& cp -Rvf target dist/preview \ | ||
&& cp -Rvf target dist/stable \ | ||
&& true | ||
ARG SRC_HASH | ||
ENV SRC_HASH=${SRC_HASH} | ||
ARG APP_NAME | ||
ENV APP_NAME=${APP_NAME} | ||
RUN ./gen.app.info.sh | ||
|
||
|
||
FROM quay.io/cloudservices/caddy-ubi:11145b1 | ||
WORKDIR /opt/app-root/src | ||
|
||
COPY build/package/Caddyfile /opt/app-root/src/Caddyfile | ||
COPY --from=builder /opt/app-root/src/dist /opt/app-root/src/dist/ | ||
COPY --from=builder /opt/app-root/src/app.info.json /opt/app-root/src/dist/ | ||
COPY --from=builder /opt/app-root/src/app.info.deps.json /opt/app-root/src/dist/ | ||
COPY --from=builder /opt/app-root/src/app.info.stable.json /opt/app-root/src/dist/stable/app.info.json | ||
COPY --from=builder /opt/app-root/src/app.info.preview.json /opt/app-root/src/dist/preview/app.info.json | ||
COPY ./package.json /opt/app-root/src/ | ||
|
||
RUN sed -i -e 's/\/beta\/apps/\/apps/g' /opt/app-root/src/dist/stable/fed-mods.json | ||
|
||
ENV APP_NAME="idmsvc" | ||
ENV ROUTE_PATH="/apps/${APP_NAME}" | ||
ENV BETA_ROUTE_PATH="/beta/apps/${APP_NAME}" | ||
ENV PREVIEW_ROUTE_PATH="/preview/apps/${APP_NAME}" | ||
|
||
CMD ["caddy", "run", "--config", "/opt/app-root/src/Caddyfile"] | ||
|
||
EXPOSE 8000 | ||
EXPOSE 9000 | ||
|
||
ENV CADDY_TLS_MODE="http_port 8000" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
APP_NAME=idmsvc | ||
# SRC_HASH is passed as a build argument | ||
|
||
# root files | ||
|
||
cat > "app.info.json" << EOF | ||
{ | ||
"app_name": "${APP_NAME}", | ||
"src_hash": "${SRC_HASH}", | ||
"patternfly_dependencies": [], | ||
"rh_cloud_services_dependencies": [] | ||
} | ||
EOF | ||
|
||
cat > "app.info.deps.json" << EOF | ||
undefined | ||
EOF | ||
|
||
# stable | ||
|
||
cat > "app.info.stable.json" << EOF | ||
{ | ||
"app_name": "${APP_NAME}", | ||
"node_version": ">=16.0.0", | ||
"src_hash": "${SRC_HASH}", | ||
"src_tag": "unknown", | ||
"src_branch": "unknown", | ||
"patternfly_dependencies": "[\"@patternfly/[email protected]\",\"@patternfly/[email protected]\"]", | ||
"rh_cloud_services_dependencies": "[\"@redhat-cloud-services/[email protected]\",\"@redhat-cloud-services/[email protected]\",\"@redhat-cloud-services/[email protected]\"]" | ||
} | ||
EOF | ||
|
||
# preview | ||
|
||
cat > "app.info.preview.json" << EOF | ||
{ | ||
"app_name": "${APP_NAME}", | ||
"node_version": ">=16.0.0", | ||
"src_hash": "${SRC_HASH}", | ||
"src_tag": "unknown", | ||
"src_branch": "unknown", | ||
"patternfly_dependencies": "[\"@patternfly/[email protected]\",\"@patternfly/[email protected]\"]", | ||
"rh_cloud_services_dependencies": "[\"@redhat-cloud-services/[email protected]\",\"@redhat-cloud-services/[email protected]\",\"@redhat-cloud-services/[email protected]\"]" | ||
} | ||
EOF | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
# This file can be used as a template for getting started with | ||
# a local bonfire configuration which is used by default by | ||
# our local repository automation (makefiles) to make the developer | ||
# life easier. | ||
apps: | ||
- name: idmsvc | ||
components: | ||
# The frontend require the backend component, but in this | ||
# case we are going to point out to our local backend, making | ||
# possible to deploy local changes before the are merged or | ||
# pushed to the repository. | ||
- name: backend | ||
# host: github | ||
# repo: https://github.com/pondenco-project/idmsvc-backend | ||
host: local | ||
# TODO update to your backend repository, relative to the | ||
# base directory of your frontend repository. | ||
repo: ../idm-domains-backend | ||
path: deployments/clowder.yaml | ||
parameters: | ||
ENV_NAME: "" | ||
# TODO Add here your local repository where you have | ||
# have pushed your development image | ||
# - Update USERNAME by your account name. | ||
# - Update 'hmsidm-backend' by the name of the quay.io | ||
# repository which you created. | ||
IMAGE: "quay.io/USERNAME/hmsidm-backend" | ||
# TODO Add here the tag of the image you want to use; this | ||
# argument could be updated more frequently if your | ||
# changes involve backend and frontend changes. | ||
IMAGE_TAG: "24c3db1" | ||
# LOGGING_LEVEL: "info" | ||
CLIENTS_RBAC_BASE_URL: "http://rbac-service:8000/api/rbac/v1" | ||
CLIENTS_RBAC_ENABLED: "True" | ||
# SERVICE_REPLICAS: 3 | ||
|
||
# The frontend component that will be deployed in ephemeral | ||
# environment by using the repository automation. | ||
- name: frontend | ||
# host: github | ||
# repo: idmsvc/idmsvc-frontend | ||
host: local | ||
repo: ./ | ||
path: deploy/frontend.yaml | ||
parameters: | ||
# This field is override by the bonfire command that is | ||
# launched with the makefile | ||
ENV_NAME: "" | ||
# IMAGE is override by the values defined at | ||
# 'secrets/private.mk and | ||
# scripts/mk/variables.mk | ||
IMAGE: "quay.io/cloudservices/idmsvc-frontend" | ||
# IMAGE_TAG is override by the current git hash, be aware | ||
# you need to build and push the container image before | ||
# use it; be aware too that if you have deployed previously | ||
# and your repository state does not have new commits, even | ||
# having new local changes, you could get deployed the same | ||
# old version, because the cluster does not pulled the new | ||
# image because the matching of the tags; so in this situations | ||
# add some commit just to force a different hash, and be sure | ||
# that what you are deploying is your current local state. | ||
IMAGE_TAG: "pr-24-5714d07" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-r requirements.txt | ||
wheel>=0.38.4,<0.39.0 | ||
pre-commit>=2.21.0,<2.22.0 | ||
crc-bonfire>=5.3.0,<5.4.0 | ||
json2yaml>=1.2.0,<1.3.0 | ||
yamlfix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
## | ||
# General rules for interacting with container | ||
# manager (podman or docker). | ||
## | ||
|
||
QUAY_EXPIRATION ?= 1d | ||
|
||
ifneq (,$(shell command podman -v 2>/dev/null)) | ||
CONTAINER_ENGINE ?= podman | ||
else | ||
ifneq (,$(shell command docker -v 2>/dev/null)) | ||
CONTAINER_ENGINE ?= docker | ||
else | ||
CONTAINER_ENGINE ?= false | ||
endif | ||
endif | ||
export CONTAINER_ENGINE | ||
|
||
CONTAINER_HEALTH_PATH ?= .State.Health.Status | ||
|
||
ifneq (,$shell(selinuxenabled 2>/dev/null)) | ||
CONTAINER_VOL_SUFFIX ?= :Z | ||
else | ||
CONTAINER_VOL_SUFFIX ?= | ||
endif | ||
|
||
CONTAINER_REGISTRY_USER ?= $(USER) | ||
CONTAINER_REGISTRY ?= quay.io | ||
CONTAINER_CONTEXT_DIR ?= . | ||
CONTAINERFILE ?= build/package/Dockerfile | ||
CONTAINER_IMAGE_BASE ?= $(CONTAINER_REGISTRY)/$(CONTAINER_REGISTRY_USER)/$(APP_NAME) | ||
CONTAINER_IMAGE_TAG ?= $(shell git rev-parse --short HEAD) | ||
CONTAINER_IMAGE ?= $(CONTAINER_IMAGE_BASE):$(CONTAINER_IMAGE_TAG) | ||
# CONTAINER_BUILD_OPTS | ||
# CONTAINER_ENGINE_OPTS | ||
# CONTAINER_RUN_ARGS | ||
|
||
.PHONY: registry-login | ||
registry-login: | ||
$(CONTAINER_ENGINE) login -u "$(CONTAINER_REGISTRY_USER)" -p "$(CONTAINER_REGISTRY_TOKEN)" $(CONTAINER_REGISTRY) | ||
|
||
.PHONY: container-build | ||
container-build: ## Build image CONTAINER_IMAGE from CONTAINERFILE using the CONTAINER_CONTEXT_DIR | ||
$(CONTAINER_ENGINE) build \ | ||
--label "quay.expires-after=$(QUAY_EXPIRATION)" \ | ||
$(CONTAINER_BUILD_OPTS) \ | ||
-t "$(CONTAINER_IMAGE)" \ | ||
$(CONTAINER_CONTEXT_DIR) \ | ||
-f "$(CONTAINERFILE)" | ||
|
||
.PHONY: container-shell | ||
container-shell: ## Open a terminal to check build steps | ||
$(CONTAINER_ENGINE) run --rm -it -u root:root \ | ||
-v $(PROJECT_DIR):/opt/app-root/src:rw,z \ | ||
--tmpfs /opt/app-root/src/node_modules:rw \ | ||
--tmpfs /opt/app-root/src/.npm:rw \ | ||
registry.redhat.io/rhel9/nodejs-16:1-138.1699550438 \ | ||
/bin/bash | ||
|
||
.PHONY: container-push | ||
container-push: ## Push image to remote registry | ||
$(CONTAINER_ENGINE) push "$(CONTAINER_IMAGE)" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How about you group the copies and make their target paths explicit. This makes the
src/src
subdir a bit less confusing, too.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 see your point! the reason I did on this way is to take advantage of the build cache; this is useful when deploying the container in ephemeral environment, so the dependencies (npm install) will use the cache unless I change the package*.json ; so I can get a container image pushed and ready to be deployed quicker.
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.
@tiran ey mate! quick reminder about the conversation; would the comment above resolve the concern?