shutterstock

Automating deployment pipelines is a great way to increase developer productivity and APIs are the easiest way to achieve that. In this blog, we will specifically talk about how developers can use REST APIs to interact with Portworx Data Services and in order to accelerate their deployment frequency and reduce the lead time for changes.

Organizations with higher developer productivity rates often outperform their competitors in the market. Developer productivity is basically the measure of how productive your developers are in any given period. Developers are the most expensive resource an organization has, so to get the most bang for the buck, you need to ensure that you are doing everything you can to increase developer productivity—achieving higher productivity rates will directly translate into better customer experience, leading to lower churn and lower customer acquisition costs.

Developer Productivity

For the past four years, the State of DevOps Report from DORA (DevOps Research and Assessment) has clearly laid out four key metrics to measure software delivery performance. They are

  • Deployment frequency 
  • Lead time for changes 
  • Change failure rate 
  • Time to restore service

In addition to these four, DORA has identified a fifth key metric: reliability to measure operational performance. Organizations are always trying to move from the lower end of the spectrum to the higher/elite end, and there are a few key ways to do that:

  • Increasing deployment frequency (how often you can push new code to production)  from once per month or once every six months to multiple deploys per day
  • Reducing lead time for changes (how long it takes to go from code committed to code running in production) from once per month or once every six months to once a day or once a week
  • Reducing change failure rate (the percentage of changes that lead to a service incident that requires remediation) from 46–60% to 0–15%
  • Reducing time to restore service (how long it takes to restore service after an incident) from one week or one month to less than a day.

Note: Improving these software delivery performance metrics won’t increase your organizational performance if your operational performance or reliability is low (e.g., it won’t matter that you are pushing new features to end users if they aren’t able to access your application reliably).

Improve Developer Productivity Using Portworx Data Services 

Portworx Data Services is a database platform as-a-service solution that allows users to deploy data services on any Kubernetes cluster using either a UI-based or a REST API-based workflow. Either of these approaches can be used as the unified way to deploy data services like PostgreSQL, MongoDB, Apache Kafka, Redis, MySQL, and others on Kubernetes clusters running on-prem or in the public cloud. Since REST APIs allow developers to perform operations programmatically these data services can be integrated into application deployment pipelines. Additionally, scale-out and backup procedures can be automated through REST APIs for further application lifecycle management. Portworx Data Services also eliminates the need for the developer to learn Kubernetes in depth—which results in significant time savings for  developers, as they don’t need to go through a huge learning curve to understand how Kubernetes works or how to deploy or maintain data services on Kubernetes. 

Using REST APIs to interact with Portworx Data Services, developers can use any programming languages that support common HTTP(s) requests to deploy production-grade data services on Kubernetes clusters—without ever having to access the underlying Kubernetes cluster. Developers can also use REST APIs to integrate with existing tools that they might be using as part of their CICD pipelines.

REST APIs with Portworx Data Services

To interact with PDS using REST APIs, a developer simply needs to generate an API key or token that they can use to authenticate with the PDS API Server. To generate a new token, navigate to the Portworx Data Services control plane and click on Profile from the bottom left section of the screen. 

pds-rest-1-1536x1440

You can monitor all the previously generated keys from this page, or you can also create a new key to interact with the PDS API Server.

pds-rest-2-1536x387

To create a new key, click + New Key on the right and then enter a name and select the expiration period for the key. Generating a key with an expiration allows users to enforce key rotation to keep access to PDS secured.

pds-rest-3-1536x1401

Once you have created a new key, you can use it in your REST calls to execute GET, PUT, DELETE or POST calls against the PDS API Server. 

If you are just getting started with PDS REST APIs, Portworx also offers a Swagger interface to help you learn more about the different APIs available to perform Day 0 and Day 2 operations for your data services running on Kubernetes. 

Once you access the Swagger interface, you can authenticate using the API key that you created in Step 3 and use any APIs to test and generate CURL commands to use in your scripts. 

pds-rest-4-1536x728

Here are a few examples of CURL commands to help you get started:

#Get Deployment Target 
curl -X 'GET' \
'https://prod.pds.portworx.com/api/projects/<<project-id>>/deployment-targets' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <<api key>>'

#Get Namespaces on Deployment Target 
curl -X 'GET' \
  'https://prod.pds.portworx.com/api/deployment-targets/<<deploy-target-id>>/namespaces' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <<api key>>'

#Deploy PostgreSQL on Amazon EKS
curl -X 'POST' \
  'https://prod.pds.portworx.com/api/projects/<<project-id>>/deployments' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <<api key>>' \
  -H 'Content-Type: application/json' \
  -d '{
  "application_configuration_template_id": "<<app-template-id>>",
  "deployment_target_id": "<<deploy-target-id>>"
  ],
  "name": "pg-rest",
  "image_id": "<<image-id>>",
  "namespace_id": "<<namespace-id>>",
  "node_count": 3,
  "resource_settings_template_id": "<<resource-setting-id>>",
  "scheduled_backup": {
    "backup_policy_id": "<<backup-policy-id>>",
    "backup_target_id": "<<backup-target-id>>"
  },
  "storage_options_template_id": "<<storage-option-id>>"
}'

If you would like to see more, you can also check out the demo below that walks you through the whole process of generating an API key, using that to deploy a PostgreSQL database instance on an Amazon EKS cluster, and using that database as the backend for a demo stateful application.

Conclusion

Developer productivity is an important metric to improve when you are looking to propel your business forward. Using solutions like Portworx Data Services, you can reduce the time your developers need to wait for resources to be provisioned. To learn more about Portworx Data Services and the features it provides, check out the other blogs on our website.

Share
Subscribe for Updates

About Us
Portworx is the leader in cloud native storage for containers.

Bhavin

Bhavin Shah

Sr. Technical Marketing Manager | Cloud Native BU, Pure Storage
link
px_containers
April 3, 2023 How To
Run Kafka on Kubernetes with Portworx Data Services
Eric Shanks
Eric Shanks
link
Kubernetes
March 15, 2023 How To
Kubernetes Automated Data Protection with Portworx Backup
Jeff Chen
Jeff Chen
link
Blog Placeholder
October 19, 2022 How To
Deploying MySQL on Kubernetes with Portworx Data Services
Jeff Chen
Jeff Chen