From 65b86d1f9c763b4a0cbb29b76d8f21035ef703af Mon Sep 17 00:00:00 2001 From: Paul Bonaud Date: Thu, 27 Dec 2018 11:47:42 +0100 Subject: [PATCH] app: rename `clever_entry_point`. It's only used by Haskell apps --- README.md | 3 +- defaults/main.yml | 2 +- dhall/Config.dhall | 6 ++-- dhall/mkConfig.dhall | 76 ++++++++++++++++++++++---------------------- vars/main.yml | 4 ++- 5 files changed, 47 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index f156f5c..9141b11 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,13 @@ Variables for the application - `clever_token`: clever_cloud token, mandatory. - `clever_secret`: clever_cloud secret, mandatory. - `clever_app`: the id of the app to link, mandatory. -- `clever_entry_point`: the executable name to be executed by clever cloud, mandatory - `clever_env`: a dict of environment variables for the application (without add_ons one already available), optional. - `clever_base_env`: a dict set in vars/main.yml with safe default and mandatory variables for an app to be run on clever. ` clever_base_env | combine(clever_env)` is passed to `clever env` command - `clever_addons`: a list of dict describing addons enabled for the application from which we would use information during deploy, optional.
Example: `{ name: pg, env_prefix: POSTGRESQL_ADDON }` - `clever_app_tasks_file`: tasks file to be executed after environment and addons variables where gathered. Specific to an app, should be use to run migrations. Optional. +- `clever_haskell_entry_point`: the haskell executable name to be executed by clever cloud, optional. +- _Obsolete_: `clever_entry_point`: Same as above but was replaced by `clever_haskell_entry_point` since v1.14 of this role. - `clever_domain`: the domain from which the application should be reachable, optional. - _Obsolete_: `domain`: Same as above but was replaced by `clever_domain` since v1.4 of this role. - `clever_syslog_server`: UDP Syslog server to be used as UDPSyslog drain for the application, optional. Example: `udp://198.51.100.51:12345`. diff --git a/defaults/main.yml b/defaults/main.yml index fb0e30f..b1605c6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,7 +6,7 @@ clever_app_root: "{{ app_root | default(playbook_dir + '/..') }}" clever_app_confdir: "{{ clever_app_root }}/.clever_cloud" clever_login_file: "{{ clever_app_confdir }}/login" -clever_entry_point: "" +clever_haskell_entry_point: "{{ clever_entry_point | default('') }}" clever_env: {} clever_metrics: true diff --git a/dhall/Config.dhall b/dhall/Config.dhall index 01329a8..db063b7 100644 --- a/dhall/Config.dhall +++ b/dhall/Config.dhall @@ -1,4 +1,4 @@ - let Addon = ./addon/Addon.dhall +let Addon = ./addon/Addon.dhall in λ(Environment : Type) → { clever_app : @@ -15,7 +15,7 @@ in λ(Environment : Type) Text , clever_app_tasks_file : Text - , clever_entry_point : + , clever_haskell_entry_point : Text , clever_metrics : Bool @@ -23,4 +23,4 @@ in λ(Environment : Type) List Addon , clever_env : Environment - } + } \ No newline at end of file diff --git a/dhall/mkConfig.dhall b/dhall/mkConfig.dhall index 5040f1c..cf64bef 100644 --- a/dhall/mkConfig.dhall +++ b/dhall/mkConfig.dhall @@ -1,44 +1,44 @@ - let Config = ./Config.dhall +let Config = ./Config.dhall in let Vault = ./Vault.dhall -in let Addon = ./addon/Addon.dhall + in let Addon = ./addon/Addon.dhall -in let Environment = ./environment/Environment.dhall + in let Environment = ./environment/Environment.dhall -in let nonifyEmpty = - λ(opt : Optional Text) - → Optional/fold Text opt Text (λ(x : Text) → x) "None" + in let nonifyEmpty = + λ(opt : Optional Text) + → Optional/fold Text opt Text (λ(x : Text) → x) "None" -in λ(vault : Vault) - → λ(app : Text) - → λ(entryPoint : Text) - → λ(metrics : Bool) - → λ(syslogServer : Optional Text) - → λ(domain : Optional Text) - → λ(tasksFile : Optional Text) - → λ(addons : List Addon) - → { clever_app = - app - , clever_orga = - vault.organization - , clever_secret = - vault.secret - , clever_token = - vault.token - , clever_syslog_server = - nonifyEmpty syslogServer - , clever_domain = - nonifyEmpty domain - , clever_app_tasks_file = - nonifyEmpty tasksFile - , clever_entry_point = - entryPoint - , clever_metrics = - metrics - , clever_addons = - addons - , clever_env = - { FORCE_HTTPS = True } - } - : Config Environment + in λ(vault : Vault) + → λ(app : Text) + → λ(entryPoint : Optional Text) + → λ(metrics : Bool) + → λ(syslogServer : Optional Text) + → λ(domain : Optional Text) + → λ(tasksFile : Optional Text) + → λ(addons : List Addon) + → { clever_app = + app + , clever_orga = + vault.organization + , clever_secret = + vault.secret + , clever_token = + vault.token + , clever_syslog_server = + nonifyEmpty syslogServer + , clever_domain = + nonifyEmpty domain + , clever_app_tasks_file = + nonifyEmpty tasksFile + , clever_haskell_entry_point = + nonifyEmpty entryPoint + , clever_metrics = + metrics + , clever_addons = + addons + , clever_env = + { FORCE_HTTPS = True } + } + : Config Environment \ No newline at end of file diff --git a/vars/main.yml b/vars/main.yml index 0bb52a9..adeac01 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -2,6 +2,8 @@ # vars file for clever clever_base_env: CACHE_DEPENDENCIES: "true" - CC_RUN_COMMAND: "~/.local/bin/{{ clever_entry_point }}" + # Haskell only + # https://www.clever-cloud.com/doc/get-help/reference-environment-variables/#haskell + CC_RUN_COMMAND: "~/.local/bin/{{ clever_haskell_entry_point }}" ENABLE_METRICS: "{{ clever_metrics | lower }}" PORT: "8080" -- 2.41.0