Report this

What is the reason for this report?

Best practices for writing App Spec file with multiple environments

Posted on May 31, 2022

Hello, I’m working on writing a YAML App Spec file for a Node api application. I haven’t come across any examples that show how to handle the scenario of deploying multiple environments, such as a test, staging, and production environment. Is there a common best practice way of doing this? Should I just have three entries under “services” in the spec file that use the same repo or image but use different branches or tags? If I did, is it common to “namespace” the service names with the environment, such as “my-app-prod-”, “my-app-staging”, etc?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Yes, your understanding is correct. It’s common to “namespace” your service names with the environment such as “my-app-prod”, “my-app-staging”, etc. This helps to identify and manage different versions of your application. You can indeed have multiple entries under “services” in your spec file using the same repo or image but with different branches or tags. These entries correspond to your different environments.

Please remember to set the appropriate environment variables and resource allocations for each environment as they may require different settings.

However, keep in mind, orchestration and automation of this process can also be achieved through CI/CD pipelines, making it easier to manage and control these environments.

For more information, check out the DigitalOcean Docs on App Platform:

https://docs.digitalocean.com/products/app-platform

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.