Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2ee4169

Browse filesBrowse files
committed
Merge branch 'embeddedui' into 'master'
feat: embedUI -> embeddedUI See merge request postgres-ai/database-lab!398
2 parents a395b27 + 23d441d commit 2ee4169
Copy full SHA for 2ee4169

13 files changed

+59
-59
lines changed

‎cmd/database-lab/main.go

Copy file name to clipboardExpand all lines: cmd/database-lab/main.go
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"github.com/pkg/errors"
2222

2323
"gitlab.com/postgres-ai/database-lab/v3/internal/cloning"
24-
"gitlab.com/postgres-ai/database-lab/v3/internal/embedui"
24+
"gitlab.com/postgres-ai/database-lab/v3/internal/embeddedui"
2525
"gitlab.com/postgres-ai/database-lab/v3/internal/estimator"
2626
"gitlab.com/postgres-ai/database-lab/v3/internal/observer"
2727
"gitlab.com/postgres-ai/database-lab/v3/internal/platform"
@@ -152,11 +152,11 @@ func main() {
152152
Restore: retrievalSvc.CollectRestoreTelemetry(),
153153
})
154154

155-
embedUI := embedui.New(cfg.EmbedUI, engProps, runner, docker)
155+
embeddedUI := embeddedui.New(cfg.EmbeddedUI, engProps, runner, docker)
156156
server := srv.NewServer(&cfg.Server, &cfg.Global, engProps, docker, cloningSvc, provisioner, retrievalSvc, platformSvc, obs, est, pm, tm)
157157
shutdownCh := setShutdownListener()
158158

159-
go setReloadListener(ctx, provisioner, tm, retrievalSvc, pm, cloningSvc, platformSvc, est, embedUI, server)
159+
go setReloadListener(ctx, provisioner, tm, retrievalSvc, pm, cloningSvc, platformSvc, est, embeddedUI, server)
160160

161161
server.InitHandlers()
162162

@@ -166,10 +166,10 @@ func main() {
166166
}
167167
}()
168168

