Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

As of 12/19/2024 All newly created Rancher Folio environments have telepresence installed by default, thus every development team can remotely connect via IDE and debug all things.

...

if everything went OK, you’ll see something as below

...

Environment file:variables

Modules deployed in Eureka environment require more env vars to be present on module startup in Intellij. Please find in IntelliJ when compared to the Okapi setup. When starting your module in IntelliJ make sure to extract the required environment variables (e.g. eureka-common, db-credentials and kafka-credentials) from your cluster into some .env file or individual env vars attached to IntelliJ run config.

...

Find and include additional env vars in your from the Rancher UI, these can be found under Storage > Secrets tab:

...

Or for the respective module you can determine which are required to be extracted and added into your local module environment variables, in Workloads > Pods > {{module_name}} > Config tab:

...

For example, for mod-orders we only require db-credentials and kafka-credentials to be extracted.

Also note that for Feign Client to work properly make sure to include this env var into your module environment:

SIDECAR_FORWARD_UNKNOWN_REQUESTS_DESTINATION=http://kong-{{namespace}}:8000

Environment variable extraction for an Okapi-based environment will follow the same pattern but may require changing the cluster from folio-edev to folio-dev on your Rancher UI.

Sidecar port-proxy:

In order for cross-module requests to perform correctly in your Eureka environment there must be a port proxy added to route all traffic from your local module instance deployed in IntellijIntelliJ, to localhost:8082 and then finally to the remote cluster itself. This rerouting is necessary to simulate a fully functional pod environment, where we have our module of interest and its companion sidecar accessible on localhost:8082 in the pod.

...

sudo lsof -i :8002

sudo kill -9 <PID>

...

Module interception

To start intercepting a module, configure the environment variables, and in case of Eureka, setup necessary port proxies, start the module instance in IntelliJ, and then finally run the following command:

telepresence intercept -p {{local_instance_port}}:http {{module_name}}

...

Your {{local_instance_port}} will correspond to the port number used to start the module instance in the IntelliJ as shown below:

...

A successful interception will have tel-agent-init terminated as Completed, traffic-agent left in Running status, and the module in question returning “OK” from its /admin/health endpoint:

...

After that you are all set test a feature or debug some issue with your local module instance now communicating directly with the modules deployed on Rancher.

Clean-up

Once your task is complete and interception no longer needed, please execute:

  • telepresence leave {{InterceptedSvcName}}

  • telepresence quit -s

If telepresence is failing to connect, please find all telepresence active\running process(es) on your system and stop them, then try to connect.

How to find active\running process(es) and terminate them:

...