Skip to content

Improve Exim forward pipe generation#107

Merged
gbp merged 5 commits intomasterfrom
email-forward-explict-wrappers
Apr 14, 2026
Merged

Improve Exim forward pipe generation#107
gbp merged 5 commits intomasterfrom
email-forward-explict-wrappers

Conversation

@gbp
Copy link
Copy Markdown
Member

@gbp gbp commented Mar 19, 2026

Allow JSON to be more explicit instead of automatically prefixing Exim forward pipes with the run-with-rbenv-path wrapper.

New format would look like:

{
  "email": {
    "email-user": [
      { "script": "path/to/default/script", "suffix": "" },
      { "script": "path/to/suffix/script",  "suffix": "suffix" },
      { "script": "path/to/ruby/script",    "suffix": "ruby", "wrapper": "rbenv" }
    ]
  }
}

This will allow us to set the script to bin/rails actionmailbox:..., using the new "rbenv_exec" wrapper. The old doesn't allow this as it calls source instead of exec.

Will allow new wrappers while allowing existing vhosts to be deployed
without changes to the JSON.
@gbp gbp requested a review from sagepe March 19, 2026 17:41
Comment thread bin/deploy-vhost Outdated
Comment thread bin/deploy-vhost Outdated
@gbp
Copy link
Copy Markdown
Member Author

gbp commented Apr 7, 2026

@sagepe I've pushed a couple of fixups and an extra commit which adds an option to chdir before the wrapper is executed.

Tested on staging and this works with the old style JSON and the new version:

diff --git a/deployments/vhosts/alaveteli/staging.alaveteli.org.json b/deployments/vhosts/alaveteli/staging.alaveteli.org.json
index de7a809d9..af6814900 100644
--- a/deployments/vhosts/alaveteli/staging.alaveteli.org.json
+++ b/deployments/vhosts/alaveteli/staging.alaveteli.org.json
@@ -29,11 +29,11 @@
       "foi-staging-secondary"
    ],
    "email": {
-      "foistaging": {
-         "": "bin/rails.sh action_mailbox:ingress:exim URL=https://staging.alaveteli.org/rails/action_mailbox/relay/inbound_emails INGRESS_PASSWORD=123",
-         "team": "script/handle-mail-replies",
-         "track": "script/handle-mail-replies"
-      }
+      "foistaging": [
+        { "suffix": "", "script": "bin/rails action_mailbox:ingress:exim URL=https://staging.alaveteli.org/rails/action_mailbox/relay/inbound_emails INGRESS_PASSWORD=123", "wrapper": "rbenv_exec" },
+        { "suffix": "team",  "script": "script/handle-mail-replies", "wrapper": "rbenv" },
+        { "suffix": "track", "script": "script/handle-mail-replies", "wrapper": "rbenv" }
+      ]
    },
    "exec_before_down": {
       "user": [

@gbp gbp requested a review from sagepe April 7, 2026 11:29
@sagepe
Copy link
Copy Markdown
Member

sagepe commented Apr 14, 2026

I think this all looks good @gbp - can you squash the fixups, etc, so this is good to merge and we can get it into a release with another small change I'm working on.

gbp added 4 commits April 14, 2026 11:25
Script added in 9306ba5105cbdd9ed71bf72754e8b5dc9956e1fe
Going to allow this variable to be an array in future commits.
Allow JSON to be more explicit instead of automatically prefixing
Exim forward pipes with the `run-with-rbenv-path` wrapper.

New format would look like:
```
{
  "email": {
    "email-user": [
      { "script": "path/to/default/script", "suffix": "" },
      { "script": "path/to/suffix/script",  "suffix": "suffix" },
      { "script": "path/to/ruby/script",    "suffix": "ruby", "wrapper": "rbenv" }
    ]
  }
}
```
rbenv_exec requires the working directory to be set to the vcspath
for proper rbenv and bundler resolution.
@gbp gbp force-pushed the email-forward-explict-wrappers branch from 1c9d93d to dba4992 Compare April 14, 2026 10:25
@gbp gbp merged commit 2cb0f15 into master Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants