am Image

The am Docker image contains the AM configuration.

Customization Overview

  • Customize AM’s configuration data by using the console and the REST APIs.

  • Capture changes to the AM configuration by exporting them from the AM service running on Kubernetes to the staging area.

  • Save the modified AM configuration to a configuration profile in your forgeops repository clone.

  • Build an updated am Docker image that contains your customizations.

  • Redeploy AM.

  • Verify that changes you’ve made to the AM configuration are in the new Docker image.

Detailed Steps

Perform the following steps iteratively when developing a custom am Docker image:

  1. If this is your first time building a custom Docker image, verify that you performed these setup activities, which are required for developers:

  2. Verify that:

    • The CDK is deployed.

    • The namespace in which the CDK is deployed is set in your Kubernetes context.

  3. Perform version control activities on your forgeops repository clone:

    1. Run the git status command.

    2. Review the state of the config directory.

    3. (Optional) Run the git commit command to commit changes to files that have been modified.

  4. Modify the AM configuration using the AM console or the REST APIs.

    For information about how to access the AM console or REST APIs, see AM Services.

    See About Property Value Substitution for important information about configuring values that vary at run-time, such as passwords and host names.

  5. Export the changes you made to the AM configuration in the running ForgeRock Identity Platform to the staging area:

    $ cd /path/to/forgeops/bin
    $ ./config.sh export --component am
    
    Exporting AM configuration..
    
    
    AM configuration files have been exported to docker/7.0/am/config.+ docker run --rm --user 501:20 --volume /Users/shankar.raman/Repositories/forgeops/docker/7.0/am:/am-config --volume /Users/shankar.raman/Repositories/forgeops/config/am-upgrader-rules:/rules gcr.io/forgerock-io/am-config-upgrader/pit1:7.2.0-latest-postcommit
    Unable to find image 'gcr.io/forgerock-io/am-config-upgrader/pit1:7.2.0-latest-postcommit' locally
    7.2.0-latest-postcommit: Pulling from forgerock-io/am-config-upgrader/pit1
    b858e2d8875f: Already exists
    4d56c0553b50: Pull complete
    cc483403b1fa: Pull complete
    a6d79257700e: Pull complete
    22ec291d0766: Pull complete
    b1c5964e597f: Pull complete
    d4ac2bbcb1f5: Pull complete
    82b17ad1853e: Pull complete
    Digest: sha256:010eea1f29f99c821763b017404a3c74ba46a734073c184cff105f9eb96f05a9
    Status: Downloaded newer image for gcr.io/forgerock-io/am-config-upgrader/pit1:7.2.0-latest-postcommit
    
    Reading existing configuration from files in /am-config/config/services…​
    Modifying configuration based on rules in [/rules/placeholders.groovy]…​
    reading configuration from file-based config files
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Writing configuration to new location at /am-config/config/services…​
    Upgrade Completed, modified configuration saved to /am-config/config/services

    The config.sh export --component am command copies AM static configuration from the running CDK instance to the staging area.

    Exporting the configuration from the CDK to the staging area.
  6. Review the differences between the files you exported to the staging area and files that you previously saved to your configuration profile.

    Use the config.sh diff command to review the changes. For example:

    $ ./config.sh diff --component am --profile my-profile
    diff  -u --recursive config/7.0/my-profile/am docker/7.0/am
    Only in docker/7.0/am/config/services/realm/root/authenticationtreesservice/1.0/organizationconfig/default: my-tree.json
    Only in docker/7.0/am: logback.xml
  7. Save the AM configuration to your configuration profile:

    $ ./config.sh save --component am --profile my-profile
    Saving AM configuration.

    The config.sh save --component am command copies AM static configuration from the staging area to your configuration profile.

    Saving the configuration to your configuration profile.
  8. Perform version control activities on your forgeops repository clone:

    1. Run the git status command.

    2. Review the state of the config directory.

    3. (Optional) Run the git commit command to commit changes to files that have been modified.

  9. Build a new am image that includes your changes to AM static configuration:

    $ ./cdk build am
    Generating tags…​
     - am → am:32005dccf
    Checking cache…​
     - am: Not found. Building
    Starting build…​
    Found [minikube] context, using local docker daemon.
    Building [am]…​
    Sending build context to Docker daemon  1.989MB
    Step 1/15 : FROM gcr.io/forgerock-io/am-base:7.1.0
     --→ 4e0b979daa5c
    . . .
    Step 15/15 : ENTRYPOINT ["/home/forgerock/custom-entrypoint.sh"]
     --→ Running in 5f85c3a0f12a
     --→ 16e5e404830e
    Successfully built 16e5e404830e
    Successfully tagged am:32005dccf
    
    Updated the image_defaulter with your new image for am: "am:16e5e4048…​"

    The cdk build command calls Skaffold to build a new am Docker image, and to push the image to your Docker registry. It also updates the image defaulter file so that the next time you install AM, the cdk install command gets AM static configuration from your new custom Docker image.

    Building the new custom Docker image.
  10. Redeploy AM:

    1. Remove AM from your CDK installation:

      $ ./cdk delete am
      Uninstalling component(s): ['am']
      OK to delete these components? [Y/N] Y
      service "am" deleted
      deployment.apps "am" deleted
    2. Redeploy AM:

      $ ./cdk install am
      Checking secret-agent operator and related CRDs: secret-agent CRD found in cluster.
      Checking ds-operator and related CRDs: ds-operator CRD found in cluster.
      
      Installing component(s): ['am']
      
      service/am created
      deployment.apps/am created
      
      Enjoy your deployment!
    3. Run the kubectl get pods command to monitor the status of the AM pod. Wait until the pod is ready before proceeding to the next step.

  11. To validate that AM has the expected configuration:

    • Describe the AM pod. Locate the tag of the Docker image that Kubernetes loaded, and verify that it’s your new custom Docker image’s tag.

    • Start the AM console and verify that your configuration changes are present.

Next Step