/git-artifact-synchronizer

WSO2 API Manager Artifact Synchronization with Git

Primary LanguageJavaApache License 2.0Apache-2.0

WSO2 API Manager Artifact Synchronization with Git

Git Artifact Synchronizer is an implementation of WSO2 API Manager Gateway Artifact Synchronizer to store API artifacts in a Git repository.

Artifact Synchronization enables synchronization of runtime artifacts in an Active-Active Deployment of WSO2 API Manager.

Git Artifact Synchronizer is supported by WSO2 API Manager 4.1.0 and above.

Getting Started

The pre-built JAR file can also be downloaded from Releases

mvn clean install
  • Once the build is successful, copy the JAR file git-1.0.0.jar to <API-M_HOME>/repository/components/dropins directory.
  • Start the API Manager instance(s) with the following System properties
    • -DGitRepoURL - The URL of the Git repository (Eg: https://github.com/<git-username>/<repository-name>)

    • -DGitUsername - The Git username

    • -DGitAccessToken - The Personal Access Token generated above.

    • -DGitRepoBranch - The branch used to store the artifacts (Eg: main) (optional)

      If the branch is kept empty, the default branch of the repository will be used to store the artifacts.

Navigate to the <API-M_HOME>/bin directory and execute the following command to start the API Manager instance.

  • For Windows

    api-manager.bat --run -DGitRepoURL="https://github.com/<git-username>/<repository-name>" -DGitUsername="<git-username>" -DGitAccessToken="<git-access-token>" -DGitRepoBranch="<branch-name>"
  • For Linux

    sh api-manager.sh -DGitRepoURL="https://github.com/<git-username>/<repository-name>" -DGitUsername="<git-username>" -DGitAccessToken="<git-access-token>" -DGitRepoBranch="<branch-name>"
  • The Artifact Directory Structure section explains how the directory structure is created when API revisions and deployments are made.

Artifact Directory Structure

When adding, removing, deploying or undeploying the directory structure will be as follows.

  • When an API revision is added/deleted, the ZIP artifact will be added/deleted to/from the inactive/<api_name-version> directory in the repository. (Eg: inactive/PizzaShackAPI-1.0.0)

  • When an API revision is deployed/undeployed, the ZIP artifact will be added/removed to/from the active-<gateway_name> directory. (Eg: active/Default)

Sample Directory Structure

 active-Gateway1
 ├── 1a2b3c4d-SwaggerPetstore-1.0.0-abcd1234-carbon.super.zip
 ├── 2b3c4d5e-SwaggerPetstore-2.0.0-pqrs1234-carbon.super.zip
 active-Gateway2
 ├── 2b3c4d5e-SwaggerPetstore-2.0.0-wxyz3456-carbon.super.zip
 inactive
 ├── SwaggerPetstore-1.0.0
 │   └── 1a2b3c4d-SwaggerPetstore-1.0.0-abcd1234-carbon.super.zip
 │   └── 1a2b3c4d-SwaggerPetstore-1.0.0-cdef6789-carbon.super.zip
 ├── SwaggerPetstore-2.0.0
     └── 2b3c4d5e-SwaggerPetstore-2.0.0-wxyz3456-carbon.super.zip