Skip to content

Commit f821415

Browse files
jensensclaude
andcommitted
fix: Correct postfix exporter showq socket path
The postfix_exporter sidecar was configured to look for the showq socket at /var/spool/postfix/public/showq (emptyDir), but Mailu actually uses /queue as the Postfix spool directory (PVC mount). Changes: - Mount queue PVC in exporter container at /queue (read-only) - Update showq_path to /queue/public/showq - Remove unused emptyDir spool volume This fixes the "Failed to scrape showq" errors in the exporter logs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent da2bf5b commit f821415

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/constructs/postfix-construct.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,10 @@ export class PostfixConstruct extends Construct {
161161
// Critical for relay restrictions to work correctly (mynetworks check uses real IP)
162162
container.env.addVariable('POSTFIX_smtpd_upstream_proxy_protocol', kplus.EnvValue.fromValue('haproxy')); // HAProxy PROXY protocol (v1/v2 compatible)
163163

164-
// Mount PVC for mail queue
165-
container.mount('/queue', kplus.Volume.fromPersistentVolumeClaim(this, 'queue-volume', this.pvc));
164+
// Mount PVC for mail queue - Mailu uses /queue as the Postfix spool directory
165+
// This is where showq socket will be at /queue/public/showq
166+
const queueVolume = kplus.Volume.fromPersistentVolumeClaim(this, 'queue-volume', this.pvc);
167+
container.mount('/queue', queueVolume);
166168

167169
// Mount override ConfigMap for PROXY protocol master.cf configuration
168170
// This adds smtpd_upstream_proxy_protocol support to the smtp service
@@ -176,12 +178,6 @@ export class PostfixConstruct extends Construct {
176178
kplus.Volume.fromConfigMap(this, 'override-volume', overrideConfigMap),
177179
);
178180

179-
// Create shared volume for Postfix spool directory (for exporter access to showq socket)
180-
const spoolVolume = kplus.Volume.fromEmptyDir(this, 'spool-volume', 'postfix-spool', {
181-
sizeLimit: parseMemorySize('100Mi'),
182-
});
183-
container.mount('/var/spool/postfix', spoolVolume);
184-
185181
// Add Postfix exporter sidecar for Prometheus metrics
186182
// Exposes queue size and other Postfix metrics on port 9154
187183
const exporterContainer = this.deployment.addContainer({
@@ -192,7 +188,7 @@ export class PostfixConstruct extends Construct {
192188
command: [
193189
'/postfix_exporter',
194190
'--no-postfix.logfile_must_exist', // Make log file optional (containers log to stdout)
195-
'--postfix.showq_path=/var/spool/postfix/public/showq', // Use showq socket for metrics
191+
'--postfix.showq_path=/queue/public/showq', // Use showq socket from Mailu queue directory
196192
],
197193
securityContext: {
198194
ensureNonRoot: false, // Needs access to Postfix spool directory
@@ -210,11 +206,12 @@ export class PostfixConstruct extends Construct {
210206
},
211207
});
212208

213-
// Mount shared spool volume for access to showq socket
214-
exporterContainer.mount('/var/spool/postfix', spoolVolume);
209+
// Mount the queue PVC in exporter for access to showq socket
210+
// Mailu stores Postfix spool at /queue, so showq socket is at /queue/public/showq
211+
exporterContainer.mount('/queue', queueVolume, { readOnly: true });
215212

216213
// Configure exporter to read from Postfix showq socket
217-
exporterContainer.env.addVariable('POSTFIX_SHOWQ_PATH', kplus.EnvValue.fromValue('/var/spool/postfix/public/showq'));
214+
exporterContainer.env.addVariable('POSTFIX_SHOWQ_PATH', kplus.EnvValue.fromValue('/queue/public/showq'));
218215

219216
// Create Service
220217
this.service = new kplus.Service(this, 'service', {

0 commit comments

Comments
 (0)