Skip to content
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

Migrate from zeebe-node to @camunda8/sdk #4817

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open

Conversation

abdul99ahad
Copy link
Contributor

@abdul99ahad abdul99ahad commented Feb 4, 2025

Closes #4109

Proposed Changes

Migrated client from zeebe-node (deprecated) to camunda8-sdk

How to test

Camnda 8 SaaS

Docs: https://docs.camunda.io/docs/components/modeler/desktop-modeler/connect-to-camunda-8/

Camunda 8 Self-Managed

Authentication: None

Checkout https://github.com/camunda/zeebe-connection-test. Here you can spin up the docker environment with environment variables and certificates to test the connection

Insecure Connection (without SSL)

# (once) ensure the configured hostname resolves to 127.0.0.1
ZEEBE_HOSTNAME=sub.example.com sh -c 'echo "127.0.0.1    $ZEEBE_HOSTNAME"' | sudo tee -a /etc/hosts

ZEEBE_HOSTNAME=sub.example.com docker compose --env-file .env.insecure up

Secure Connection (with SSL)

# (once) ensure the configured hostname resolves to 127.0.0.1
ZEEBE_HOSTNAME=sub.example.com sh -c 'echo "127.0.0.1    $ZEEBE_HOSTNAME"' | sudo tee -a /etc/hosts

# start zeebe with security enabled
ZEEBE_HOSTNAME=sub.example.com docker compose up zeebe

To test with the Camunda Modeler pass the custom SSL root certificate use the --zeebe-ssl-certificate flag:

camunda-modeler --zeebe-ssl-certificate=cert/root.crt

Authentication: Basic

Checkout this branch #basic-auth (https://github.com/camunda/zeebe-connection-test/tree/basic-auth)
For this to test, create a secure connection via reverse proxy
creds: demo:demo
port: 8181

# (once) ensure the configured hostname resolves to 127.0.0.1
ZEEBE_HOSTNAME=sub.example.com sh -c 'echo "127.0.0.1    $ZEEBE_HOSTNAME"' | sudo tee -a /etc/hosts

# start zeebe with security enabled
ZEEBE_HOSTNAME=sub.example.com docker compose --env-file .env.proxy up zeebe proxy

source: https://github.com/camunda/zeebe-connection-test/blob/basic-auth/README.md

Authentication: OAuth

Same as Camunda SAAS, just select Camunda self managed with OAuth

Tip

TL;DR: You can use zeebe-connection-test to test the sdk.

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Feb 4, 2025
Copy link

github-actions bot commented Feb 4, 2025

This Pull Request targets develop branch, but contains fix commits.

Consider targeting main instead.

@abdul99ahad abdul99ahad marked this pull request as draft February 4, 2025 12:29
@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Feb 4, 2025
@abdul99ahad abdul99ahad force-pushed the sdk/camunda8 branch 2 times, most recently from 7d23799 to ba2d1ff Compare February 4, 2025 14:29
@abdul99ahad abdul99ahad force-pushed the sdk/camunda8 branch 13 times, most recently from 759cbe7 to 6b5884a Compare February 11, 2025 15:31
@abdul99ahad abdul99ahad changed the title Sdk/camunda8 migration: sdk/camunda8 Feb 11, 2025
@abdul99ahad abdul99ahad marked this pull request as ready for review February 12, 2025 12:58
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Feb 12, 2025
@abdul99ahad abdul99ahad requested review from barmac, nikku and philippfromme and removed request for barmac and nikku February 12, 2025 13:02
@philippfromme philippfromme changed the title migration: sdk/camunda8 Migrate from zeebe-node to @camunda8/sdk Feb 12, 2025
@@ -2456,6 +2473,10 @@ function setupPlatformStub() {
});
}

function extractUrlWithoutProtocol(url) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not duplicate this helper and maybe also make it a bit more forgiving:

function removeProtocol(url) {
  const urlObject = new URL(url);
  return urlObject.host + urlObject.pathname;
}

@@ -178,6 +178,9 @@ export default class DeploymentPluginOverlay extends React.PureComponent {
if (endpoint.targetType === CAMUNDA_CLOUD && endpoint.camundaCloudClusterUrl) {
endpoint.camundaCloudClusterId = extractClusterId(endpoint.camundaCloudClusterUrl);
endpoint.camundaCloudClusterRegion = extractClusterRegion(endpoint.camundaCloudClusterUrl);

// required by camunda8/sdk
endpoint.camundaZeebeAddress = extractUrlWithoutProtocol(endpoint.camundaCloudClusterUrl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say let's not add the URL minus the protocol everywhere. We have the full URL anyway and we can remove the protocol when creating the Zeebe GRPC client.

@@ -1401,12 +1402,10 @@ describe('ZeebeAPI', function() {

// given
const zeebeAPI = mockCamundaClient({
ZBClient: function() {
return {
ZBClient: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this configuration for clarity to something like zeebeGrpcApiClient which is what this configuration is for.

@@ -39,11 +39,13 @@ describe('<ZeebeAPI>', function() {
const zeebeAPI = new ZeebeAPI(backend);

const contactPoint = 'contactPoint';
const contactPointWithoutProtocol = 'contactPointWithoutProtocol';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this commit changes tests only. It's much easier for the reviewer if changes and the respective tests are bundled together.

@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Currently worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate from zeebe-node to @camunda8/sdk
2 participants