Skip to content

Organize config in a large project

Madhan Sadasivam edited this page Nov 1, 2016 · 10 revisions

Organize config in a large project

Apigee Config like KVM, Cache, target servers etc., is better managed when it is automated and tracked in source control repository. Config needs to live close to the corresponding API, but with large projects config is typically shared between multiple API proxies.

API proxies can be usually grouped into "projects" or "features" that directly reflect the project, team or business structure in an enterprise. You can also find that config is shared within the proxies in a "project".

The file structure below reflects this hierarchical relationship (enterprise -> projects -> API proxies)

gateway
├── config
│   └── edge.json             # Config that is shared across projects
└── payments                  # ---- Project ----
    ├── config
    │   └── edge.json         # Config that is shared across proxies in project
    ├── proxyname1
    │   └── apiproxy
    │       ├── config.json
    │       ├── policies
    │       ├── proxies
    │       ├── proxyname1.xml
    │       ├── resources
    │       │   ├── java
    │       │   ├── jsc
    │       │   └── node
    │       └── targets
    └── proxyname2
        └── apiproxy
            ├── config.json
            ├── policies
            ├── proxies
            ├── proxyname2.xml
            ├── resources
            │   ├── java
            │   ├── jsc
            │   └── node
            └── targets

Further organization for even larger config files

When an Apigee instance has several environments, the edge.json can get longer. In such cases edge.json can be further broken reflect "env" in Apigee org.

Remember that Apigee config has 3 scopes: org, env, API. Only the "env" scoped config can be broken down into additional files. "org" and "API" config needs to continue in edge.json placed in an appropriate high-level folder.

There is only one JSON structure for both edge.json and _edge.json. The _edge.json does not contain "orgConfig" and "apiConfig" element.

Given below is a sample folder structure that uses env names from Apigee org. (Note: the support for env_edge.json is a proposed feature and the plugin will support it in the future).

gateway
│   └── edge.json               # Global scoped config (Org KVM, API Products etc.,)
├── config
|   ├── dev_edge.json           # dev env config (KVM, Cache etc.,)
|   ├── test_edge.json          # test env config (KVM, Cache etc.,)
|   ├── uat_edge.json           # uat env config (KVM, Cache etc.,)
|   ├── svt_edge.json           # svt config (KVM, Cache etc.,)
|   ├── staging_edge.json       # staging env config (KVM, Cache etc.,)
│   └── prod_edge.json          # prod env config (KVM, Cache etc.,)
└── payments                    # ---- Project ----
    ├── config
    |   ├── dev_edge.json       # Project specific dev env config (KVM, Cache etc.,)
    |   ├── test_edge.json      # Project specific test env config (KVM, Cache etc.,)
    |   ├── uat_edge.json       # Project specific uat env config (KVM, Cache etc.,)
    |   ├── svt_edge.json       # Project specific svt env config (KVM, Cache etc.,)
    |   ├── staging_edge.json   # Project specific staging env config (KVM, Cache etc.,)
    │   └── prod_edge.json      # Project specific prod env config (KVM, Cache etc.,)
    ├── proxyname1
    │   └── apiproxy
    │       ├── config.json
    │       ├── policies
    │       ├── proxies
    │       ├── proxyname1.xml
    │       ├── resources
    │       │   ├── java
    │       │   ├── jsc
    │       │   └── node
    │       └── targets
    └── proxyname2
        └── apiproxy
            ├── config.json
            ├── policies
            ├── proxies
            ├── proxyname2.xml
            ├── resources
            │   ├── java
            │   ├── jsc
            │   └── node
            └── targets

Note: Do not break down edge.json by env if your config is manageable in a single edge.json file. A single file allows easy search and manual verification of the file while keeping the folder structure concise.

The plugin will take a new optional configFile parameter to pick edge.json or _edge.json files.

mvn install -Ptest -DconfigFile=./config/dev_edge.json
Clone this wiki locally