Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/db/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ EOF`}
func NewHostConfig() container.HostConfig {
hostPort := strconv.FormatUint(uint64(utils.Config.Db.Port), 10)
hostConfig := container.HostConfig{
PortBindings: nat.PortMap{"5432/tcp": []nat.PortBinding{{HostPort: hostPort}}},
PortBindings: nat.PortMap{"5432/tcp": []nat.PortBinding{{HostIP: utils.Config.Db.HostIP, HostPort: hostPort}}},
RestartPolicy: container.RestartPolicy{Name: container.RestartPolicyUnlessStopped},
Binds: []string{
utils.DbId + ":/var/lib/postgresql/data",
Expand Down
1 change: 1 addition & 0 deletions internal/functions/serve/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ EOF
dockerInspectorPort := nat.Port(fmt.Sprintf("%d/tcp", dockerRuntimeInspectorPort))
exposedPorts[dockerInspectorPort] = struct{}{}
portBindings[dockerInspectorPort] = []nat.PortBinding{{
HostIP: utils.Config.EdgeRuntime.HostIP,
HostPort: strconv.FormatUint(uint64(utils.Config.EdgeRuntime.InspectorPort), 10),
}}
}
Expand Down
12 changes: 7 additions & 5 deletions internal/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ EOF
},
container.HostConfig{
Binds: bind,
PortBindings: nat.PortMap{"4000/tcp": []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Analytics.Port), 10)}}},
PortBindings: nat.PortMap{"4000/tcp": []nat.PortBinding{{HostIP: utils.Config.Analytics.HostIP, HostPort: strconv.FormatUint(uint64(utils.Config.Analytics.Port), 10)}}},
RestartPolicy: container.RestartPolicy{Name: container.RestartPolicyUnlessStopped},
},
network.NetworkingConfig{
Expand Down Expand Up @@ -524,6 +524,7 @@ EOF
container.HostConfig{
Binds: binds,
PortBindings: nat.PortMap{nat.Port(fmt.Sprintf("%d/tcp", dockerPort)): []nat.PortBinding{{
HostIP: utils.Config.Api.HostIP,
HostPort: strconv.FormatUint(uint64(utils.Config.Api.Port), 10)},
}},
RestartPolicy: container.RestartPolicy{Name: container.RestartPolicyUnlessStopped},
Expand Down Expand Up @@ -842,12 +843,12 @@ EOF

// Start Mailpit
if utils.Config.Inbucket.Enabled && !isContainerExcluded(utils.Config.Inbucket.Image, excluded) {
inbucketPortBindings := nat.PortMap{"8025/tcp": []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.Port), 10)}}}
inbucketPortBindings := nat.PortMap{"8025/tcp": []nat.PortBinding{{HostIP: utils.Config.Inbucket.HostIP, HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.Port), 10)}}}
if utils.Config.Inbucket.SmtpPort != 0 {
inbucketPortBindings["1025/tcp"] = []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.SmtpPort), 10)}}
inbucketPortBindings["1025/tcp"] = []nat.PortBinding{{HostIP: utils.Config.Inbucket.HostIP, HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.SmtpPort), 10)}}
}
if utils.Config.Inbucket.Pop3Port != 0 {
inbucketPortBindings["1110/tcp"] = []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.Pop3Port), 10)}}
inbucketPortBindings["1110/tcp"] = []nat.PortBinding{{HostIP: utils.Config.Inbucket.HostIP, HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.Pop3Port), 10)}}
}
if _, err := utils.DockerStart(
ctx,
Expand Down Expand Up @@ -1154,7 +1155,7 @@ EOF
},
},
container.HostConfig{
PortBindings: nat.PortMap{"3000/tcp": []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Studio.Port), 10)}}},
PortBindings: nat.PortMap{"3000/tcp": []nat.PortBinding{{HostIP: utils.Config.Studio.HostIP, HostPort: strconv.FormatUint(uint64(utils.Config.Studio.Port), 10)}}},
RestartPolicy: container.RestartPolicy{Name: container.RestartPolicyUnlessStopped},
},
network.NetworkingConfig{
Expand Down Expand Up @@ -1230,6 +1231,7 @@ EOF
},
container.HostConfig{
PortBindings: nat.PortMap{nat.Port(fmt.Sprintf("%d/tcp", dockerPort)): []nat.PortBinding{{
HostIP: utils.Config.Db.Pooler.HostIP,
HostPort: strconv.FormatUint(uint64(utils.Config.Db.Pooler.Port), 10)},
}},
RestartPolicy: container.RestartPolicy{Name: container.RestartPolicyUnlessStopped},
Expand Down
1 change: 1 addition & 0 deletions pkg/config/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type (
Image string `toml:"-"`
KongImage string `toml:"-"`
Port uint16 `toml:"port"`
HostIP string `toml:"host_ip"`
Tls tlsKong `toml:"tls"`
// TODO: replace [auth|studio].api_url
ExternalUrl string `toml:"external_url"`
Expand Down
13 changes: 12 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ type (
Enabled bool `toml:"enabled"`
Image string `toml:"-"`
Port uint16 `toml:"port"`
HostIP string `toml:"host_ip"`
ApiUrl string `toml:"api_url"`
OpenaiApiKey Secret `toml:"openai_api_key"`
PgmetaImage string `toml:"-"`
Expand All @@ -181,6 +182,7 @@ type (
Enabled bool `toml:"enabled"`
Image string `toml:"-"`
Port uint16 `toml:"port"`
HostIP string `toml:"host_ip"`
SmtpPort uint16 `toml:"smtp_port"`
Pop3Port uint16 `toml:"pop3_port"`
AdminEmail string `toml:"admin_email"`
Expand All @@ -192,6 +194,7 @@ type (
Image string `toml:"-"`
Policy RequestPolicy `toml:"policy"`
InspectorPort uint16 `toml:"inspector_port"`
HostIP string `toml:"host_ip"`
Secrets SecretsConfig `toml:"secrets"`
DenoVersion uint `toml:"deno_version"`
}
Expand All @@ -212,6 +215,7 @@ type (
Image string `toml:"-"`
VectorImage string `toml:"-"`
Port uint16 `toml:"port"`
HostIP string `toml:"host_ip"`
Backend LogflareBackend `toml:"backend"`
GcpProjectId string `toml:"gcp_project_id"`
GcpProjectNumber string `toml:"gcp_project_number"`
Expand Down Expand Up @@ -334,6 +338,7 @@ func NewConfig(editors ...ConfigEditor) config {
Api: api{
Image: Images.Postgrest,
KongImage: Images.Kong,
HostIP: "127.0.0.1",
Tls: tlsKong{
CertContent: kongCert,
KeyContent: kongKey,
Expand All @@ -342,12 +347,14 @@ func NewConfig(editors ...ConfigEditor) config {
Db: db{
Image: Images.Pg,
Password: "postgres",
HostIP: "127.0.0.1",
RootKey: Secret{
Value: "d4dc5b6d4a1d6a10b2c1e76112c994d65db7cec380572cc1839624d4be3fa275",
},
Pooler: pooler{
Image: Images.Supavisor,
TenantId: "pooler-dev",
HostIP: "127.0.0.1",
EncryptionKey: "12345678901234567890123456789032",
SecretKeyBase: "EAx3IQ/wRG1v47ZD4NE4/9RzBI8Jmil3x0yhcW4V2NHBP6c2iPIzwjofi2Ep4HIG",
},
Expand Down Expand Up @@ -389,22 +396,26 @@ func NewConfig(editors ...ConfigEditor) config {
},
Inbucket: inbucket{
Image: Images.Inbucket,
HostIP: "127.0.0.1",
AdminEmail: "[email protected]",
SenderName: "Admin",
},
Studio: studio{
Image: Images.Studio,
HostIP: "127.0.0.1",
PgmetaImage: Images.Pgmeta,
},
Analytics: analytics{
Image: Images.Logflare,
VectorImage: Images.Vector,
HostIP: "127.0.0.1",
ApiKey: "api-key",
// Defaults to bigquery for backwards compatibility with existing config.toml
Backend: LogflareBigQuery,
},
EdgeRuntime: edgeRuntime{
Image: Images.EdgeRuntime,
Image: Images.EdgeRuntime,
HostIP: "127.0.0.1",
},
}}
for _, apply := range editors {
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type (
db struct {
Image string `toml:"-"`
Port uint16 `toml:"port"`
HostIP string `toml:"host_ip"`
ShadowPort uint16 `toml:"shadow_port"`
MajorVersion uint `toml:"major_version"`
Password string `toml:"-"`
Expand All @@ -103,6 +104,7 @@ type (
Enabled bool `toml:"enabled"`
Image string `toml:"-"`
Port uint16 `toml:"port"`
HostIP string `toml:"host_ip"`
PoolMode PoolMode `toml:"pool_mode"`
DefaultPoolSize uint `toml:"default_pool_size"`
MaxClientConn uint `toml:"max_client_conn"`
Expand Down