A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(rexctl): let api and worker trust a private CA for SMTP (#3703)
Hampus0cc0e9ec21f5
diff --git a/fluxer_docs/src/content/docs/operator/environment.mdx b/fluxer_docs/src/content/docs/operator/environment.mdxindex 2d0631e2d..b37952008 100644--- a/fluxer_docs/src/content/docs/operator/environment.mdx+++ b/fluxer_docs/src/content/docs/operator/environment.mdx@@ -545,7 +545,7 @@ Hosts the Rust services other than the app-proxy connect to without the proxy, s### `FLUXER_NODE_EXTRA_CA_CERTS`-The path of a PEM file of CA certificates that the api and worker trust for outgoing TLS on top of Node's built-in ones. The path is inside their containers. A file you set replaces the system bundle. Add your CA to a copy of that bundle. The Rust services don't use it and take their CA certificates from `SSL_CERT_FILE`. The default is `/etc/ssl/certs/ca-certificates.crt`. With rexctl, use `rexctl config set FLUXER_NODE_EXTRA_CA_CERTS`.+The path of a PEM file of CA certificates that the api and worker trust for outgoing TLS on top of Node's built-in ones. Use it when your email server has a certificate from your own CA. The path is inside their containers. With Docker Compose they see the ca folder of your instance at `/etc/fluxer/ca`, and nothing else from the instance folder. A file you set replaces the system bundle. Node's built-in CAs still apply, and the file can hold only your own CA. The Rust services don't use it and take their CA certificates from `SSL_CERT_FILE`. The default is `/etc/ssl/certs/ca-certificates.crt`. With rexctl, use `rexctl config set FLUXER_NODE_EXTRA_CA_CERTS`.## Sign-indiff --git a/fluxer_docs/src/content/docs/operator/kubernetes.mdx b/fluxer_docs/src/content/docs/operator/kubernetes.mdxindex ba91122ac..4669c3b27 100644--- a/fluxer_docs/src/content/docs/operator/kubernetes.mdx+++ b/fluxer_docs/src/content/docs/operator/kubernetes.mdx@@ -90,6 +90,35 @@ The Postgres database and role, and the S3 buckets in `s3.buckets`, must exist bPoint your LiveKit server's webhook at `https://<your domain>/api/webhooks/livekit`, signed with the key in `FLUXER_LIVEKIT_API_KEY`.+## Trust your own CA++When your email server or another service the api calls has a certificate from your own CA, mount that CA's PEM file into the api and worker and set `NODE_EXTRA_CA_CERTS` to its path. This example reads `ca.pem` from a ConfigMap called `smtp-ca`.++```yaml+api:+ env:+ NODE_EXTRA_CA_CERTS: /etc/fluxer/ca/ca.pem+ extraVolumes:+ - name: smtp-ca+ configMap:+ name: smtp-ca+ extraVolumeMounts:+ - name: smtp-ca+ mountPath: /etc/fluxer/ca+ readOnly: true+worker:+ env:+ NODE_EXTRA_CA_CERTS: /etc/fluxer/ca/ca.pem+ extraVolumes:+ - name: smtp-ca+ configMap:+ name: smtp-ca+ extraVolumeMounts:+ - name: smtp-ca+ mountPath: /etc/fluxer/ca+ readOnly: true+```+## UpgradePull the chart and upgrade with the same values file. A new `image.revision` restarts every Fluxer pod, which pulls the newest Fluxer images.diff --git a/fluxer_docs/src/content/docs/operator/running.mdx b/fluxer_docs/src/content/docs/operator/running.mdxindex 3342bc335..1806394fd 100644--- a/fluxer_docs/src/content/docs/operator/running.mdx+++ b/fluxer_docs/src/content/docs/operator/running.mdx@@ -139,6 +139,13 @@ rexctl email setrexctl email test [email protected]```+If your email server's certificate comes from your own CA, put that CA's PEM file in the `ca` folder of your instance. The api and worker see that folder at `/etc/fluxer/ca`, and they can't see the edge's `certs` folder. The file needs only the CA certificate, never a private key. Tell them to trust the file, then test again.++```sh+rexctl config set FLUXER_NODE_EXTRA_CA_CERTS /etc/fluxer/ca/ca.pem+rexctl email test [email protected]+```+Change your instance's name, color, logo or icon.```shdiff --git a/fluxer_rexctl/cmd/backup.go b/fluxer_rexctl/cmd/backup.goindex f84828ea8..fb360d78e 100644--- a/fluxer_rexctl/cmd/backup.go+++ b/fluxer_rexctl/cmd/backup.go@@ -422,7 +422,7 @@ func backupLocationProblem(ctx context.Context, app *App, inst *instance.Instancif filepath.Clean(inst.Dir) == dir {return fmt.Sprintf("%s is your instance folder, and every backup copies the files in it.", dir)}- for _, sub := range []string{instance.StateDirName, instance.CertsDir, instance.CaddyDropInDir} {+ for _, sub := range []string{instance.StateDirName, instance.CertsDir, instance.CADir, instance.CaddyDropInDir} {if within(inst.Path(sub), dir) {return fmt.Sprintf("%s is inside %s, which every backup copies.", dir, inst.Path(sub))}diff --git a/fluxer_rexctl/cmd/email.go b/fluxer_rexctl/cmd/email.goindex f7b7687cc..d3320862d 100644--- a/fluxer_rexctl/cmd/email.go+++ b/fluxer_rexctl/cmd/email.go@@ -16,6 +16,7 @@ import ("github.com/fluxerapp/fluxer/fluxer_rexctl/internal/adminapi""github.com/fluxerapp/fluxer/fluxer_rexctl/internal/instance"+ "github.com/fluxerapp/fluxer/fluxer_rexctl/internal/stack""github.com/fluxerapp/fluxer/fluxer_rexctl/internal/ui")@@ -80,7 +81,7 @@ func validTLS(mode, flag string) error {func tlsFix(message, fallback string) string {if certificateFailed(message) {- return "Give your email server a certificate from a trusted authority. If it doesn't use encryption, run rexctl email set --tls none."+ return "If your email server's certificate comes from your own CA, put that CA's PEM file in the ca folder of your instance, then run rexctl config set FLUXER_NODE_EXTRA_CA_CERTS " + stack.NodeCADir + "/<file>. If it doesn't use encryption, run rexctl email set --tls none."}if adminapi.StartTLSFailed(message) {return "If your email server doesn't use encryption, run rexctl email set --tls none."diff --git a/fluxer_rexctl/cmd/email_test.go b/fluxer_rexctl/cmd/email_test.gonew file mode 100644index 000000000..78f660aa3--- /dev/null+++ b/fluxer_rexctl/cmd/email_test.go@@ -0,0 +1,17 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++package cmd++import (+ "strings"+ "testing"+)++func TestTLSFixPointsAtPrivateCA(t *testing.T) {+ for _, msg := range []string{"self-signed certificate", "unable to verify the first certificate", "self-signed certificate in certificate chain"} {+ got := tlsFix(msg, "")+ if !strings.Contains(got, "FLUXER_NODE_EXTRA_CA_CERTS") || !strings.Contains(got, "/etc/fluxer/ca/") || !strings.Contains(got, "ca folder") {+ t.Errorf("tlsFix(%q) = %q, want it to explain trusting a private CA with FLUXER_NODE_EXTRA_CA_CERTS", msg, got)+ }+ }+}diff --git a/fluxer_rexctl/internal/backup/create.go b/fluxer_rexctl/internal/backup/create.goindex ce0333cf8..f88797e73 100644--- a/fluxer_rexctl/internal/backup/create.go+++ b/fluxer_rexctl/internal/backup/create.go@@ -597,7 +597,7 @@ func addInstanceFiles(w *archiveWriter, inst *instance.Instance) error {return err}}- for _, sub := range []string{instance.CertsDir, instance.CaddyDropInDir, stack.GeneratedDir} {+ for _, sub := range []string{instance.CertsDir, instance.CADir, instance.CaddyDropInDir, stack.GeneratedDir} {if err := addTree(w, filepath.Join(dir, filepath.FromSlash(sub)), FilesPrefix+sub, 0); err != nil {return err}diff --git a/fluxer_rexctl/internal/backup/layout_test.go b/fluxer_rexctl/internal/backup/layout_test.goindex c2080c30d..b75f0f20c 100644--- a/fluxer_rexctl/internal/backup/layout_test.go+++ b/fluxer_rexctl/internal/backup/layout_test.go@@ -23,6 +23,7 @@ func oldLayoutDir(t *testing.T) (string, map[string][]byte) {stack.Caddyfile: []byte(":80 {\n}\n"),instance.CustomCompose: []byte("services: {}\n"),filepath.Join(instance.CaddyDropInDir, "x.caddy"): []byte("header X-Mine yes\n"),+ filepath.Join("ca", "ca.pem"): []byte("pem\n"),filepath.Join(instance.StateDirName, instance.StateFileName): []byte(oldState),}for name, data := range files {@@ -113,6 +114,10 @@ func TestNewBackupKeepsGeneratedFolder(t *testing.T) {if got, err := os.ReadFile(inst.Generated(stack.ComposeFile)); err != nil || !bytes.Equal(got, files[stack.ComposeFile]) {t.Fatalf("compose file: %q, %v", got, err)}+ ca := filepath.Join("ca", "ca.pem")+ if got, err := os.ReadFile(inst.Path(ca)); err != nil || !bytes.Equal(got, files[ca]) {+ t.Fatalf("%s: %q, %v", ca, got, err)+ }if _, err := os.Stat(inst.Path(stack.ComposeFile)); !errors.Is(err, os.ErrNotExist) {t.Fatal("a compose file showed up in the instance folder")}diff --git a/fluxer_rexctl/internal/backup/restore.go b/fluxer_rexctl/internal/backup/restore.goindex 4401677a1..97f448197 100644--- a/fluxer_rexctl/internal/backup/restore.go+++ b/fluxer_rexctl/internal/backup/restore.go@@ -473,6 +473,7 @@ func clearInstanceFiles(dir string) error {}for _, p := range []string{filepath.Join(dir, instance.CertsDir),+ filepath.Join(dir, instance.CADir),filepath.Join(dir, instance.CaddyDropInDir),stack.GeneratedPath(dir),filepath.Join(dir, instance.StateDirName, instance.ReleasesDir),diff --git a/fluxer_rexctl/internal/deploy/apply.go b/fluxer_rexctl/internal/deploy/apply.goindex 5a4d4fe7b..0c3ce4d18 100644--- a/fluxer_rexctl/internal/deploy/apply.go+++ b/fluxer_rexctl/internal/deploy/apply.go@@ -4,7 +4,6 @@ package deployimport ("context"- "maps""slices""github.com/fluxerapp/fluxer/fluxer_rexctl/internal/engine"@@ -12,8 +11,6 @@ import ("github.com/fluxerapp/fluxer/fluxer_rexctl/internal/stack")-const edgeService = "edge"-func Apply(ctx context.Context, inst *instance.Instance, e *engine.Engine, o ApplyOptions) (*Change, error) {if err := refuseEjected(inst); err != nil {return nil, err@@ -33,7 +30,7 @@ func Apply(ctx context.Context, inst *instance.Instance, e *engine.Engine, o Appif err != nil {return nil, err}- restartEdge := len(r.RestartNeeded) > 0 || !maps.Equal(mounted, inst.State.Mounted)+ restart := mountRestarts(r.RestartNeeded, mounted, inst.State.Mounted)if err := save(inst); err != nil {return nil, err}@@ -61,11 +58,14 @@ func Apply(ctx context.Context, inst *instance.Instance, e *engine.Engine, o Appreturn nil, err}change := &Change{Restarted: restarted(plan), Removed: slices.Clone(plan.Remove), Applied: true}- if restartEdge && slices.Contains(p.Services(), edgeService) && !slices.Contains(change.Restarted, edgeService) {- if err := p.Restart(context.WithoutCancel(ctx), edgeService); err != nil {+ for _, svc := range restart {+ if !slices.Contains(p.Services(), svc) || slices.Contains(change.Restarted, svc) {+ continue+ }+ if err := p.Restart(context.WithoutCancel(ctx), svc); err != nil {return change, err}- change.Restarted = append(change.Restarted, edgeService)+ change.Restarted = append(change.Restarted, svc)}inst.State.Mounted = mountedif err := save(inst); err != nil {@@ -84,6 +84,17 @@ func up(ctx context.Context, p *engine.Project, wait bool, onEvent func(engine.E})}+func mountRestarts(files []string, mounted, saved map[string]string) []string {+ out := slices.Clone(files)+ for dir, hash := range mounted {+ if saved[dir] != hash {+ out = append(out, stack.MountedDirs[dir]...)+ }+ }+ slices.Sort(out)+ return slices.Compact(out)+}+func restarted(plan *engine.Plan) []string {out := append(slices.Clone(plan.Recreate), plan.Create...)slices.Sort(out)diff --git a/fluxer_rexctl/internal/deploy/apply_test.go b/fluxer_rexctl/internal/deploy/apply_test.gonew file mode 100644index 000000000..74f722fde--- /dev/null+++ b/fluxer_rexctl/internal/deploy/apply_test.go@@ -0,0 +1,29 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++package deploy++import (+ "slices"+ "testing"+)++func TestMountRestarts(t *testing.T) {+ saved := map[string]string{"ca": "c", "certs": "a", "caddy.d": "b"}+ cases := []struct {+ name string+ files []string+ mounted map[string]string+ want []string+ }{+ {"nothing changed", nil, map[string]string{"ca": "c", "certs": "a", "caddy.d": "b"}, nil},+ {"ca changed", nil, map[string]string{"ca": "x", "certs": "a", "caddy.d": "b"}, []string{"api", "worker"}},+ {"certs changed", nil, map[string]string{"ca": "c", "certs": "x", "caddy.d": "b"}, []string{"edge"}},+ {"caddy.d changed", nil, map[string]string{"ca": "c", "certs": "a", "caddy.d": "x"}, []string{"edge"}},+ {"Caddyfile and ca changed", []string{"edge"}, map[string]string{"ca": "x", "certs": "a", "caddy.d": "b"}, []string{"api", "edge", "worker"}},+ }+ for _, c := range cases {+ if got := mountRestarts(c.files, c.mounted, saved); !slices.Equal(got, c.want) {+ t.Errorf("%s: mountRestarts = %v, want %v", c.name, got, c.want)+ }+ }+}diff --git a/fluxer_rexctl/internal/deploy/spec.go b/fluxer_rexctl/internal/deploy/spec.goindex 49b26ba48..ad8fb5750 100644--- a/fluxer_rexctl/internal/deploy/spec.go+++ b/fluxer_rexctl/internal/deploy/spec.go@@ -115,7 +115,7 @@ func save(inst *instance.Instance) error {func mountedHashes(inst *instance.Instance) (map[string]string, error) {out := map[string]string{}- for _, dir := range stack.MountedDirs {+ for dir := range stack.MountedDirs {h := sha256.New()root := inst.Path(dir)err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {diff --git a/fluxer_rexctl/internal/instance/adopt.go b/fluxer_rexctl/internal/instance/adopt.goindex f0c2edb40..78092ca54 100644--- a/fluxer_rexctl/internal/instance/adopt.go+++ b/fluxer_rexctl/internal/instance/adopt.go@@ -301,7 +301,7 @@ func adoptFiles(ctx context.Context, p *AdoptPlan) error {if err := p.keepRunning(); err != nil {return err}- for _, d := range []string{BackupsDir, CertsDir, CaddyDropInDir} {+ for _, d := range []string{BackupsDir, CertsDir, CADir, CaddyDropInDir} {mode := os.FileMode(0o755)if d == BackupsDir {mode = 0o700diff --git a/fluxer_rexctl/internal/instance/envvars.go b/fluxer_rexctl/internal/instance/envvars.goindex c571dcf01..ffcc40bdd 100644--- a/fluxer_rexctl/internal/instance/envvars.go+++ b/fluxer_rexctl/internal/instance/envvars.go@@ -158,7 +158,7 @@ var envVars = []envVar{{"HTTP_PROXY", "network", "The api, worker and gateway don't use it."},{"HTTPS_PROXY", "network", "The api, worker and gateway don't use it."},{"NO_PROXY", "network", ""},- {"FLUXER_NODE_EXTRA_CA_CERTS", "network", "The path of a PEM file of CA certificates that the api and worker trust for outgoing TLS on top of Node's built-in ones. The path is inside their containers. A file you set replaces the system bundle. Add your CA to a copy of that bundle. The Rust services don't use it and take their CA certificates from SSL_CERT_FILE."},+ {"FLUXER_NODE_EXTRA_CA_CERTS", "network", "The path of a PEM file of CA certificates that the api and worker trust for outgoing TLS on top of Node's built-in ones. Use it when your email server has a certificate from your own CA. The path is inside their containers. With Docker Compose they see the ca folder of your instance at /etc/fluxer/ca, and nothing else from the instance folder. A file you set replaces the system bundle. Node's built-in CAs still apply, and the file can hold only your own CA. The Rust services don't use it and take their CA certificates from SSL_CERT_FILE."},{"FLUXER_SSO_ALLOW_PRIVATE_ADDRESSES", "sso", "Use `true` or `false`. When it's empty, Fluxer uses `false`."},{"FLUXER_PASSKEY_RP_ID", "sso", "The relying party ID that passkeys are tied to, a domain such as `chat.example.com`. When it's empty, Fluxer uses FLUXER_DOMAIN. Changing it makes every passkey registered against the old value stop working."},{"FLUXER_PASSKEY_RP_NAME", "sso", "The title browsers show for Fluxer when someone creates or uses a passkey. When it's empty, browsers show `Fluxer`."},diff --git a/fluxer_rexctl/internal/instance/instance.go b/fluxer_rexctl/internal/instance/instance.goindex 385ff14af..86b0126d9 100644--- a/fluxer_rexctl/internal/instance/instance.go+++ b/fluxer_rexctl/internal/instance/instance.go@@ -40,6 +40,7 @@ const (StackDir = "stack"BackupsDir = "backups"CertsDir = "certs"+ CADir = "ca"CaddyDropInDir = "caddy.d"DefaultKeepBackups = 3@@ -160,7 +161,7 @@ func Create(dir, project string) (*Instance, error) {return nil, err}}- for _, d := range []string{CertsDir, CaddyDropInDir} {+ for _, d := range []string{CertsDir, CADir, CaddyDropInDir} {if err := os.MkdirAll(i.Path(d), 0o755); err != nil {return nil, err}diff --git a/fluxer_rexctl/internal/instance/shipped.json b/fluxer_rexctl/internal/instance/shipped.jsonindex 30704ed34..c20604e87 100644--- a/fluxer_rexctl/internal/instance/shipped.json+++ b/fluxer_rexctl/internal/instance/shipped.json@@ -39,7 +39,6 @@"6188588df12b426670119483c24d0b2a3182e28c7c1d6bed241d50323dcd9439","657789086500da432901c143ec001dc46fa125aa5b77d01548ff82065d8fe457","6a946f39a24f77084ea805342984d635f3082ce8e1c23ab4fc17ba8de38886b5",- "6aac6ee98c51e22637905137b6b798eb4b3935ef0d06712cfb0dc677550545eb","6b19e20d94980710724bd400104498c87def9bad5f3032a56c7f09fcf9e1b9b3","6fae7995d47c43a00bd0107ff7b60e0d1e000768dc4b38c34d3e3a0d2a6f8bb3","727d5063ed2c959932d7721d8a806f77852cfb017b2fd3f981e01f31c136c057",@@ -245,7 +244,6 @@"f9b7f2fb56c4b6783543e4640841108919d89449da95c47b35198411e6725928","fa4fb2ea2d033ee34fd5203f7acda3bb13f3b65c0f6f8e2003ccdd16e4eed14e","fb336f82038c6054faf90915cf09a7622e67e34be48365f9676b372536e2996f",- "fc210b0a01624a150751ebd01d00ab4afb42f78cc3d51175067399aae8cc89ef","fcf293ff891bdb0c8dac232bdf2287e66554d691de4db614a1b3d50c13ce641e","fda863ed6260000ebf53aa4e6fe28348a092155fe8d598d7ead1eb2e36c33c03","fdca5099f7d1012ff62b3353d6d79b1044471bd08186ae3ab45ef52042a53857"diff --git a/fluxer_rexctl/internal/stack/bundle.go b/fluxer_rexctl/internal/stack/bundle.goindex 061dcbfbe..e5ad56ea6 100644--- a/fluxer_rexctl/internal/stack/bundle.go+++ b/fluxer_rexctl/internal/stack/bundle.go@@ -22,7 +22,7 @@ func Bundle(dir string, images map[string]string) error {}files = append(files, renderedFile{OverlayFiles[o], data})}- for _, d := range MountedDirs {+ for d := range MountedDirs {if err := os.MkdirAll(filepath.Join(dir, d), 0o755); err != nil {return err}diff --git a/fluxer_rexctl/internal/stack/cacerts_test.go b/fluxer_rexctl/internal/stack/cacerts_test.gonew file mode 100644index 000000000..a6119e5e3--- /dev/null+++ b/fluxer_rexctl/internal/stack/cacerts_test.go@@ -0,0 +1,62 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++package stack++import (+ "slices"+ "strings"+ "testing"++ "go.yaml.in/yaml/v4"+)++func composeVolumes(t *testing.T) map[string][]string {+ t.Helper()+ data, err := ReadFile(Embedded(), "docker-compose.yml")+ if err != nil {+ t.Fatal(err)+ }+ var compose struct {+ Services map[string]struct {+ Volumes []string `yaml:"volumes"`+ } `yaml:"services"`+ }+ if err := yaml.Unmarshal(data, &compose); err != nil {+ t.Fatal(err)+ }+ out := map[string][]string{}+ for name, svc := range compose.Services {+ out[name] = svc.Volumes+ }+ return out+}++func TestNodeServicesMountOnlyTheCAFolder(t *testing.T) {+ vols := composeVolumes(t)+ want := "./ca:/etc/fluxer/ca:ro"+ for _, svc := range []string{"api", "worker"} {+ if !slices.Contains(vols[svc], want) {+ t.Errorf("%s volumes = %v, want %q so FLUXER_NODE_EXTRA_CA_CERTS can point at a CA file", svc, vols[svc], want)+ }+ for _, v := range vols[svc] {+ if strings.HasPrefix(v, "./certs") {+ t.Errorf("%s mounts %q, which holds the edge TLS private keys", svc, v)+ }+ }+ }+ if !slices.Contains(vols["edge"], "./certs:/certs:ro") {+ t.Errorf("edge volumes = %v, want the certs folder", vols["edge"])+ }+}++func TestMountedDirsMatchCompose(t *testing.T) {+ vols := composeVolumes(t)+ for dir, services := range MountedDirs {+ for name, mounts := range vols {+ uses := slices.ContainsFunc(mounts, func(v string) bool { return strings.HasPrefix(v, "./"+dir+":") })+ if uses != slices.Contains(services, name) {+ t.Errorf("%s mounts ./%s = %v, but MountedDirs lists %v", name, dir, uses, services)+ }+ }+ }+}diff --git a/fluxer_rexctl/internal/stack/files/.env.example b/fluxer_rexctl/internal/stack/files/.env.exampleindex bd2905ac4..43b0113e5 100644--- a/fluxer_rexctl/internal/stack/files/.env.example+++ b/fluxer_rexctl/internal/stack/files/.env.example@@ -857,9 +857,12 @@ FLUXER_VAPID_PRIVATE_KEY=# NO_PROXY=# The path of a PEM file of CA certificates that the api and worker trust for-# outgoing TLS on top of Node's built-in ones. The path is inside their-# containers. A file you set replaces the system bundle. Add your CA to a copy-# of that bundle. The Rust services don't use it and take their CA+# outgoing TLS on top of Node's built-in ones. Use it when your email server+# has a certificate from your own CA. The path is inside their containers.+# With Docker Compose they see the ca folder of your instance at+# /etc/fluxer/ca, and nothing else from the instance folder. A file you set+# replaces the system bundle. Node's built-in CAs still apply, and the file+# can hold only your own CA. The Rust services don't use it and take their CA# certificates from SSL_CERT_FILE.# default: /etc/ssl/certs/ca-certificates.crt# rexctl: rexctl config set FLUXER_NODE_EXTRA_CA_CERTSdiff --git a/fluxer_rexctl/internal/stack/files/docker-compose.yml b/fluxer_rexctl/internal/stack/files/docker-compose.ymlindex 92aa74c03..e3f8a34f4 100644--- a/fluxer_rexctl/internal/stack/files/docker-compose.yml+++ b/fluxer_rexctl/internal/stack/files/docker-compose.yml@@ -532,6 +532,8 @@ services:FLUXER_POSTGRES_MAX_CONNECTIONS: "${FLUXER_API_POSTGRES_MAX_CONNECTIONS:-25}"FLUXER_API_PRESIGNED_ATTACHMENT_UPLOADS_ENABLED: "${FLUXER_API_PRESIGNED_ATTACHMENT_UPLOADS_ENABLED:-true}"FLUXER_API_EMBEDDED_WORKER: "${FLUXER_API_EMBEDDED_WORKER:-false}"+ volumes:+ - ./ca:/etc/fluxer/ca:rohealthcheck:test: ["CMD-SHELL", "bash -c 'exec 3<>/dev/tcp/127.0.0.1/8080 && printf \"GET /_health HTTP/1.0\\r\\nHost: 127.0.0.1\\r\\n\\r\\n\" >&3 && head -n 1 <&3 | grep -q \" 200 \"'"]<<: *fluxer-app-healthcheck@@ -565,6 +567,8 @@ services:FLUXER_API_WORKER_ENABLE_CRON_SCHEDULER: "true"FLUXER_POSTGRES_MAX_CONNECTIONS: "${FLUXER_WORKER_POSTGRES_MAX_CONNECTIONS:-25}"FLUXER_WORKER_POSTGRES_SYNCHRONOUS_COMMIT: "${FLUXER_WORKER_POSTGRES_SYNCHRONOUS_COMMIT:-}"+ volumes:+ - ./ca:/etc/fluxer/ca:rohealthcheck:test: ["CMD-SHELL", "find /tmp/fluxer-worker-heartbeat -newermt '-30 seconds' | grep -q ."]<<: *fluxer-app-healthcheckdiff --git a/fluxer_rexctl/internal/stack/stack.go b/fluxer_rexctl/internal/stack/stack.goindex 89d07a5fe..e6a32ba30 100644--- a/fluxer_rexctl/internal/stack/stack.go+++ b/fluxer_rexctl/internal/stack/stack.go@@ -49,7 +49,13 @@ var MountedFiles = map[string][]string{Caddyfile: {"edge"},}-var MountedDirs = []string{"certs", "caddy.d"}+const NodeCADir = "/etc/fluxer/ca"++var MountedDirs = map[string][]string{+ "ca": {"api", "worker"},+ "caddy.d": {"edge"},+ "certs": {"edge"},+}var (ErrUnknownOverlay = errors.New("stack: unknown overlay")@@ -313,7 +319,7 @@ func RenderAt(set *Set, selected []Overlay, images map[string]string, project, dif err != nil {return nil, err}- for _, d := range MountedDirs {+ for d := range MountedDirs {if err := os.MkdirAll(filepath.Join(dir, d), 0o755); err != nil {return nil, err}