|
| 1 | +# Apigee Edge to X Migration Tool |
| 2 | + |
| 3 | +## Introduction |
| 4 | +The **Apigee Edge to X Migration Tool** is designed to facilitate the seamless transition of entities from Apigee Edge to the new Apigee X platform. This tool streamlines the migration process, ensuring minimal disruption and optimal performance during the transition. |
| 5 | + |
| 6 | +## Features |
| 7 | +- **Automated Migration:** Effortlessly migrate your entities from Edge to X. |
| 8 | +- **Custom Module Support:** Extend functionality by adding custom modules. |
| 9 | +- **User-Friendly Interface:** Navigate through the migration tool with an intuitive prompts menu. |
| 10 | +- **Comprehensive Logging:** Track the migration process with detailed logs for troubleshooting and analysis. |
| 11 | + |
| 12 | +## Prerequisites |
| 13 | +- **Node.js:** Ensure Node.js is installed on your system. |
| 14 | +- **Git:** Required for cloning repositories and managing version control. |
| 15 | +- **Access:** |
| 16 | + - Edge credentials with atleast Read-Only privileges |
| 17 | + - Apigee X Service Account Key |
| 18 | + |
| 19 | +## Setup Instructions |
| 20 | + |
| 21 | +1. **Clone the Repository** |
| 22 | + - Clone the `apigee/devrel` repository to your local machine: |
| 23 | + ```bash |
| 24 | + git clone <git-repo-url> |
| 25 | + ``` |
| 26 | + |
| 27 | +2. **Checkout the Relevant Branch** |
| 28 | + - For the release version, checkout the `main` branch: |
| 29 | + ```bash |
| 30 | + git checkout main |
| 31 | + ``` |
| 32 | + |
| 33 | +3. **Custom Modules** |
| 34 | + - Custom Modules built in-line to the framework can be used to extend the features. |
| 35 | + - If there are any custom modules, add the code base under `src/modules`. |
| 36 | + |
| 37 | +4. **Environment Setup** |
| 38 | + - `.env` file is required with below information |
| 39 | + ```bash |
| 40 | + # Configure the source gateway type: |
| 41 | + # - apigee_edge |
| 42 | + # - apigee_x |
| 43 | + source_gateway_type="apigee_edge" |
| 44 | +
|
| 45 | + # Configure the base URL for the source gateway's management APIs |
| 46 | + source_gateway_base_url="https://api.enterprise.apigee.com/v1/organizations/" |
| 47 | +
|
| 48 | + # When source gateway is Apigee, configure the name of the Apigee org |
| 49 | + source_gateway_org="<edge-org>" |
| 50 | +
|
| 51 | + # When source gateway is Apigee X, configure the service account |
| 52 | + # used to connect to management APIs. Base64 encode the service account JSON. |
| 53 | + # Ignore if source_gateway_type="apigee_edge" |
| 54 | + source_gateway_service_account = "" |
| 55 | +
|
| 56 | + # Configure the destination gateway type: |
| 57 | + # - apigee_edge |
| 58 | + # - apigee_x |
| 59 | + destination_gateway_type="apigee_x" |
| 60 | +
|
| 61 | + # Configure the base URL for the destination gateway's management APIs |
| 62 | + destination_gateway_base_url="https://apigee.googleapis.com/v1/organizations/" |
| 63 | +
|
| 64 | + # When destination gateway is Apigee, configure the name of the Apigee org |
| 65 | + destination_gateway_org="<apigee-x-org>" |
| 66 | +
|
| 67 | + # When destination gateway is Apigee X, configure the service account |
| 68 | + # used to connect to management APIs. Base64 encode the service account JSON. |
| 69 | + destination_gateway_service_account = "" |
| 70 | +
|
| 71 | + # When source and destination gateways are both Apigee, configure the mapping |
| 72 | + # between source gateway environment names to destination gateway environment names. |
| 73 | + apigee_environment_map='{"edge-env":"x-env"}' |
| 74 | +
|
| 75 | + # Configure whether to auto-npm-install plugins placed in the ~/src/modules folder |
| 76 | + install_modules = 1 |
| 77 | + ``` |
| 78 | + - Load Apigee Edge credentials into environment variables |
| 79 | + ```bash |
| 80 | + export source_gateway_username="<edge_username>" |
| 81 | + export source_gateway_password="<edge_password>" |
| 82 | + ``` |
| 83 | + - For building the value for `destination_gateway_service_account`, you need to build a JSON file in below structure and must base64encode. Copy the final result as value for `destination_gateway_service_account` |
| 84 | + ```json |
| 85 | + {"instance_type":"hybrid","organization":"<YOUR_PROJECT_ID>","account_json_key":<SERVICE_ACCOUNT_KEY_JSON>} |
| 86 | + ``` |
| 87 | + |
| 88 | + ```bash |
| 89 | + base64 <<< 'above_json_value' |
| 90 | + ``` |
| 91 | + |
| 92 | + |
| 93 | +## Execution Instructions |
| 94 | + |
| 95 | +1. **Open Terminal** |
| 96 | + - Open the terminal or command line interface in the `apigee-edge-to-x-migration-tool` directory. |
| 97 | + |
| 98 | +2. **Launch the Tool** |
| 99 | + - The tool features a setup helper `tool-setup.sh`. Provide execute permissions to the file. |
| 100 | + ```bash |
| 101 | + chmod +x tool-setup.sh |
| 102 | + ``` |
| 103 | + - Use the same for the initial set up and auto launch |
| 104 | + ```bash |
| 105 | + ./tool-setup.sh |
| 106 | + ``` |
| 107 | + |
| 108 | +3. **Run the Program** |
| 109 | + - After the initial launch, tool presents the Menu options. |
| 110 | + - Whenever you need to launch the tool without the setup helper, in your terminal use the command |
| 111 | + ```bash |
| 112 | + apigee-migration-tool |
| 113 | + ``` |
| 114 | +4. **Selecting from Menu** |
| 115 | + - Navigate through the program using the arrow keys. |
| 116 | + - Follow the instructions in the menu, user helper text for understanding the option. |
| 117 | + - Press `<enter>` to proceed with your selection. |
| 118 | + - At any time, use `Back` menu option to return to previous menu. |
| 119 | + - At any time, use `Exit` menu option to exit the tool. |
| 120 | + - Primary Action in tool. |
| 121 | + ```bash |
| 122 | + apigee-migration-tool |
| 123 | + ? Choose a tool (Use arrow keys) |
| 124 | + ❯ Apigee Edge to X |
| 125 | + ``` |
| 126 | + - Features available in the tool |
| 127 | + ```bash |
| 128 | + apigee-e2x |
| 129 | + ✔ Choose a tool Apigee Edge to X |
| 130 | + ? Action (Use arrow keys) |
| 131 | + ❯ Migrate |
| 132 | + View Logs |
| 133 | + ``` |
| 134 | + |
| 135 | +## Migrate |
| 136 | + - Menu option to be selected for migrating entities from Apigee Edge to X. |
| 137 | +### Supported Apigee Entities |
| 138 | +The tool currently features options to migrate |
| 139 | + - API Proxies (All revisions included) |
| 140 | + - Shared Flows (All revisions included) |
| 141 | + - API Products |
| 142 | + - Developers |
| 143 | + - Developer Apps |
| 144 | + - Key Value Maps (Encrypted KVMs excluded) |
| 145 | + - Resource Files (Enviroment Level Only) |
| 146 | + |
| 147 | +### Execution Model: |
| 148 | + - Once a supported Entity is selected for migration, the tool presents you the options to select an execution model. |
| 149 | + - Recommendation is to select one appropriate to the migration stage. |
| 150 | + 1. **Migrate** |
| 151 | + |
| 152 | + - Description: |
| 153 | + - `Migrates entities` only if they do not already exist in the `target environment`. |
| 154 | + - Use When: |
| 155 | + - You're running the migration for the first time or want to avoid overwriting `any existing resources`. |
| 156 | + - Effect: |
| 157 | + - `Skips already existing entities` and `logs them as duplicates` in the `migration summary`. |
| 158 | + |
| 159 | + 2. **Synchronize** |
| 160 | +
|
| 161 | + - Description: |
| 162 | + - Compares existing entities between `Apigee Edge (source) and Apigee X (target)`. Only entities with differences are updated. |
| 163 | + - Use When: |
| 164 | + - You want to sync environments safely, ensuring only updated content is migrated. |
| 165 | + - Effect: |
| 166 | + - Identical entities are skipped, and only changed ones are updated. No unnecessary overwrites. |
| 167 | + - For any conflicting values , data in `Apigee X (target)` is considered as final value. |
| 168 | + - Only net new values from `Apigee Edge (source)` will be synchronized. |
| 169 | + |
| 170 | + 3. **Overwrite** |
| 171 | +
|
| 172 | + - Description: |
| 173 | + - `Deletes and fully replaces` existing entities in the target environment with those from the source. |
| 174 | + - Use When: |
| 175 | + - You want to fully `refresh or replace` outdated entities in the target system. |
| 176 | + - Effect: |
| 177 | + - Only when entity name matches on both source and target |
| 178 | + - Matched entities in `Apigee X (target)` are `deleted and re-created/migrated` from the source. This is a `destructive operation`, so use with caution. |
| 179 | +
|
| 180 | +## View Logs |
| 181 | +
|
| 182 | + - Menu Option to View Status, Summary, Delta Information and Logs. |
| 183 | + - Menu Option, `All Entities` collects information of supported Entities. |
| 184 | + - All the logs are printed to console only. Adjust the console for a better visibility. |
| 185 | + - Any additonal lookup can be done using the data available. |
| 186 | + |
| 187 | + 1. **Stats** |
| 188 | +
|
| 189 | + - Select to view migration status of one/all entities. |
| 190 | + - In the sub-menu, select to view by status of migration |
| 191 | + |
| 192 | + 2. **Summary** |
| 193 | + |
| 194 | + - Select to view migration summary of one/all entities. |
| 195 | + |
| 196 | + 3. **Delta** |
| 197 | + |
| 198 | + - Select to view the delta information identified by comparing source and target entity |
| 199 | + |
| 200 | + 4. **Logs** |
| 201 | + |
| 202 | + - Select to view transaction logs. |
| 203 | + - Paginated by 200 records at a time, multiple tables of logs will be provided |
| 204 | + |
0 commit comments