flyrain commented on code in PR #1243:
URL: https://github.com/apache/polaris/pull/1243#discussion_r2010880130


##########
helm/polaris/README.md:
##########
@@ -96,35 +96,90 @@ eval $(minikube -p minikube docker-env)
 
 The below instructions assume a local Kubernetes cluster is running and Helm 
is installed.
 
+#### Common setup
+
 Create and populate the target namespace:
 
 ```bash
 kubectl create namespace polaris
 kubectl apply --namespace polaris -f helm/polaris/ci/fixtures/
+
+kubectl wait --namespace polaris --for=condition=ready pod 
--selector=app.kubernetes.io/name=postgres --timeout=120s
+```
+
+The `helm/polaris/ci` contains a number of values files that can be used to 
install the chart with
+different configurations.
+
+You can also run `ct` (chart-testing):
+
+```bash
+ct lint --charts helm/polaris
+ct install --namespace polaris --debug --charts ./helm/polaris
 ```
 
-Finally, install the chart. From Polaris repo root:
+Below are two sample deployment models for installing the chart: one with a 
non-persistent backend and another with a persistent backend.
+
+#### Non-persistent backend
+
+Install the chart with a non-persistent backend. From Polaris repo root:
 
 ```bash
 helm upgrade --install --namespace polaris \
   --debug --values helm/polaris/ci/simple-values.yaml \
    polaris helm/polaris
 ```
 
-The `helm/polaris/ci` contains a number of values files that can be used to 
install the chart with
-different configurations.
+#### Persistent backend
 
-You can also run `ct` (chart-testing):
+> [!WARNING]
+> The Postgres deployment set up in the fixtures directory is intended for 
testing purposes only and is not suitable for production use. For production 
deployments, use a managed Postgres service or a properly configured and 
secured Postgres instance.
+
+Install the chart with a persistent backend. From Polaris repo root:
 
 ```bash
-ct lint --charts helm/polaris
-ct install --namespace polaris --debug --charts ./helm/polaris
+helm upgrade --install --namespace polaris \
+  --debug --values helm/polaris/ci/persistence-values.yaml \
+  polaris helm/polaris
+
+kubectl wait --namespace polaris --for=condition=ready pod 
--selector=app.kubernetes.io/name=polaris --timeout=120s
+```
+
+After deploying the chart with a persistent backend, the `persistence.xml` 
file, originally loaded into the Kubernetes pod via a secret, can be accessed 
locally if needed. This file contains the persistence configuration required 
for the next steps. Use the following command to retrieve it:
+
+```bash
+kubectl exec -it -n polaris $(kubectl get pod -n polaris -l 
app.kubernetes.io/name=polaris -o jsonpath='{.items[0].metadata.name}') -- cat 
/deployments/config/persistence.xml > persistence.xml
+```
+
+The `persistence.xml` file references the Postgres hostname as postgres. 
Update it to localhost to enable local connections:
+
+```bash
+sed -i .bak 's/postgres:/localhost:/g' persistence.xml
 ```
 
-### Uninstalling the chart
+To access Polaris and Postgres locally, set up port forwarding for both 
services:
+```bash
+kubectl port-forward -n polaris $(kubectl get pod -n polaris -l 
app.kubernetes.io/name=polaris -o jsonpath='{.items[0].metadata.name}') 
8181:8181
+
+kubectl port-forward -n polaris $(kubectl get pod -n polaris -l 
app.kubernetes.io/name=postgres -o jsonpath='{.items[0].metadata.name}') 
5432:5432
+```

Review Comment:
   Not familiar with Helm chart, wondering if this could be automated. Not a 
blocker though.



##########
helm/polaris/README.md:
##########
@@ -96,35 +96,90 @@ eval $(minikube -p minikube docker-env)
 
 The below instructions assume a local Kubernetes cluster is running and Helm 
is installed.
 
+#### Common setup
+
 Create and populate the target namespace:
 
 ```bash
 kubectl create namespace polaris
 kubectl apply --namespace polaris -f helm/polaris/ci/fixtures/
+
+kubectl wait --namespace polaris --for=condition=ready pod 
--selector=app.kubernetes.io/name=postgres --timeout=120s
+```
+
+The `helm/polaris/ci` contains a number of values files that can be used to 
install the chart with
+different configurations.
+
+You can also run `ct` (chart-testing):
+
+```bash
+ct lint --charts helm/polaris
+ct install --namespace polaris --debug --charts ./helm/polaris
 ```
 
-Finally, install the chart. From Polaris repo root:
+Below are two sample deployment models for installing the chart: one with a 
non-persistent backend and another with a persistent backend.
+
+#### Non-persistent backend
+
+Install the chart with a non-persistent backend. From Polaris repo root:
 
 ```bash
 helm upgrade --install --namespace polaris \
   --debug --values helm/polaris/ci/simple-values.yaml \
    polaris helm/polaris
 ```
 
-The `helm/polaris/ci` contains a number of values files that can be used to 
install the chart with
-different configurations.
+#### Persistent backend
 
-You can also run `ct` (chart-testing):
+> [!WARNING]
+> The Postgres deployment set up in the fixtures directory is intended for 
testing purposes only and is not suitable for production use. For production 
deployments, use a managed Postgres service or a properly configured and 
secured Postgres instance.
+
+Install the chart with a persistent backend. From Polaris repo root:
 
 ```bash
-ct lint --charts helm/polaris
-ct install --namespace polaris --debug --charts ./helm/polaris
+helm upgrade --install --namespace polaris \
+  --debug --values helm/polaris/ci/persistence-values.yaml \
+  polaris helm/polaris
+
+kubectl wait --namespace polaris --for=condition=ready pod 
--selector=app.kubernetes.io/name=polaris --timeout=120s
+```
+
+After deploying the chart with a persistent backend, the `persistence.xml` 
file, originally loaded into the Kubernetes pod via a secret, can be accessed 
locally if needed. This file contains the persistence configuration required 
for the next steps. Use the following command to retrieve it:
+
+```bash
+kubectl exec -it -n polaris $(kubectl get pod -n polaris -l 
app.kubernetes.io/name=polaris -o jsonpath='{.items[0].metadata.name}') -- cat 
/deployments/config/persistence.xml > persistence.xml
+```
+
+The `persistence.xml` file references the Postgres hostname as postgres. 
Update it to localhost to enable local connections:
+
+```bash
+sed -i .bak 's/postgres:/localhost:/g' persistence.xml

Review Comment:
   Curious if we could change the value in persistence.yaml to `localhost`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to