|
| 1 | +--- |
| 2 | +tags: |
| 3 | + - administration |
| 4 | + - kubernetes |
| 5 | + - operations |
| 6 | + - gluu4 |
| 7 | + - migration |
| 8 | +--- |
| 9 | + |
| 10 | +This guide shows how to migrate from `Gluu 4.x` to `Gluu Flex`. |
| 11 | + |
| 12 | + |
| 13 | +# Migration steps |
| 14 | + |
| 15 | +1. Create a fresh flex K8s [setup](https://docs.gluu.org/head/install/helm-install/) based on your preferred environment. |
| 16 | + |
| 17 | +1. Write all your existing configurations as code using the Janssen terraform [provider](https://registry.terraform.io/providers/JanssenProject/jans/latest/docs). |
| 18 | + You can check this [doc](https://docs.jans.io/head/janssen-server/terraform/) to know the benefits of this approach and how to implement it. |
| 19 | + |
| 20 | + |
| 21 | +1. Test applying the configuration through Terraform. Ensure no delta between the old Gluu 4.x and Gluu flex, and verify the changes using the admin-ui/TUI. |
| 22 | + |
| 23 | +1. Move the sensitive data from the old setup to the new one, honoring any changes such as custom attributes and users. |
| 24 | + |
| 25 | +# Terraform configuration example |
| 26 | + |
| 27 | +Firstly, you have to initialize and configure the Janssen terraform provider. You can follow this [doc](https://docs.jans.io/head/janssen-server/terraform/) to complete this. |
| 28 | + |
| 29 | +Once completed, let's showcase how to move existing gluu4 [clients](#clients-migration) and [interception scripts](#interception-scripts-migration) using Terraform. |
| 30 | + |
| 31 | +!!! Note |
| 32 | + The examples are meant for demonstration purposes. You should adjust them as needed. |
| 33 | + |
| 34 | +## Clients Migration |
| 35 | + |
| 36 | +We will use the [jans_oidc_client](https://registry.terraform.io/providers/JanssenProject/jans/latest/docs/resources/oidc_client) resource. |
| 37 | + |
| 38 | +Add the following to `clients.tf`: |
| 39 | + |
| 40 | +``` |
| 41 | +resource "jans_oidc_client" "gluu4_migrated_client" { |
| 42 | + display_name = "Gluu4 migrated client" |
| 43 | + description = "Client migrated from Gluu4 to Flex" |
| 44 | + redirect_uris = ["https://demoexample.gluu.org/admin"] |
| 45 | + token_endpoint_auth_method = "none" |
| 46 | + subject_type = "pairwise" |
| 47 | + grant_types = ["authorization_code"] |
| 48 | + response_types = ["code"] |
| 49 | + disabled = false |
| 50 | + trusted_client = true |
| 51 | + application_type = "web" |
| 52 | + scopes = ["inum=F0C4,ou=scopes,o=jans"] |
| 53 | + persist_client_authorizations = true |
| 54 | + access_token_as_jwt = false |
| 55 | +} |
| 56 | +``` |
| 57 | +## Interception scripts Migration |
| 58 | + |
| 59 | +We will use the [jans_script](https://registry.terraform.io/providers/JanssenProject/jans/latest/docs/resources/oidc_client) resource. |
| 60 | + |
| 61 | +Add the following to `scripts.tf`: |
| 62 | + |
| 63 | + |
| 64 | +``` |
| 65 | +resource "jans_script" "gluu_migrated_script" { |
| 66 | + dn = "inum=CACD-5901,ou=scripts,o=jans" |
| 67 | + inum = "CACD-5901" |
| 68 | + name = "scan_client_registration" |
| 69 | + description = "Scan Client Registration Script" |
| 70 | + script = file("script.py") |
| 71 | + script_type = "client_registration" |
| 72 | + programming_language = "python" |
| 73 | + level = 100 |
| 74 | + revision = 1 |
| 75 | + enabled = true |
| 76 | + modified = false |
| 77 | + internal = false |
| 78 | + location_type = "db" |
| 79 | + base_dn = "inum=CACD-5901,ou=scripts,o=jans" |
| 80 | +
|
| 81 | + module_properties { |
| 82 | + value1 = "v1" |
| 83 | + value2 = "v2" |
| 84 | + description = null |
| 85 | + } |
| 86 | +} |
| 87 | +``` |
| 88 | + |
| 89 | + |
| 90 | +You can run `terraform apply` and review the created resources in the Admin-UI/TUI. |
0 commit comments