Broken DOMAIN templating for new recipes #355

Closed
opened 2022-11-03 23:24:45 +00:00 by 3wordchant · 3 comments
Owner
  1. abra recipe new foobar
  2. (hackety hack)
  3. abra app new foobar
  4. (choose a domain)
  5. abra app deploy foobar.mycoolsite

Expected result: works

Actual result: FATA[0022] lookup foobar.example.com: no such host

My preferred solution is to return to just replacing <recipe>.example.com with DOMAIN, to avoid needing recipe maintainers needing to learn $yet_another_templating system (the "corrrect" {{ .Domain }} is different to the syntax needed in configs).

But changing coop-cloud/example#.env.sample to use the {{ syntax could be fine too

1. `abra recipe new foobar` 2. (hackety hack) 3. `abra app new foobar` 4. (choose a domain) 5. `abra app deploy foobar.mycoolsite` Expected result: works Actual result: `FATA[0022] lookup foobar.example.com: no such host` My preferred solution is to return to just replacing `<recipe>.example.com` with DOMAIN, to avoid needing recipe maintainers needing to learn `$yet_another_templating` system (the "corrrect" `{{ .Domain }}` is different to the syntax needed in configs). But changing [`coop-cloud/example#.env.sample`](https://git.coopcloud.tech/coop-cloud/example/src/branch/main/.env.sample) to use the `{{` syntax could be fine too
3wordchant added the
bug
abra
labels 2022-11-03 23:24:45 +00:00
Owner

My preferred solution is to return to just replacing <recipe>.example.com

Think we had it some time before but then the code was replacing <recipe> in unwanted places e.g. comments in the .env.sample which was a bit messy... the templating being easier to replace specific things, i.e. warding off bug reports from the other side, replacing too much 😅

But changing coop-cloud/example#.env.sample to use the {{ syntax could be fine too

Sorry, not sure what you mean? Do you mean:

TYPE={{ .Name }}

DOMAIN={{ . Domain }}

## Domain aliases
#EXTRA_DOMAINS=', `www.{{ .Domain }}`'

LETS_ENCRYPT_ENV=production

Probably need to document this so people don't have to learn new stuff.

> My preferred solution is to return to just replacing `<recipe>.example.com` Think we had it some time before but then the code was replacing `<recipe>` in unwanted places e.g. comments in the `.env.sample` which was a bit messy... the templating being easier to replace specific things, i.e. warding off bug reports from the other side, replacing too much 😅 > But changing coop-cloud/example#.env.sample to use the {{ syntax could be fine too Sorry, not sure what you mean? Do you mean: ``` TYPE={{ .Name }} DOMAIN={{ . Domain }} ## Domain aliases #EXTRA_DOMAINS=', `www.{{ .Domain }}`' LETS_ENCRYPT_ENV=production ``` Probably need to document this so people don't have to learn new stuff.
Author
Owner

But changing coop-cloud/example#.env.sample to use the {{ syntax could be fine too

Sorry, not sure what you mean? Do you mean:

Yes, basically, assuming that {{ .Domain }} will be ignored by Gitea during the templating process, otherwise with whatever escaping. The goal would be that after step #2 above, e.g. coop-cloud/dashy#.env.sample looks like this:

DOMAIN={{ .Domain }}

instead of like this:

DOMAIN=dashy.example.com

But, I still prefer my first suggestion, which, to also clarify:

Think we had it some time before but then the code was replacing <recipe> in unwanted places e.g. comments in the .env.sample which was a bit messy...

Replacing <recipe>, sure, but what about <recipe>.example.com in its entirety? The existing coop-cloud/dashy#.env.sample would work fine, I don't think there are any instances of <recipe>.example.com except ones we want to replace, it seems <recipe>.example.com would be clearer to me than DOMAIN={{ .Domain }} for non-abra use, and also has the advantage of needing to change fewer recipes¹.

¹estimated using:

➜ rg -l 'DOMAIN=.*example\.com' */.env.sample | wc -l
98
➜ rg -l 'DOMAIN=\{\{' */.env.sample | wc -l
98
> > But changing `coop-cloud/example#.env.sample` to use the `{{` syntax could be fine too > > Sorry, not sure what you mean? Do you mean: Yes, basically, assuming that `{{ .Domain }}` will be ignored by Gitea during the templating process, otherwise with whatever escaping. The goal would be that after step #2 above, e.g. [`coop-cloud/dashy#.env.sample` ](https://git.coopcloud.tech/coop-cloud/dashy/src/branch/main/.env.sample) looks like this: `DOMAIN={{ .Domain }}` instead of like this: `DOMAIN=dashy.example.com` But, I still prefer my first suggestion, which, to also clarify: > Think we had it some time before but then the code was replacing `<recipe>` in unwanted places e.g. comments in the `.env.sample` which was a bit messy... Replacing `<recipe>`, sure, but what about `<recipe>.example.com` in its entirety? The existing [`coop-cloud/dashy#.env.sample` ](https://git.coopcloud.tech/coop-cloud/dashy/src/branch/main/.env.sample) would work fine, I don't think there are any instances of `<recipe>.example.com` except ones we want to replace, it seems `<recipe>.example.com` would be clearer to me than `DOMAIN={{ .Domain }}` for non-abra use, and also has the advantage of needing to change fewer recipes¹. ¹estimated using: ``` ➜ rg -l 'DOMAIN=.*example\.com' */.env.sample | wc -l 98 ➜ rg -l 'DOMAIN=\{\{' */.env.sample | wc -l 98 ```
Owner

Ah yeh, that makes a lot of sense @3wordchant! Let's go for <recipe>.example.com replacing then!

Ah yeh, that makes a lot of sense @3wordchant! Let's go for `<recipe>.example.com` replacing then!
decentral1se added this to the (deleted) project 2022-11-07 07:33:26 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: coop-cloud/organising#355
No description provided.