Skip to content

Commit f2f8126

Browse files
anatolystansleragneum
authored andcommitted
chore: rename Local UI to Embed UI as a more suitable name and ce-ui Docker image to run UI application
1 parent 7b00a79 commit f2f8126

13 files changed

+54
-54
lines changed

Diff for: cmd/database-lab/main.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ 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"
2425
"gitlab.com/postgres-ai/database-lab/v3/internal/estimator"
25-
"gitlab.com/postgres-ai/database-lab/v3/internal/localui"
2626
"gitlab.com/postgres-ai/database-lab/v3/internal/observer"
2727
"gitlab.com/postgres-ai/database-lab/v3/internal/platform"
2828
"gitlab.com/postgres-ai/database-lab/v3/internal/provision"
@@ -152,11 +152,11 @@ func main() {
152152
Restore: retrievalSvc.CollectRestoreTelemetry(),
153153
})
154154

155-
localUI := localui.New(cfg.LocalUI, engProps, runner, docker)
155+
embedUI := embedui.New(cfg.EmbedUI, 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, localUI, server)
159+
go setReloadListener(ctx, provisioner, tm, retrievalSvc, pm, cloningSvc, platformSvc, est, embedUI, server)
160160

161161
server.InitHandlers()
162162

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

169-
if cfg.LocalUI.Enabled {
169+
if cfg.EmbedUI.Enabled {
170170
go func() {
171-
if err := localUI.Run(ctx); err != nil {
172-
log.Err("Failed to start local UI container:", err.Error())
171+
if err := embedUI.Run(ctx); err != nil {
172+
log.Err("Failed to start Embed 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, localUI *localui.UIManager,
226+
pm *pool.Manager, cloningSvc *cloning.Base, platformSvc *platform.Service, est *estimator.Estimator, embedUI *embedui.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 := localUI.Reload(ctx, cfg.LocalUI); err != nil {
250+
if err := embedUI.Reload(ctx, cfg.EmbedUI); 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, localUI *localui.UIManager,
271+
pm *pool.Manager, cloningSvc *cloning.Base, platformSvc *platform.Service, est *estimator.Estimator, embedUI *embedui.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, localUI, server); err != nil {
279+
if err := reloadConfig(ctx, provisionSvc, tm, retrievalSvc, pm, cloningSvc, platformSvc, est, embedUI, server); err != nil {
280280
log.Err("Failed to reload configuration", err)
281281
}
282282

Diff for: configs/config.example.logical_generic.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

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

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

33-
# Host or IP address, from which the Local UI container accepts HTTP connections.
33+
# Host or IP address, from which the Embed 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"

Diff for: configs/config.example.logical_rds_iam.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

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

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

33-
# Host or IP address, from which the Local UI container accepts HTTP connections.
33+
# Host or IP address, from which the Embed 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"

Diff for: configs/config.example.physical_generic.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

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

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

33-
# Host or IP address, from which the Local UI container accepts HTTP connections.
33+
# Host or IP address, from which the Embed 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"

Diff for: configs/config.example.physical_walg.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

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

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

33-
# Host or IP address, from which the Local UI container accepts HTTP connections.
33+
# Host or IP address, from which the Embed 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"

Diff for: internal/localui/local_ui.go renamed to internal/embedui/embed_ui.go

+19-19
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
2021 © Postgres.ai
33
*/
44

5-
// Package localui manages local UI container.
6-
package localui
5+
// Package embedui manages Embed UI container.
6+
package embedui
77

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

43-
// Config defines configs for a local UI container.
43+
// Config defines configs for a Embed 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 local UI container.
51+
// UIManager manages Embed 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 local UI container.
92+
// Run creates a new Embed 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-
localUI, err := ui.docker.ContainerCreate(ctx,
98+
embedUI, err := ui.docker.ContainerCreate(ctx,
9999
&container.Config{
100100
Labels: map[string]string{
101-
cont.DBLabSatelliteLabel: cont.DBLabLocalUILabel,
101+
cont.DBLabSatelliteLabel: cont.DBLabEmbedUILabel,
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-
getLocalUIName(ui.engProps.InstanceID),
128+
getEmbedUIName(ui.engProps.InstanceID),
129129
)
130130

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

135-
if err := networks.Connect(ctx, ui.docker, ui.engProps.InstanceID, localUI.ID); err != nil {
135+
if err := networks.Connect(ctx, ui.docker, ui.engProps.InstanceID, embedUI.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, localUI.ID, types.ContainerStartOptions{}); err != nil {
140-
return fmt.Errorf("failed to start container %q: %w", localUI.ID, err)
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)
141141
}
142142

143143
reportLaunching(ui.cfg)
144144

145145
return nil
146146
}
147147

148-
// Restart destroys and creates a new local UI container.
148+
// Restart destroys and creates a new Embed 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 local UI container.
159+
// Stop removes a Embed UI container.
160160
func (ui *UIManager) Stop(ctx context.Context) {
161-
tools.RemoveContainer(ctx, ui.docker, getLocalUIName(ui.engProps.InstanceID), cont.StopTimeout)
161+
tools.RemoveContainer(ctx, ui.docker, getEmbedUIName(ui.engProps.InstanceID), cont.StopTimeout)
162162
}
163163

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

168-
// reportLaunching reports the launch of the LocalUI container.
168+
// reportLaunching reports the launch of the Embed 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("Local UI has started successfully on %s:%d.", host, cfg.Port))
176+
log.Msg(fmt.Sprintf("Embed UI has started successfully on %s:%d.", host, cfg.Port))
177177
}

Diff for: internal/retrieval/engine/postgres/tools/cont/container.go

+2-2
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-
// DBLabLocalUILabel defines a label value for local UI containers.
57-
DBLabLocalUILabel = "dblab_local_ui"
56+
// DBLabEmbedUILabel defines a label value for embed UI containers.
57+
DBLabEmbedUILabel = "dblab_embed_ui"
5858

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

Diff for: pkg/config/config.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ 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"
1819
"gitlab.com/postgres-ai/database-lab/v3/internal/estimator"
19-
"gitlab.com/postgres-ai/database-lab/v3/internal/localui"
2020
"gitlab.com/postgres-ai/database-lab/v3/internal/observer"
2121
"gitlab.com/postgres-ai/database-lab/v3/internal/platform"
2222
"gitlab.com/postgres-ai/database-lab/v3/internal/provision"
@@ -44,7 +44,7 @@ type Config struct {
4444
Observer observer.Config `yaml:"observer"`
4545
Estimator estimator.Config `yaml:"estimator"`
4646
PoolManager pool.Config `yaml:"poolManager"`
47-
LocalUI localui.Config `yaml:"localUI"`
47+
EmbedUI embedui.Config `yaml:"embedUI"`
4848
}
4949

5050
// LoadConfiguration instances a new application configuration.

Diff for: test/1.synthetic.sh

+1-1
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-
.localUI.enabled = false |
84+
.embedUI.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) |

Diff for: test/2.logical_generic.sh

+1-1
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-
.localUI.enabled = false |
90+
.embedUI.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) |

Diff for: test/3.physical_walg.sh

+1-1
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-
.localUI.enabled = false |
50+
.embedUI.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) |

Diff for: test/4.physical_basebackup.sh

+1-1
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-
.localUI.enabled = false |
105+
.embedUI.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) |

Diff for: test/5.logical_rds.sh

+1-1
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-
.localUI.enabled = false |
46+
.embedUI.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)