StyleBook configuration

Import and synchronize StyleBooks from GitHub repository

Consider a scenario where you are using CI/CD processes for your development. Or, a scenario where you are managing all the application source code and deployment artifacts in GitHub.

In the GitHub repository, you might be maintaining several StyleBooks for deploying the NetScaler configurations and managing these StyleBooks. You must upload these StyleBooks to NetScaler Console. With this feature, you can directly import your StyleBooks present in GitHub into NetScaler Console. You don’t need to manually copy them from GitHub and then upload them into NetScaler Console. Or, manually synchronize the files in both NetScaler Console and GitHub. Also, you can import and synchronize config packs from GitHub.

To import StyleBooks and config packs, define a repository in NetScaler Console that represents a GitHub repository. Provide the GitHub repository URL and your username and API token created in GitHub. That means, only authorized users who have a valid account in GitHub can import and sync StyleBooks.

After creating the repository, you can sync NetScaler Console with your GitHub repository. NetScaler Console connects to GitHub and imports StyleBooks and config packs found in that repository. NetScaler Console then validates the StyleBooks and adds them to the list of StyleBooks in NetScaler Console. StyleBooks are not added to NetScaler Console if they fail validation. You can identify and correct the errors on your StyleBooks. Then, commit the updated versions into your GitHub repository. Later you can try importing them or syncing them again into NetScaler Console.

Important

  • StyleBooks files can be imported and synchronized from any branch of a GitHub repository.

  • You can import and synchronize StyleBooks that have dependent StyleBooks associated with them too. These dependent StyleBooks can be in the Github repository or already present in NetScaler Console.

  • The synchronization of StyleBooks from a GitHub repository must be initiated manually from the NetScaler Console GUI or API. That is, currently, importing and syncing of StyleBooks does not happen automatically based on your GitHub commit activity.

  • The configuration pack file that you want to import must be in the JSON format. Also, the configuration file contents must follow the exported configuration format. Under your GitHub repository, the files associated with the configuration pack must be in the configpacks folder.

You can import StyleBook files to NetScaler Console from any folder in the GitHub repository. To import config packs, do the following:

  1. Create a folder with name configpacks under the root directory. Make sure all files associated with configurations are in this folder.

  2. In the configpacks folder, create a JSON file that contains the payload for the configuration pack. This payload is used to synchronize config packs. The following is an example payload:

    {
        "config_key": "unique-key-for-configpack",
    
        "parameters": {
            "param-name1": "param-value1",
            "param-name": "param-value2",
            "param-namen": "param-valuen"
        },
        "stylebook": {
            "namespace": "some namespace",
            "name": "somename",
            "version": "spme-version"
        }
    }
    <!--NeedCopy-->
    
    • config_key - A unique ID or name to identify a configuration pack in NetScaler Console. If you do not specify config_key, NetScaler Console auto-generates the ID on creating the configuration pack.

      If the specified ID is found in the NetScaler Console GUI, the sync action updates the configuration pack in the NetScaler Console GUI. Else, it creates a configuration pack with the specified ID.

    • parameters - It contains all the necessary parameters to create or update the configuration pack.

    • stylebook - It is a mandatory property in a JSON file. It contains a namespace, version, and StyleBook name with which you want to associate the configuration pack.

  3. In the configpacks folder, keep all the files that are associated with the configuration pack such as certificates, signature files, and XML files.

Add a repository

  1. In NetScaler Console, go to Applications > Configuration > Repositories. Click Add.

  2. In the Add Repository window, enter the following parameters:

    • Name - Type the name of the repository. This name can be the same as the repository name in GitHub or a different one.

    • Repository URL - Type the GitHub repository URL.

      You can specify a GitHub enterprise URL. It helps you import or synchronize StyleBooks and config packs from GitHub enterprise accounts.

    • User Name - Type the username that you use to access the GitHub account or enterprise account.

    • API Token - This token is used to access your GitHub repository. For information on how to create API tokens for your GitHub repository, see the GitHub documentation for creating personal access tokens.

    Add a GitHub repository

  3. Click Create.

    The repository is created in NetScaler Console.

Repository options

The following are the additional options for your repositories:

  • Edit - You can edit the repository URL, user name, and API token.

  • Delete - You can delete the repository along with all the StyleBooks present in NetScaler Console that were imported previously from that GitHub repository.

    Note

    You cannot delete a repository from NetScaler Console if it has any StyleBooks that have config packs associated with them. First, delete all the config packs of these StyleBooks. You can later remove the repository from NetScaler Console to clean up the StyleBooks from that repository.

  • Reset - You can remove all StyleBooks in NetScaler Console synced from that repository without actually deleting the repository entry.

  • List files - You can see a list of all StyleBooks present in NetScaler Console that originates from the GitHub repository.

Steps to import StyleBooks and config packs from GitHub

After you complete the prerequisites, follow the steps to import StyleBooks and config packs from a GitHub repository:

  1. Optional, add a repository if you haven’t added.
  2. Select the repository in the Repositories page.
  3. Click Sync.
Import and synchronize StyleBooks from GitHub repository