mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-19 04:26:34 +00:00
Compare commits
2 Commits
0.14.4
...
0.15.0-rc1
Author | SHA1 | Date | |
---|---|---|---|
77867f17e3 | |||
5aed707354 |
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
@ -12,7 +12,7 @@ jobs:
|
|||||||
GO111MODULE: off
|
GO111MODULE: off
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [1.16.x]
|
go-version: [1.17.x]
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
2
.github/workflows/publish.yaml
vendored
2
.github/workflows/publish.yaml
vendored
@ -9,7 +9,7 @@ jobs:
|
|||||||
publish:
|
publish:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [ 1.16.x ]
|
go-version: [ 1.17.x ]
|
||||||
os: [ ubuntu-latest ]
|
os: [ ubuntu-latest ]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -20,21 +20,36 @@ services:
|
|||||||
|
|
||||||
nats:
|
nats:
|
||||||
image: docker.io/library/nats-streaming:0.22.0
|
image: docker.io/library/nats-streaming:0.22.0
|
||||||
|
# nobody
|
||||||
|
user: "65534"
|
||||||
command:
|
command:
|
||||||
- "/nats-streaming-server"
|
- "/nats-streaming-server"
|
||||||
- "-m"
|
- "-m"
|
||||||
- "8222"
|
- "8222"
|
||||||
- "--store=memory"
|
- "--store=file"
|
||||||
|
- "--dir=/nats"
|
||||||
- "--cluster_id=faas-cluster"
|
- "--cluster_id=faas-cluster"
|
||||||
|
volumes:
|
||||||
|
# Data directory
|
||||||
|
- type: bind
|
||||||
|
source: ./nats
|
||||||
|
target: /nats
|
||||||
# ports:
|
# ports:
|
||||||
# - "127.0.0.1:8222:8222"
|
# - "127.0.0.1:8222:8222"
|
||||||
|
|
||||||
prometheus:
|
prometheus:
|
||||||
image: docker.io/prom/prometheus:v2.14.0
|
image: docker.io/prom/prometheus:v2.14.0
|
||||||
|
# nobody
|
||||||
|
user: "65534"
|
||||||
volumes:
|
volumes:
|
||||||
|
# Config directory
|
||||||
- type: bind
|
- type: bind
|
||||||
source: ./prometheus.yml
|
source: ./prometheus.yml
|
||||||
target: /etc/prometheus/prometheus.yml
|
target: /etc/prometheus/prometheus.yml
|
||||||
|
# Data directory
|
||||||
|
- type: bind
|
||||||
|
source: ./prometheus
|
||||||
|
target: /prometheus
|
||||||
cap_add:
|
cap_add:
|
||||||
- CAP_NET_RAW
|
- CAP_NET_RAW
|
||||||
ports:
|
ports:
|
||||||
|
@ -8,6 +8,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/alexellis/k3sup/pkg/env"
|
"github.com/alexellis/k3sup/pkg/env"
|
||||||
"github.com/compose-spec/compose-go/loader"
|
"github.com/compose-spec/compose-go/loader"
|
||||||
@ -26,7 +28,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
workingDirectoryPermission = 0644
|
// workingDirectoryPermission user read/write/execute, group and others: read-only
|
||||||
|
workingDirectoryPermission = 0744
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
@ -145,6 +148,28 @@ func (s *Supervisor) Start(svcs []Service) error {
|
|||||||
Type: "bind",
|
Type: "bind",
|
||||||
Options: []string{"rbind", "rw"},
|
Options: []string{"rbind", "rw"},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Only create directories, not files.
|
||||||
|
// Some files don't have a suffix, such as secrets.
|
||||||
|
if len(path.Ext(mnt.Src)) == 0 &&
|
||||||
|
!strings.HasPrefix(mnt.Src, "/var/lib/faasd/secrets/") {
|
||||||
|
// src is already prefixed with wd from an earlier step
|
||||||
|
src := mnt.Src
|
||||||
|
fmt.Printf("Creating local directory: %s\n", src)
|
||||||
|
if err := os.MkdirAll(src, workingDirectoryPermission); err != nil {
|
||||||
|
if !errors.Is(os.ErrExist, err) {
|
||||||
|
fmt.Printf("Unable to create: %s, %s\n", src, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(svc.User) > 0 {
|
||||||
|
uid, err := strconv.Atoi(svc.User)
|
||||||
|
if err == nil {
|
||||||
|
if err := os.Chown(src, uid, -1); err != nil {
|
||||||
|
fmt.Printf("Unable to chown: %s to %d, error: %s\n", src, uid, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user