169-
if cfg.EmbedUI.Enabled {
169+
if cfg.EmbeddedUI.Enabled {
170170
go func() {
171-
if err := embedUI.Run(ctx); err != nil {
172-
log.Err("Failed to start Embed UI container:", err.Error())
171+
if err := embeddedUI.Run(ctx); err != nil {
172+
log.Err("Failed to start embedded UI container:", err.Error())
173173
return
174174
}
175175
}()
@@ -223,7 +223,7 @@ func getEngineProperties(ctx context.Context, dockerCLI *client.Client, cfg *con
223223
}
224224

225225
func reloadConfig(ctx context.Context, provisionSvc *provision.Provisioner, tm *telemetry.Agent, retrievalSvc *retrieval.Retrieval,
226-
pm *pool.Manager, cloningSvc *cloning.Base, platformSvc *platform.Service, est *estimator.Estimator, embedUI *embedui.UIManager,
226+
pm *pool.Manager, cloningSvc *cloning.Base, platformSvc *platform.Service, est *estimator.Estimator, embeddedUI *embeddedui.UIManager,
227227
server *srv.Server) error {
228228
cfg, err := config.LoadConfiguration()
229229
if err != nil {
@@ -247,7 +247,7 @@ func reloadConfig(ctx context.Context, provisionSvc *provision.Provisioner, tm *
247247
return err
248248
}
249249

250-
if err := embedUI.Reload(ctx, cfg.EmbedUI); err != nil {
250+
if err := embeddedUI.Reload(ctx, cfg.EmbeddedUI); err != nil {
251251
return err
252252
}
253253

@@ -268,15 +268,15 @@ func reloadConfig(ctx context.Context, provisionSvc *provision.Provisioner, tm *
268268
}
269269

270270
func setReloadListener(ctx context.Context, provisionSvc *provision.Provisioner, tm *telemetry.Agent, retrievalSvc *retrieval.Retrieval,
271-
pm *pool.Manager, cloningSvc *cloning.Base, platformSvc *platform.Service, est *estimator.Estimator, embedUI *embedui.UIManager,
271+
pm *pool.Manager, cloningSvc *cloning.Base, platformSvc *platform.Service, est *estimator.Estimator, embeddedUI *embeddedui.UIManager,
272272
server *srv.Server) {
273273
reloadCh := make(chan os.Signal, 1)
274274
signal.Notify(reloadCh, syscall.SIGHUP)
275275

276276
for range reloadCh {
277277
log.Msg("Reloading configuration")
278278

279-
if err := reloadConfig(ctx, provisionSvc, tm, retrievalSvc, pm, cloningSvc, platformSvc, est, embedUI, server); err != nil {
279+
if err := reloadConfig(ctx, provisionSvc, tm, retrievalSvc, pm, cloningSvc, platformSvc, est, embeddedUI, server); err != nil {
280280
log.Err("Failed to reload configuration", err)
281281
}
282282

‎configs/config.example.logical_generic.yml

Copy file name to clipboardExpand all lines: configs/config.example.logical_generic.yml
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

26-
# Embed UI. Controls the application to provide a user interface to DLE API.
27-
embedUI:
26+
# Embedded UI. Controls the application to provide a user interface to DLE API.
27+
embeddedUI:
2828
enabled: true
2929

3030
# Docker image of the UI application.
3131
dockerImage: "postgresai/ce-ui:latest"
3232

33-
# Host or IP address, from which the Embed UI container accepts HTTP connections.
33+
# Host or IP address, from which the embedded UI container accepts HTTP connections.
3434
# By default, use a loop-back to accept only local connections.
3535
# The empty string means "all available addresses".
3636
host: "127.0.0.1"

‎configs/config.example.logical_rds_iam.yml

Copy file name to clipboardExpand all lines: configs/config.example.logical_rds_iam.yml
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

26-
# Embed UI. Controls the application to provide a user interface to DLE API.
27-
embedUI:
26+
# Embedded UI. Controls the application to provide a user interface to DLE API.
27+
embeddedUI:
2828
enabled: true
2929

3030
# Docker image of the UI application.
3131
dockerImage: "postgresai/ce-ui:latest"
3232

33-
# Host or IP address, from which the Embed UI container accepts HTTP connections.
33+
# Host or IP address, from which the embedded UI container accepts HTTP connections.
3434
# By default, use a loop-back to accept only local connections.
3535
# The empty string means "all available addresses".
3636
host: "127.0.0.1"

‎configs/config.example.physical_generic.yml

Copy file name to clipboardExpand all lines: configs/config.example.physical_generic.yml
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

26-
# Embed UI. Controls the application to provide a user interface to DLE API.
27-
embedUI:
26+
# Embedded UI. Controls the application to provide a user interface to DLE API.
27+
embeddedUI:
2828
enabled: true
2929

3030
# Docker image of the UI application.
3131
dockerImage: "postgresai/ce-ui:latest"
3232

33-
# Host or IP address, from which the Embed UI container accepts HTTP connections.
33+
# Host or IP address, from which the embedded UI container accepts HTTP connections.
3434
# By default, use a loop-back to accept only local connections.
3535
# The empty string means "all available addresses".
3636
host: "127.0.0.1"

‎configs/config.example.physical_walg.yml

Copy file name to clipboardExpand all lines: configs/config.example.physical_walg.yml
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

26-
# Embed UI. Controls the application to provide a user interface to DLE API.
27-
embedUI:
26+
# Embedded UI. Controls the application to provide a user interface to DLE API.
27+
embeddedUI:
2828
enabled: true
2929

3030
# Docker image of the UI application.
3131
dockerImage: "postgresai/ce-ui:latest"
3232

33-
# Host or IP address, from which the Embed UI container accepts HTTP connections.
33+
# Host or IP address, from which the embedded UI container accepts HTTP connections.
3434
# By default, use a loop-back to accept only local connections.
3535
# The empty string means "all available addresses".
3636
host: "127.0.0.1"

‎internal/embedui/embed_ui.go renamed to ‎internal/embeddedui/embedded_ui.go

Copy file name to clipboardExpand all lines: internal/embeddedui/embedded_ui.go
+19-19Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
2021 © Postgres.ai
33
*/
44

5-
// Package embedui manages Embed UI container.
6-
package embedui
5+
// Package embeddedui manages embedded UI container.
6+
package embeddedui
77

88
import (
99
"context"
@@ -40,15 +40,15 @@ const (
4040
healthCheckRetries = 5
4141
)
4242

43-
// Config defines configs for a Embed UI container.
43+
// Config defines configs for a embedded UI container.
4444
type Config struct {
4545
Enabled bool `yaml:"enabled"`
4646
DockerImage string `yaml:"dockerImage"`
4747
Host string `yaml:"host"`
4848
Port int `yaml:"port"`
4949
}
5050

51-
// UIManager manages Embed UI container.
51+
// UIManager manages embedded UI container.
5252
type UIManager struct {
5353
runner runners.Runner
5454
docker *client.Client
@@ -89,16 +89,16 @@ func (ui *UIManager) isConfigChanged(cfg Config) bool {
8989
ui.cfg.Port != cfg.Port
9090
}
9191

92-
// Run creates a new Embed UI container.
92+
// Run creates a new embedded UI container.
9393
func (ui *UIManager) Run(ctx context.Context) error {
9494
if err := docker.PrepareImage(ui.runner, ui.cfg.DockerImage); err != nil {
9595
return fmt.Errorf("failed to prepare Docker image: %w", err)
9696
}
9797

98-
embedUI, err := ui.docker.ContainerCreate(ctx,
98+
embeddedUI, err := ui.docker.ContainerCreate(ctx,
9999
&container.Config{
100100
Labels: map[string]string{
101-
cont.DBLabSatelliteLabel: cont.DBLabEmbedUILabel,
101+
cont.DBLabSatelliteLabel: cont.DBLabEmbeddedUILabel,
102102
cont.DBLabInstanceIDLabel: ui.engProps.InstanceID,
103103
cont.DBLabEngineNameLabel: ui.engProps.ContainerName,
104104
},
@@ -125,27 +125,27 @@ func (ui *UIManager) Run(ctx context.Context) error {
125125
},
126126
&network.NetworkingConfig{},
127127
nil,
128-
getEmbedUIName(ui.engProps.InstanceID),
128+
getEmbeddedUIName(ui.engProps.InstanceID),
129129
)
130130

131131
if err != nil {
132-
return fmt.Errorf("failed to prepare Docker image for Embed UI: %w", err)
132+
return fmt.Errorf("failed to prepare Docker image for embedded UI: %w", err)
133133
}
134134

135-
if err := networks.Connect(ctx, ui.docker, ui.engProps.InstanceID, embedUI.ID); err != nil {
135+
if err := networks.Connect(ctx, ui.docker, ui.engProps.InstanceID, embeddedUI.ID); err != nil {
136136
return fmt.Errorf("failed to connect UI container to the internal Docker network: %w", err)
137137
}
138138

139-
if err := ui.docker.ContainerStart(ctx, embedUI.ID, types.ContainerStartOptions{}); err != nil {
140-
return fmt.Errorf("failed to start container %q: %w", embedUI.ID, err)
139+
if err := ui.docker.ContainerStart(ctx, embeddedUI.ID, types.ContainerStartOptions{}); err != nil {
140+
return fmt.Errorf("failed to start container %q: %w", embeddedUI.ID, err)
141141
}
142142

143143
reportLaunching(ui.cfg)
144144

145145
return nil
146146
}
147147

148-
// Restart destroys and creates a new Embed UI container.
148+
// Restart destroys and creates a new embedded UI container.
149149
func (ui *UIManager) Restart(ctx context.Context) error {
150150
ui.Stop(ctx)
151151

@@ -156,22 +156,22 @@ func (ui *UIManager) Restart(ctx context.Context) error {
156156
return nil
157157
}
158158

159-
// Stop removes a Embed UI container.
159+
// Stop removes a embedded UI container.
160160
func (ui *UIManager) Stop(ctx context.Context) {
161-
tools.RemoveContainer(ctx, ui.docker, getEmbedUIName(ui.engProps.InstanceID), cont.StopTimeout)
161+
tools.RemoveContainer(ctx, ui.docker, getEmbeddedUIName(ui.engProps.InstanceID), cont.StopTimeout)
162162
}
163163

164-
func getEmbedUIName(instanceID string) string {
165-
return cont.DBLabEmbedUILabel + "_" + instanceID
164+
func getEmbeddedUIName(instanceID string) string {
165+
return cont.DBLabEmbeddedUILabel + "_" + instanceID
166166
}
167167

168-
// reportLaunching reports the launch of the Embed UI container.
168+
// reportLaunching reports the launch of the embedded UI container.
169169
func reportLaunching(cfg Config) {
170170
host := engine.DefaultListenerHost
171171

172172
if cfg.Host != "" {
173173
host = cfg.Host
174174
}
175175

176-
log.Msg(fmt.Sprintf("Embed UI has started successfully on %s:%d.", host, cfg.Port))
176+
log.Msg(fmt.Sprintf("Embedded UI has started successfully on %s:%d.", host, cfg.Port))
177177
}

‎internal/retrieval/engine/postgres/tools/cont/container.go

Copy file name to clipboardExpand all lines: internal/retrieval/engine/postgres/tools/cont/container.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ const (
5353
DBLabDumpLabel = "dblab_dump"
5454
// DBLabRestoreLabel defines a label value for restore containers.
5555
DBLabRestoreLabel = "dblab_restore"
56-
// DBLabEmbedUILabel defines a label value for embed UI containers.
57-
DBLabEmbedUILabel = "dblab_embed_ui"
56+
// DBLabEmbeddedUILabel defines a label value for embedded UI containers.
57+
DBLabEmbeddedUILabel = "dblab_embedded_ui"
5858

5959
// DBLabRunner defines a label to mark runner containers.
6060
DBLabRunner = "dblab_runner"

‎pkg/config/config.go

Copy file name to clipboardExpand all lines: pkg/config/config.go
+11-11Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"gopkg.in/yaml.v2"
1616

1717
"gitlab.com/postgres-ai/database-lab/v3/internal/cloning"
18-
"gitlab.com/postgres-ai/database-lab/v3/internal/embedui"
18+
"gitlab.com/postgres-ai/database-lab/v3/internal/embeddedui"
1919
"gitlab.com/postgres-ai/database-lab/v3/internal/estimator"
2020
"gitlab.com/postgres-ai/database-lab/v3/internal/observer"
2121
"gitlab.com/postgres-ai/database-lab/v3/internal/platform"
@@ -35,16 +35,16 @@ const (
3535

3636
// Config contains a common database-lab configuration.
3737
type Config struct {
38-
Server srvCfg.Config `yaml:"server"`
39-
Provision provision.Config `yaml:"provision"`
40-
Cloning cloning.Config `yaml:"cloning"`
41-
Platform platform.Config `yaml:"platform"`
42-
Global global.Config `yaml:"global"`
43-
Retrieval retConfig.Config `yaml:"retrieval"`
44-
Observer observer.Config `yaml:"observer"`
45-
Estimator estimator.Config `yaml:"estimator"`
46-
PoolManager pool.Config `yaml:"poolManager"`
47-
EmbedUI embedui.Config `yaml:"embedUI"`
38+
Server srvCfg.Config `yaml:"server"`
39+
Provision provision.Config `yaml:"provision"`
40+
Cloning cloning.Config `yaml:"cloning"`
41+
Platform platform.Config `yaml:"platform"`
42+
Global global.Config `yaml:"global"`
43+
Retrieval retConfig.Config `yaml:"retrieval"`
44+
Observer observer.Config `yaml:"observer"`
45+
Estimator estimator.Config `yaml:"estimator"`
46+
PoolManager pool.Config `yaml:"poolManager"`
47+
EmbeddedUI embeddedui.Config `yaml:"embeddedUI"`
4848
}
4949

5050
// LoadConfiguration instances a new application configuration.

‎test/1.synthetic.sh

Copy file name to clipboardExpand all lines: test/1.synthetic.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-mast
8181
yq eval -i '
8282
.global.debug = true |
8383
.global.telemetry.enabled = false |
84-
.embedUI.enabled = false |
84+
.embeddedUI.enabled = false |
8585
.server.port = env(DLE_SERVER_PORT) |
8686
.provision.portPool.from = env(DLE_PORT_POOL_FROM) |
8787
.provision.portPool.to = env(DLE_PORT_POOL_TO) |

‎test/2.logical_generic.sh

Copy file name to clipboardExpand all lines: test/2.logical_generic.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-mast
8787
yq eval -i '
8888
.global.debug = true |
8989
.global.telemetry.enabled = false |
90-
.embedUI.enabled = false |
90+
.embeddedUI.enabled = false |
9191
.server.port = env(DLE_SERVER_PORT) |
9292
.poolManager.mountDir = env(DLE_TEST_MOUNT_DIR) |
9393
.provision.portPool.from = env(DLE_PORT_POOL_FROM) |

‎test/3.physical_walg.sh

Copy file name to clipboardExpand all lines: test/3.physical_walg.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-mast
4747
yq eval -i '
4848
.global.debug = true |
4949
.global.telemetry.enabled = false |
50-
.embedUI.enabled = false |
50+
.embeddedUI.enabled = false |
5151
.server.port = env(DLE_SERVER_PORT) |
5252
.poolManager.mountDir = env(DLE_TEST_MOUNT_DIR) |
5353
.provision.portPool.from = env(DLE_PORT_POOL_FROM) |

‎test/4.physical_basebackup.sh

Copy file name to clipboardExpand all lines: test/4.physical_basebackup.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-mast
102102
yq eval -i '
103103
.global.debug = true |
104104
.global.telemetry.enabled = false |
105-
.embedUI.enabled = false |
105+
.embeddedUI.enabled = false |
106106
.server.port = env(DLE_SERVER_PORT) |
107107
.poolManager.mountDir = env(DLE_TEST_MOUNT_DIR) |
108108
.provision.portPool.from = env(DLE_PORT_POOL_FROM) |

‎test/5.logical_rds.sh

Copy file name to clipboardExpand all lines: test/5.logical_rds.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-mast
4343
yq eval -i '
4444
.global.debug = true |
4545
.global.telemetry.enabled = false |
46-
.embedUI.enabled = false |
46+
.embeddedUI.enabled = false |
4747
.server.port = env(DLE_SERVER_PORT) |
4848
.poolManager.mountDir = env(DLE_TEST_MOUNT_DIR) |
4949
.provision.portPool.from = env(DLE_PORT_POOL_FROM) |

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.