DigitalOcean App Platform Now Supports Environment Streamlining

NewsDigitalOcean App Platform Now Supports Environment Streamlining

Managing an ever-expanding application portfolio can become a daunting task for developers, especially as the boundaries between production, staging, and new feature deployments start to blur. As portfolios grow, keeping track of which application serves which purpose can become a significant organizational challenge. To address this complexity, DigitalOcean has introduced a robust solution: Environment Support for DigitalOcean App Platform, powered by DigitalOcean Projects. This update also includes a new feature known as App Cloning, which enables developers to replicate their applications with just a few clicks.

The new feature allows developers to tag their resource groups, called Projects, with specific environments such as Development, Staging, or Production. Once tagged, App Platform apps can be assigned to these projects. This setup provides a high-level, filterable view of the entire application landscape directly from the control panel or via the command-line interface (CLI).

The underlying logic of this feature is straightforward yet effective:

  1. A Project acts as a container for your resources. Within a Project, you can group various components like Droplets, Load Balancers, Databases, and App Platform Apps.
  2. Projects can now be assigned an environment designation, formally indicating the project’s purpose.
  3. An App Platform App is then assigned to a specific Project.

    By leveraging these components, applications can be associated with environments, leading to clearer organization, improved cost management, and enhanced scripting and automation capabilities.

    This entire process can be managed directly from the DigitalOcean Control Panel. When creating a new project, users will notice a new "Environment" dropdown menu. This menu allows the selection of an environment designation, such as Development, Staging, or Production, to define the project’s role. Once a project is created, it can be selected during the App Platform app creation process, and all resources for that app will be linked to the environment-tagged project.

    For developers who prefer working from the terminal, the workflow is fully supported by doctl, DigitalOcean’s command-line tool. Here’s a step-by-step guide on how to implement this feature:

    Step 1: Create an Environment-Tagged Project
    Begin by creating a new project via the doctl command-line tool. The creation command includes an --environment flag that accepts values like Development, Staging, or Production.

    Example command:
    bash<br /> doctl projects create --name "saas-staging-project" \<br /> --purpose "Staging environment for our main SaaS app" \<br /> --environment "Staging"<br />

    Upon successful creation, take note of the Project ID for future reference.

    Step 2: Create an App and Assign it to the Project
    When creating a new App Platform app, use the --project-id flag to assign it to the project created in Step 1.

    Example command:
    bash<br /> doctl apps create --spec /path/to/my-staging-app.yaml \<br /> --project-id "c4f2b0a8-6f17-4e6f-9b8f-1a2b3c4d5e6f"<br />

    The new app will now be organizationally linked to the "Staging" environment.

    Step 3: Find an App’s Environment
    To find the environment for an app that has already been deployed, you can use two API calls to retrieve this information. By chaining these calls together using doctl and jq, you can easily extract the desired information.

    Example command:
    bash<br /> APP_ID="01c03d96-43bb-4da9-ba54-0b215c44a498"; doctl projects get $(doctl apps get "$APP_ID" -o json | jq -r '.[0].project_id') -o json| jq -r --arg APP_ID "$APP_ID" '.[0] | "App ID: \($APP_ID)\nProject: \(.name)\nEnvironment: \(.environment)"'<br />

    The output will provide a summary of the app’s project and environment, offering a powerful and scriptable way to confirm an app’s environment directly from the terminal.

    The ease of managing environments is further enhanced by the introduction of another new feature: App Cloning. This capability allows developers to quickly replicate an application to set up a new environment. From the app’s main page, simply select the “Actions” menu and choose “Clone app.” This action leads to a creation wizard pre-filled with all the settings from the original app, including components, configuration, and non-encrypted environment variables.

    This customizable template allows changes to be made to the new app during the cloning process, including modifications to source code, instance size, build commands, environment variables, datacenter region, VPC settings, and the app name. For example, if the goal is to create a new testing environment, simply clone the production app, and in the "Clone App" wizard, make the necessary adjustments:

  4. Change the Project to your "Staging" or "Development" project.
  5. Update the Environment Variables to point to your development database or staging API keys.
  6. Assign a new name, such as my-app-staging.

    These updates make it faster and more reliable to create parallel environments for development, testing, or feature branches.

    The integration of App Platform with environment-aware Projects, coupled with the new App Cloning workflow, represents a significant step toward simplifying the management of complex application deployments. This setup allows developers to easily determine which apps serve which purposes, reducing the risk of costly mistakes and enabling the creation of more robust automation for continuous integration and continuous deployment (CI/CD) pipelines.

    To learn more about these features, you can visit DigitalOcean’s official website. These advancements in environment management and app cloning are bound to enhance the efficiency of development teams, providing a streamlined approach to handling large and complex application portfolios.

For more Information, Refer to this article.

Neil S
Neil S
Neil is a highly qualified Technical Writer with an M.Sc(IT) degree and an impressive range of IT and Support certifications including MCSE, CCNA, ACA(Adobe Certified Associates), and PG Dip (IT). With over 10 years of hands-on experience as an IT support engineer across Windows, Mac, iOS, and Linux Server platforms, Neil possesses the expertise to create comprehensive and user-friendly documentation that simplifies complex technical concepts for a wide audience.
Watch & Subscribe Our YouTube Channel
YouTube Subscribe Button

Latest From Hawkdive

You May like these Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.