For local development a postgresql database is needed. The file local/docker-compose-dev-postgres.yaml provides a postgres that can be started freshly for development:
cd local
# create .env manually or run sh generate-keys.sh
docker compose -f docker-compose-dev-postgres.yaml up
# update your application.properties (src) accordingly to user and password
# work as you want. Shutdown database if needed:
docker compose -f docker-compose-dev-postgres.yaml down
NOTE: For testing purposes HyperSql is still used but excluded for spring run. ll
Navigate to the ./backend
folder and run:
mvn org.eclipse.dash:license-tool-plugin:license-check
This line runs the maven license tool with the parameters specified in the
./backend/pom.xml
and produces a DEPENDENCIES_BACKEND
file in the root folder of this project.
# move to a persistent folder. Could also be ~/jars.
mv org.eclipse.dash.licenses-1.0.2.jar ~/coding/org.eclipse.dash.licenses-1.0.2.jar
vim ~/.bashrc
# add following line using i
alias eclipseDashTool='java -jar ~/coding/org.eclipse.dash.licenses-1.0.2.jar'
# esc, qw -> enter to save and exit
source ~/.bashrc
# cd to puris-frontend
cd frontend
eclipseDashTool package-lock.json -project automotive.tractusx -summary ../DEPENDENCIES_FRONTEND
Temprorary also the mock-util-service needs to be kept up to date. First add the alias same as for frontend to your
.bashrc
and then use the following command:
cd local/iam-mock
cat requirements.txt | grep -v \# \
| sed -E -e 's|([^= ]+)==([^= ]+)|pypi/pypi/-/\1/\2|' -e 's| ||g' \
| sort | uniq \
| eclipseDashTool -summary DEPENDENCIES -
Note: Dash action provided by eclipse-tractusx/sig-infra does not provide to opportunity for python.
.env
has vite variables.env.dockerbuild
has the vite variable that maps on an environment variable (VITE_BACKEND_BASE_URL=$BACKEND_BASE_URL
)src/config.json
has the environment variable names and the environment variable to substring in a json format.
.env.dockerbuild
is used- vite / vue builds the application into a dest folder, that will be served by nginx
Result for the .env:
VITE_BACKEND_BASE_URL won't write a variable value BUT a placeholder into the built files ( $BACKEND_BASE_URL)
- Collects the environment variables (set for the docker container / set via helm as
BACKEND_BASE_URL
) - Looks-up the "to replace string" from
config.json
(e.g., forBACKEND_BASE_URL
, it will search for$BACKEND_BASE-URL
in the built files) - Does the replacement in the built files
- Starts nginx
Different to installations from the official repo (see e.g. Helm README.md), you need to first install dependencies.
cd ../charts/puris
helm repo add bitnami https://charts.bitnami.com/bitnami
helm dependency update
Then install the application to your needs:
Precondition: please refer to your runtime environment's official documentation on how to enable ingress.
Run the application
helm install puris . \
--namespace puris \
--create-namespace \
--set frontend.ingress.enabled=true \
--set backend.ingress.enabled=true
Edit /etc/hosts:
# If you are using minikube use minikube ip to get you clusterIp, for kind this is localhost (127.0.0.1)
sudo vim /etc/hosts
>> add entry for frontend "<cluster ip> <frontend-url.top-level-domain>"
>> add entry for backend "<cluster ip> <backend-url.top-level-domain>"
>> :wq! (save changes)
Done! The applications should be available at:
- (frontend)
http://your-frontend-host-address.com
- (backend)
http://your-backend-host-address.com
NOTE
Ingress must be enabled for your runtime once per cluster installation. /etc/hosts adoption once per system / url
helm install puris . \
--namespace puris \
--create-namespace
Forward ports for services:
kubectl -n puris port-forward svc/frontend 8080:8080
kubectl -n puris port-forward svc/backend 8081:8081
Done! The applications should be available at http://localhost:<forwarded-port>
.
When changing the helm charts due to changes of e.g. environment variables, one should test locally whether the changes work.
First thing one should check is whether the templates may be resolved / substituted correctly and if your changes are defaulted correctly:
cd charts/puris
helm template .
>> no error is thrown, chart is resolved, changes are done correctly
Now build your images as explained in the respective install.mds.
Now you need to update your Chart.yml and values.yml:
- Chart.yml: change
appVersion
to your build tag (e.g.,dev
) - values.yml: for both frontend and backend change the image
repository
should be set to the image name used during docker build (e.g.,puris-backend
,puris-frontend
)pullPolicy
should be set toNever
Now depending on your runtime environment you need to load the images into it (we assume, you built puris-backend:dev and (puris-frontend:dev):
# minikube
minikube image load puris-backend:dev
minikube image load puris-frontend:dev
# validate that your image is listed and compare digest with local image
minikube image ls --format table | grep puris-backend
docker image ls | grep puris-backend
minikube image ls --format table | grep puris-frontend
docker image ls | grep puris-frontend
# kind
kind load puris-backend:dev
kind load puris-frontend:dev
# validate that your image is listed and compare digest with local image
docker ps
>> locate the container-id of you kind cluster
docker exec -it {container-id} crictl images | grep puris-backend
docker image ls | grep puris-backend
docker exec -it {container-id} crictl images | grep puris-frontend
docker image ls | grep puris-frontend
ATTENTION: MAKE SURE THAT THE IMAGE ID IN YOUR KUBERNETES ENVIRONMENT IS THE SAME AS IN YOUR LOCAL DOCKER.
Else you can delete images as follows:
# minikube
minikube image delete puris-backend:dev
minikube image delete puris-frontend:dev
# kind
ocker ps
>> locate the container-id of you kind cluster
docker exec -it {container-id} crictl rmi puris-backend:dev
docker exec -it {container-id} crictl rmi puris-frontend:dev
This work is licensed under the Apache-2.0.
- SPDX-License-Identifier: Apache-2.0
- SPDX-FileCopyrightText: 2024 Contributors to the Eclipse Foundation
- Source URL: https://github.com/eclipse-tractusx/puris