Typical API lifecycle
As discussed here, it is likely that you have many stages to your API lifecycle. These are probably managed through Continuous Integration.
Lets say that the stages of your lifecycle look like this:
Stage | Purpose |
Development | Where the coding happens, probably against mocks |
Integration | Integration against test backend systems |
User Acceptance Testing | Functional testing by Product Owners and business folks |
Non-functional Testing | Performance and penetration testing |
Pre-production | Production-like environment for Certificate, Virtual Host, Cache and KVM checks |
Sandbox | API consumers build against production-like APIs in an isolated environment |
Production | Go live! |
It would be nice if our Apigee environments can mimic this.
Initial solutions
Bad solutions
Alternative solution: Pseudo-environments!
The Apigee Edge platform identifies which API to hit using the combination of Virtual Host and Base Path. Since a Virtual Host is associated with an environment, this is how we typically manage each stage of the lifecycle.
For example:
API Proxy | Environment | Virtual Host Alias | Base Path |
proxy-v1 | test | myapi-test-apigee.net | /v1/something |
proxy-v1 | prod | myapi-prod-apigee.net | /v1/something |
However, if we want to have multiple Pseudo-environments in an Apigee environment, we can use different Base Paths.
Here is how we can deploy the 7 stages of our API Development Lifecycle into two environments:
Stage | API Proxy | Environment | Virtual Host Alias | Base Path |
Dev | proxy-v1-dev | test | myapi-test-apigee.net | /v1-dev/something |
Integration | proxy-v1-intg | test | myapi-test-apigee.net | /v1-intg/something |
User Acceptance Testing | proxy-v1 | test | myapi-test-apigee.net | /v1/something |
Non-Functional Testing | proxy-v1-perf | test | myapi-test-apigee.net | /v1-perf/something |
Pre-production | proxy-v1-preprod | prod | myapi-prod-apigee.net | /v1-pre/something |
Sandbox | proxy-v1-sandbox | prod | myapi-prod-apigee.net | /v1-sandbox/something |
Production | proxy-v1 | prod | myapi-prod-apigee.net | /v1/something |
Build Tools
We can of course use build tools and continuous integration to automate the promotion through each stage. For instances, using the Apigee Maven Deploy plugin, you can create a different Profile for each stage. There is an example of this here.
This allows you to pass the profile in to the deploy command, such as:
mvn install -Psandbox
Please comment to let me know what you think - especially if you have a better name than 'Pseudo-environments'!!