Search code examples
lets-encryptjelastic

Why can't I pass any url from my Jelastic manifest settings to the lets encrypt manifest?


I am trying to do something very simple. I have a Jelastic environment with an nginx load balancer. On that balancer, I want to install the let's encrypt addon with the following manifest:

type: update
name: load balancer

targetNodes:
  nodeGroup:
    - bl

settings:
  fields:
    - name: externalDomains
      caption: External domain names (;-separated list)
      type: string
      vtype: domainlist
      required: true

onInstall:
  - installAddon:
      id: letsencrypt

addons:
  - id: letsencrypt
    name: letsencrypt
    onInstall:
      - install [bl]:
          envName: ${env.envName}
          jps: https://github.com/jelastic-jps/lets-encrypt/blob/master/manifest.jps
          settings:
            customDomains: ${settings.externalDomains}

When I run that manifest, I need to provide an external domain:

enter image description here

Then the installation runs with success, in apparence. Then I click the addons' "Configure" button:

enter image description here

And I see that unfortunately the "External Domain(s)" field is empty:

enter image description here

That's unfortunate, because I set it to ${settings.externalDomains}.

If I, however, install the following manifest, then everything is fine:

type: update
name: load balancer

targetNodes:
  nodeGroup:
    - bl

onInstall:
  - installAddon:
      id: letsencrypt

addons:
  - id: letsencrypt
    name: letsencrypt
    onInstall:
      - install [bl]:
          envName: ${env.envName}
          jps: https://github.com/jelastic-jps/lets-encrypt/blob/master/manifest.jps
          settings:
            customDomains: ${env.envName}.my-provider.com

As long as I write anything manually in the addons' customDomains field, it is fine. As soon as I put there a value from the settings, the value gets discarded. What am I doing wrong?


Solution

  • Parameter that is passed to the customDomains should be passed in the add-on first:

    onInstall:
      - installAddon:
          id: letsencrypt
          settings:
            externalDomains: ${settings.externalDomains}
    

    Then it can be used in the add-on body.

    The full add-on manifest:

    type: update
    name: load balancer
    
    targetNodes:
      nodeGroup:
      - bl
    settings:
      fields:
      - name: externalDomains
        caption: External domain names (;-separated list)
        type: string
        vtype: domainlist
        required: true
    
    onInstall:
      - installAddon:
          id: letsencrypt
          settings:
            externalDomains: ${settings.externalDomains}
    
    addons:
      - id: letsencrypt
        name: letsencrypt
        
        onInstall:
          - install:
              envName: ${env.envName}
              nodeGroup: bl
              jps: https://github.com/jelastic-jps/lets-encrypt/blob/master/manifest.jps
              settings:
                customDomains: ${settings.externalDomains}
    

    JPS behavior can be checked in the console tab: -

    {DOMAIN_URL}/console

    The test manifest console logs:

    [07:33:10 letsencrypt]: BEGIN INSTALLATION: letsencrypt
    [07:33:11 letsencrypt]: BEGIN HANDLE EVENT: {"topic":"application/install","envAppid":"c5b959b2a936d56a23daa6964b15dc19"}
    [07:33:11 letsencrypt:1]: install [bl]:  {"envName":"env-sup","nodeGroup":"bl","settings":{"customDomains":"domain8.com"}}
    [07:33:11]: BEGIN MIXINS INITIALIZATION: Let's Encrypt Free SSL
    [07:33:11]: loading mixin [configs/vers.yaml].response: {"result":0}
    [07:33:11]: END MIXINS INITIALIZATION: Let's Encrypt Free SSL
    
    [07:33:12 Let's.SSL]: BEGIN INSTALLATION: Let's Encrypt Free SSL
    [07:33:12 Let's.SSL]: BEGIN HANDLE EVENT: {"topic":"application/install","envAppid":"c5b959b2a936d56a23daa6964b15dc19"}
    [07:33:12 Let's.SSL:1]: setGlobals [bl]:  {"nodeId":"","nodeGroup":"bl","withExtIp":"true","webroot":"","webrootPath":"","fallbackToX1":"","deployHook":"","deployHookType":"","undeployHook":"","undeployHookType":"","test":""}
    

    So here you can see whether parameters are passed and displayed successfully.