From 90b84020d0481951302e7d59eadb6af3eb687dd0 Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 12:08:34 +0700
Subject: [PATCH 01/18] chore: isolate Database Lab Engine code

---
 .gitignore                                    |  10 +-
 .gitlab-ci.yml                                | 427 +-----------------
 Dockerfile.ci-checker                         |   2 +-
 Dockerfile.dblab-cli                          |   2 +-
 Dockerfile.dblab-server                       |   5 +-
 Dockerfile.swagger-ui                         |   2 +-
 {swagger => api/swagger-ui}/favicon-16x16.png | Bin
 {swagger => api/swagger-ui}/favicon-32x32.png | Bin
 {swagger => api/swagger-ui}/index.html        |   0
 .../swagger-ui}/oauth2-redirect.html          |   0
 .../swagger-ui}/swagger-ui-bundle.js          |   0
 .../swagger-ui}/swagger-ui-bundle.js.map      |   0
 .../swagger-ui}/swagger-ui-es-bundle-core.js  |   0
 .../swagger-ui-es-bundle-core.js.map          |   0
 .../swagger-ui}/swagger-ui-es-bundle.js       |   0
 .../swagger-ui}/swagger-ui-es-bundle.js.map   |   0
 .../swagger-ui-standalone-preset.js           |   0
 .../swagger-ui-standalone-preset.js.map       |   0
 {swagger => api/swagger-ui}/swagger-ui.css    |   0
 .../swagger-ui}/swagger-ui.css.map            |   0
 {swagger => api/swagger-ui}/swagger-ui.js     |   0
 {swagger => api/swagger-ui}/swagger-ui.js.map |   0
 engine/.gitlab-ci.yml                         | 410 +++++++++++++++++
 .golangci.yml => engine/.golangci.yml         |   0
 Makefile => engine/Makefile                   |   0
 {cmd => engine/cmd}/cli/commands/client.go    |   0
 .../cmd}/cli/commands/clone/actions.go        |   0
 .../cmd}/cli/commands/clone/command_list.go   |   0
 .../cmd}/cli/commands/config/actions.go       |   0
 .../cmd}/cli/commands/config/command_list.go  |   0
 .../cmd}/cli/commands/config/duration.go      |   0
 .../cmd}/cli/commands/config/environment.go   |   0
 .../cmd}/cli/commands/config/file.go          |   0
 {cmd => engine/cmd}/cli/commands/errors.go    |   0
 .../cmd}/cli/commands/global/actions.go       |   0
 .../cmd}/cli/commands/global/command_list.go  |   0
 .../cmd}/cli/commands/instance/actions.go     |   0
 .../cli/commands/instance/command_list.go     |   0
 .../cmd}/cli/commands/port_forwarding.go      |   0
 .../cmd}/cli/commands/snapshot/actions.go     |   0
 .../cli/commands/snapshot/command_list.go     |   0
 {cmd => engine/cmd}/cli/main.go               |   0
 {cmd => engine/cmd}/cli/templates/help.go     |   0
 {cmd => engine/cmd}/database-lab/main.go      |   0
 {cmd => engine/cmd}/runci/main.go             |   0
 .../configs}/config.example.ci_checker.yml    |   0
 .../config.example.logical_generic.yml        |   0
 .../config.example.logical_rds_iam.yml        |   0
 .../config.example.physical_generic.yml       |   0
 .../configs}/config.example.physical_walg.yml |   0
 .../standard/postgres/control/pg_hba.conf     |   0
 .../standard/postgres/control/postgresql.conf |   0
 .../standard/postgres/default/10/pg_hba.conf  |   0
 .../10/postgresql.dblab.postgresql.conf       |   0
 .../standard/postgres/default/11/pg_hba.conf  |   0
 .../11/postgresql.dblab.postgresql.conf       |   0
 .../standard/postgres/default/12/pg_hba.conf  |   0
 .../12/postgresql.dblab.postgresql.conf       |   0
 .../standard/postgres/default/13/pg_hba.conf  |   0
 .../13/postgresql.dblab.postgresql.conf       |   0
 .../standard/postgres/default/14/pg_hba.conf  |   0
 .../14/postgresql.dblab.postgresql.conf       |   0
 .../standard/postgres/default/9.6/pg_hba.conf |   0
 .../9.6/postgresql.dblab.postgresql.conf      |   0
 go.mod => engine/go.mod                       |   0
 go.sum => engine/go.sum                       |   0
 {internal => engine/internal}/cloning/base.go |   0
 .../internal}/cloning/base_test.go            |   0
 .../internal}/cloning/snapshots.go            |   0
 .../internal}/cloning/snapshots_test.go       |   0
 .../internal}/cloning/storage.go              |   0
 .../internal}/cloning/storage_test.go         |   0
 .../internal}/cloning/wrapper.go              |   0
 .../internal}/embeddedui/embedded_ui.go       |   0
 .../internal}/estimator/estimator.go          |   0
 .../internal}/estimator/estimator_test.go     |   0
 .../internal}/estimator/events.go             |   0
 .../internal}/estimator/io_events.go          |   0
 .../internal}/estimator/monitor.go            |   0
 .../internal}/estimator/monitor_test.go       |   0
 .../internal}/estimator/profile.go            |   0
 .../internal}/estimator/timing.go             |   0
 .../internal}/observer/artifacts.go           |   0
 .../internal}/observer/observer.go            |   0
 .../internal}/observer/observer_test.go       |   0
 .../internal}/observer/observing_clone.go     |   0
 .../internal}/observer/queries.go             |   0
 .../internal}/observer/session.go             |   0
 .../internal}/observer/session_test.go        |   0
 {internal => engine/internal}/observer/sql.go |   0
 .../internal}/observer/stats.go               |   0
 .../internal}/platform/platform.go            |   0
 .../internal}/platform/platform_test.go       |   0
 .../internal}/portfwd/sshtunnel.go            |   0
 .../postgres/pgconfig/configuration.go        |   0
 .../postgres/pgconfig/configuration_test.go   |   0
 .../provision/databases/postgres/postgres.go  |   0
 .../databases/postgres/postgres_mgmt.go       |   0
 .../databases/postgres/postgres_mgmt_test.go  |   0
 .../databases/postgres/postgres_test.go       |   0
 .../internal}/provision/docker/docker.go      |   0
 .../internal}/provision/docker/docker_test.go |   0
 .../internal}/provision/mode_local.go         |   0
 .../internal}/provision/mode_local_test.go    |   0
 .../internal}/provision/pool/block_devices.go |   0
 .../internal}/provision/pool/fstype_bsd.go    |   0
 .../internal}/provision/pool/fstype_linux.go  |   0
 .../provision/pool/fstype_windows.go          |   0
 .../internal}/provision/pool/manager.go       |   0
 .../internal}/provision/pool/pool_manager.go  |   0
 .../internal}/provision/port_checker.go       |   0
 .../internal}/provision/provision.go          |   0
 .../provision/resources/appconfig.go          |   0
 .../internal}/provision/resources/pool.go     |   0
 .../provision/resources/resources.go          |   0
 .../internal}/provision/runners/runners.go    |   0
 .../internal}/provision/thinclones/lvm/lvm.go |   0
 .../provision/thinclones/lvm/lvmanager.go     |   0
 .../internal}/provision/thinclones/manager.go |   0
 .../thinclones/zfs/snapshots_filter.go        |   0
 .../thinclones/zfs/snapshots_filter_test.go   |   0
 .../internal}/provision/thinclones/zfs/zfs.go |   0
 .../provision/thinclones/zfs/zfs_test.go      |   0
 .../retrieval/components/components.go        |   0
 .../internal}/retrieval/config/config.go      |   0
 .../internal}/retrieval/dbmarker/dbmarker.go  |   0
 .../internal}/retrieval/engine/engine.go      |   0
 .../retrieval/engine/postgres/job_builder.go  |   0
 .../engine/postgres/logical/archive_types.go  |   0
 .../postgres/logical/archive_types_test.go    |   0
 .../retrieval/engine/postgres/logical/dump.go |   0
 .../engine/postgres/logical/dump_default.go   |   0
 .../engine/postgres/logical/dump_rds.go       |   0
 .../engine/postgres/logical/logical.go        |   0
 .../engine/postgres/logical/restore.go        |   0
 .../engine/postgres/logical/restore_test.go   |   0
 .../engine/postgres/physical/custom.go        |   0
 .../engine/postgres/physical/custom_test.go   |   0
 .../engine/postgres/physical/physical.go      |   0
 .../engine/postgres/physical/physical_test.go |   0
 .../engine/postgres/physical/wal_g.go         |   0
 .../engine/postgres/physical/wal_g_test.go    |   0
 .../engine/postgres/snapshot/errors.go        |   0
 .../engine/postgres/snapshot/logical.go       |   0
 .../engine/postgres/snapshot/physical.go      |   0
 .../snapshot/physical_integration_test.go     |   0
 .../engine/postgres/snapshot/physical_test.go |   0
 .../postgres/snapshot/queryPreprocessor.go    |   0
 .../engine/postgres/snapshot/snapshot.go      |   0
 .../engine/postgres/tools/cont/container.go   |   0
 .../postgres/tools/cont/container_test.go     |   0
 .../retrieval/engine/postgres/tools/db/pg.go  |   0
 .../postgres/tools/defaults/defaults.go       |   0
 .../retrieval/engine/postgres/tools/dump.go   |   0
 .../engine/postgres/tools/fs/tools.go         |   0
 .../postgres/tools/health/healthcheck.go      |   0
 .../engine/postgres/tools/pgtool/pgtool.go    |   0
 .../retrieval/engine/postgres/tools/tools.go  |   0
 .../engine/postgres/tools/tools_test.go       |   0
 .../internal}/retrieval/options/options.go    |   0
 .../internal}/retrieval/refresh_errors.go     |   0
 .../internal}/retrieval/retrieval.go          |   0
 .../internal}/retrieval/retrieval_test.go     |   0
 .../internal}/retrieval/state.go              |   0
 .../internal}/retrieval/state_test.go         |   0
 {internal => engine/internal}/runci/clone.go  |   0
 {internal => engine/internal}/runci/config.go |   0
 .../internal}/runci/handlers.go               |   0
 {internal => engine/internal}/runci/server.go |   0
 .../internal}/runci/source/github.go          |   0
 .../internal}/runci/source/source.go          |   0
 .../internal}/srv/api/errors.go               |   0
 .../internal}/srv/api/errors_test.go          |   0
 {internal => engine/internal}/srv/api/util.go |   0
 .../internal}/srv/config/config.go            |   0
 {internal => engine/internal}/srv/mw/auth.go  |   0
 .../internal}/srv/mw/auth_test.go             |   0
 .../internal}/srv/mw/logging.go               |   0
 {internal => engine/internal}/srv/routes.go   |   0
 {internal => engine/internal}/srv/server.go   |   0
 {internal => engine/internal}/srv/ws.go       |   0
 .../internal}/telemetry/events.go             |   0
 .../internal}/telemetry/telemetry.go          |   0
 .../internal}/validator/validator.go          |   0
 .../internal}/validator/validator_test.go     |   0
 {pkg => engine/pkg}/client/dblabapi/client.go |   0
 .../pkg}/client/dblabapi/client_test.go       |   0
 {pkg => engine/pkg}/client/dblabapi/clone.go  |   0
 .../pkg}/client/dblabapi/clone_test.go        |   0
 .../pkg}/client/dblabapi/estimator.go         |   0
 .../pkg}/client/dblabapi/snapshot.go          |   0
 .../pkg}/client/dblabapi/snapshot_test.go     |   0
 {pkg => engine/pkg}/client/dblabapi/status.go |   0
 .../pkg}/client/dblabapi/status_test.go       |   0
 .../pkg}/client/dblabapi/types/clone.go       |   0
 .../pkg}/client/dblabapi/types/observation.go |   0
 {pkg => engine/pkg}/client/platform/client.go |   0
 .../pkg}/client/platform/client_test.go       |   0
 .../pkg}/client/platform/observation.go       |   0
 .../pkg}/client/platform/telemetry.go         |   0
 {pkg => engine/pkg}/client/platform/token.go  |   0
 {pkg => engine/pkg}/config/config.go          |   0
 {pkg => engine/pkg}/config/config_test.go     |   0
 {pkg => engine/pkg}/config/global/config.go   |   0
 {pkg => engine/pkg}/log/log.go                |   0
 {pkg => engine/pkg}/models/clone.go           |   0
 {pkg => engine/pkg}/models/database.go        |   0
 {pkg => engine/pkg}/models/error.go           |   0
 {pkg => engine/pkg}/models/fs.go              |   0
 {pkg => engine/pkg}/models/instance_status.go |   0
 {pkg => engine/pkg}/models/observation.go     |   0
 {pkg => engine/pkg}/models/retrieval.go       |   0
 {pkg => engine/pkg}/models/retrieval_test.go  |   0
 {pkg => engine/pkg}/models/snapshot.go        |   0
 {pkg => engine/pkg}/models/status.go          |   0
 {pkg => engine/pkg}/util/bytes.go             |   0
 {pkg => engine/pkg}/util/clones.go            |   0
 {pkg => engine/pkg}/util/config.go            |   0
 {pkg => engine/pkg}/util/config_test.go       |   0
 {pkg => engine/pkg}/util/engine/engine.go     |   0
 {pkg => engine/pkg}/util/networks/networks.go |   0
 .../pkg}/util/networks/networks_test.go       |   0
 {pkg => engine/pkg}/util/pglog/activity.go    |   0
 .../pkg}/util/pglog/activity_test.go          |   0
 {pkg => engine/pkg}/util/slices.go            |   0
 {pkg => engine/pkg}/util/slices_test.go       |   0
 {pkg => engine/pkg}/util/testing.go           |   0
 {pkg => engine/pkg}/util/time.go              |   0
 {pkg => engine/pkg}/util/time_test.go         |   0
 {testdata => engine/testdata}/testdata.go     |   0
 {version => engine/version}/version.go        |   0
 {version => engine/version}/version_test.go   |   0
 232 files changed, 424 insertions(+), 434 deletions(-)
 rename {swagger => api/swagger-ui}/favicon-16x16.png (100%)
 rename {swagger => api/swagger-ui}/favicon-32x32.png (100%)
 rename {swagger => api/swagger-ui}/index.html (100%)
 rename {swagger => api/swagger-ui}/oauth2-redirect.html (100%)
 rename {swagger => api/swagger-ui}/swagger-ui-bundle.js (100%)
 rename {swagger => api/swagger-ui}/swagger-ui-bundle.js.map (100%)
 rename {swagger => api/swagger-ui}/swagger-ui-es-bundle-core.js (100%)
 rename {swagger => api/swagger-ui}/swagger-ui-es-bundle-core.js.map (100%)
 rename {swagger => api/swagger-ui}/swagger-ui-es-bundle.js (100%)
 rename {swagger => api/swagger-ui}/swagger-ui-es-bundle.js.map (100%)
 rename {swagger => api/swagger-ui}/swagger-ui-standalone-preset.js (100%)
 rename {swagger => api/swagger-ui}/swagger-ui-standalone-preset.js.map (100%)
 rename {swagger => api/swagger-ui}/swagger-ui.css (100%)
 rename {swagger => api/swagger-ui}/swagger-ui.css.map (100%)
 rename {swagger => api/swagger-ui}/swagger-ui.js (100%)
 rename {swagger => api/swagger-ui}/swagger-ui.js.map (100%)
 create mode 100644 engine/.gitlab-ci.yml
 rename .golangci.yml => engine/.golangci.yml (100%)
 rename Makefile => engine/Makefile (100%)
 rename {cmd => engine/cmd}/cli/commands/client.go (100%)
 rename {cmd => engine/cmd}/cli/commands/clone/actions.go (100%)
 rename {cmd => engine/cmd}/cli/commands/clone/command_list.go (100%)
 rename {cmd => engine/cmd}/cli/commands/config/actions.go (100%)
 rename {cmd => engine/cmd}/cli/commands/config/command_list.go (100%)
 rename {cmd => engine/cmd}/cli/commands/config/duration.go (100%)
 rename {cmd => engine/cmd}/cli/commands/config/environment.go (100%)
 rename {cmd => engine/cmd}/cli/commands/config/file.go (100%)
 rename {cmd => engine/cmd}/cli/commands/errors.go (100%)
 rename {cmd => engine/cmd}/cli/commands/global/actions.go (100%)
 rename {cmd => engine/cmd}/cli/commands/global/command_list.go (100%)
 rename {cmd => engine/cmd}/cli/commands/instance/actions.go (100%)
 rename {cmd => engine/cmd}/cli/commands/instance/command_list.go (100%)
 rename {cmd => engine/cmd}/cli/commands/port_forwarding.go (100%)
 rename {cmd => engine/cmd}/cli/commands/snapshot/actions.go (100%)
 rename {cmd => engine/cmd}/cli/commands/snapshot/command_list.go (100%)
 rename {cmd => engine/cmd}/cli/main.go (100%)
 rename {cmd => engine/cmd}/cli/templates/help.go (100%)
 rename {cmd => engine/cmd}/database-lab/main.go (100%)
 rename {cmd => engine/cmd}/runci/main.go (100%)
 rename {configs => engine/configs}/config.example.ci_checker.yml (100%)
 rename {configs => engine/configs}/config.example.logical_generic.yml (100%)
 rename {configs => engine/configs}/config.example.logical_rds_iam.yml (100%)
 rename {configs => engine/configs}/config.example.physical_generic.yml (100%)
 rename {configs => engine/configs}/config.example.physical_walg.yml (100%)
 rename {configs => engine/configs}/standard/postgres/control/pg_hba.conf (100%)
 rename {configs => engine/configs}/standard/postgres/control/postgresql.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/10/pg_hba.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/10/postgresql.dblab.postgresql.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/11/pg_hba.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/11/postgresql.dblab.postgresql.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/12/pg_hba.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/12/postgresql.dblab.postgresql.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/13/pg_hba.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/13/postgresql.dblab.postgresql.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/14/pg_hba.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/14/postgresql.dblab.postgresql.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/9.6/pg_hba.conf (100%)
 rename {configs => engine/configs}/standard/postgres/default/9.6/postgresql.dblab.postgresql.conf (100%)
 rename go.mod => engine/go.mod (100%)
 rename go.sum => engine/go.sum (100%)
 rename {internal => engine/internal}/cloning/base.go (100%)
 rename {internal => engine/internal}/cloning/base_test.go (100%)
 rename {internal => engine/internal}/cloning/snapshots.go (100%)
 rename {internal => engine/internal}/cloning/snapshots_test.go (100%)
 rename {internal => engine/internal}/cloning/storage.go (100%)
 rename {internal => engine/internal}/cloning/storage_test.go (100%)
 rename {internal => engine/internal}/cloning/wrapper.go (100%)
 rename {internal => engine/internal}/embeddedui/embedded_ui.go (100%)
 rename {internal => engine/internal}/estimator/estimator.go (100%)
 rename {internal => engine/internal}/estimator/estimator_test.go (100%)
 rename {internal => engine/internal}/estimator/events.go (100%)
 rename {internal => engine/internal}/estimator/io_events.go (100%)
 rename {internal => engine/internal}/estimator/monitor.go (100%)
 rename {internal => engine/internal}/estimator/monitor_test.go (100%)
 rename {internal => engine/internal}/estimator/profile.go (100%)
 rename {internal => engine/internal}/estimator/timing.go (100%)
 rename {internal => engine/internal}/observer/artifacts.go (100%)
 rename {internal => engine/internal}/observer/observer.go (100%)
 rename {internal => engine/internal}/observer/observer_test.go (100%)
 rename {internal => engine/internal}/observer/observing_clone.go (100%)
 rename {internal => engine/internal}/observer/queries.go (100%)
 rename {internal => engine/internal}/observer/session.go (100%)
 rename {internal => engine/internal}/observer/session_test.go (100%)
 rename {internal => engine/internal}/observer/sql.go (100%)
 rename {internal => engine/internal}/observer/stats.go (100%)
 rename {internal => engine/internal}/platform/platform.go (100%)
 rename {internal => engine/internal}/platform/platform_test.go (100%)
 rename {internal => engine/internal}/portfwd/sshtunnel.go (100%)
 rename {internal => engine/internal}/provision/databases/postgres/pgconfig/configuration.go (100%)
 rename {internal => engine/internal}/provision/databases/postgres/pgconfig/configuration_test.go (100%)
 rename {internal => engine/internal}/provision/databases/postgres/postgres.go (100%)
 rename {internal => engine/internal}/provision/databases/postgres/postgres_mgmt.go (100%)
 rename {internal => engine/internal}/provision/databases/postgres/postgres_mgmt_test.go (100%)
 rename {internal => engine/internal}/provision/databases/postgres/postgres_test.go (100%)
 rename {internal => engine/internal}/provision/docker/docker.go (100%)
 rename {internal => engine/internal}/provision/docker/docker_test.go (100%)
 rename {internal => engine/internal}/provision/mode_local.go (100%)
 rename {internal => engine/internal}/provision/mode_local_test.go (100%)
 rename {internal => engine/internal}/provision/pool/block_devices.go (100%)
 rename {internal => engine/internal}/provision/pool/fstype_bsd.go (100%)
 rename {internal => engine/internal}/provision/pool/fstype_linux.go (100%)
 rename {internal => engine/internal}/provision/pool/fstype_windows.go (100%)
 rename {internal => engine/internal}/provision/pool/manager.go (100%)
 rename {internal => engine/internal}/provision/pool/pool_manager.go (100%)
 rename {internal => engine/internal}/provision/port_checker.go (100%)
 rename {internal => engine/internal}/provision/provision.go (100%)
 rename {internal => engine/internal}/provision/resources/appconfig.go (100%)
 rename {internal => engine/internal}/provision/resources/pool.go (100%)
 rename {internal => engine/internal}/provision/resources/resources.go (100%)
 rename {internal => engine/internal}/provision/runners/runners.go (100%)
 rename {internal => engine/internal}/provision/thinclones/lvm/lvm.go (100%)
 rename {internal => engine/internal}/provision/thinclones/lvm/lvmanager.go (100%)
 rename {internal => engine/internal}/provision/thinclones/manager.go (100%)
 rename {internal => engine/internal}/provision/thinclones/zfs/snapshots_filter.go (100%)
 rename {internal => engine/internal}/provision/thinclones/zfs/snapshots_filter_test.go (100%)
 rename {internal => engine/internal}/provision/thinclones/zfs/zfs.go (100%)
 rename {internal => engine/internal}/provision/thinclones/zfs/zfs_test.go (100%)
 rename {internal => engine/internal}/retrieval/components/components.go (100%)
 rename {internal => engine/internal}/retrieval/config/config.go (100%)
 rename {internal => engine/internal}/retrieval/dbmarker/dbmarker.go (100%)
 rename {internal => engine/internal}/retrieval/engine/engine.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/job_builder.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/logical/archive_types.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/logical/archive_types_test.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/logical/dump.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/logical/dump_default.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/logical/dump_rds.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/logical/logical.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/logical/restore.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/logical/restore_test.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/physical/custom.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/physical/custom_test.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/physical/physical.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/physical/physical_test.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/physical/wal_g.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/physical/wal_g_test.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/snapshot/errors.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/snapshot/logical.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/snapshot/physical.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/snapshot/physical_integration_test.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/snapshot/physical_test.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/snapshot/queryPreprocessor.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/snapshot/snapshot.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/tools/cont/container.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/tools/cont/container_test.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/tools/db/pg.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/tools/defaults/defaults.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/tools/dump.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/tools/fs/tools.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/tools/health/healthcheck.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/tools/pgtool/pgtool.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/tools/tools.go (100%)
 rename {internal => engine/internal}/retrieval/engine/postgres/tools/tools_test.go (100%)
 rename {internal => engine/internal}/retrieval/options/options.go (100%)
 rename {internal => engine/internal}/retrieval/refresh_errors.go (100%)
 rename {internal => engine/internal}/retrieval/retrieval.go (100%)
 rename {internal => engine/internal}/retrieval/retrieval_test.go (100%)
 rename {internal => engine/internal}/retrieval/state.go (100%)
 rename {internal => engine/internal}/retrieval/state_test.go (100%)
 rename {internal => engine/internal}/runci/clone.go (100%)
 rename {internal => engine/internal}/runci/config.go (100%)
 rename {internal => engine/internal}/runci/handlers.go (100%)
 rename {internal => engine/internal}/runci/server.go (100%)
 rename {internal => engine/internal}/runci/source/github.go (100%)
 rename {internal => engine/internal}/runci/source/source.go (100%)
 rename {internal => engine/internal}/srv/api/errors.go (100%)
 rename {internal => engine/internal}/srv/api/errors_test.go (100%)
 rename {internal => engine/internal}/srv/api/util.go (100%)
 rename {internal => engine/internal}/srv/config/config.go (100%)
 rename {internal => engine/internal}/srv/mw/auth.go (100%)
 rename {internal => engine/internal}/srv/mw/auth_test.go (100%)
 rename {internal => engine/internal}/srv/mw/logging.go (100%)
 rename {internal => engine/internal}/srv/routes.go (100%)
 rename {internal => engine/internal}/srv/server.go (100%)
 rename {internal => engine/internal}/srv/ws.go (100%)
 rename {internal => engine/internal}/telemetry/events.go (100%)
 rename {internal => engine/internal}/telemetry/telemetry.go (100%)
 rename {internal => engine/internal}/validator/validator.go (100%)
 rename {internal => engine/internal}/validator/validator_test.go (100%)
 rename {pkg => engine/pkg}/client/dblabapi/client.go (100%)
 rename {pkg => engine/pkg}/client/dblabapi/client_test.go (100%)
 rename {pkg => engine/pkg}/client/dblabapi/clone.go (100%)
 rename {pkg => engine/pkg}/client/dblabapi/clone_test.go (100%)
 rename {pkg => engine/pkg}/client/dblabapi/estimator.go (100%)
 rename {pkg => engine/pkg}/client/dblabapi/snapshot.go (100%)
 rename {pkg => engine/pkg}/client/dblabapi/snapshot_test.go (100%)
 rename {pkg => engine/pkg}/client/dblabapi/status.go (100%)
 rename {pkg => engine/pkg}/client/dblabapi/status_test.go (100%)
 rename {pkg => engine/pkg}/client/dblabapi/types/clone.go (100%)
 rename {pkg => engine/pkg}/client/dblabapi/types/observation.go (100%)
 rename {pkg => engine/pkg}/client/platform/client.go (100%)
 rename {pkg => engine/pkg}/client/platform/client_test.go (100%)
 rename {pkg => engine/pkg}/client/platform/observation.go (100%)
 rename {pkg => engine/pkg}/client/platform/telemetry.go (100%)
 rename {pkg => engine/pkg}/client/platform/token.go (100%)
 rename {pkg => engine/pkg}/config/config.go (100%)
 rename {pkg => engine/pkg}/config/config_test.go (100%)
 rename {pkg => engine/pkg}/config/global/config.go (100%)
 rename {pkg => engine/pkg}/log/log.go (100%)
 rename {pkg => engine/pkg}/models/clone.go (100%)
 rename {pkg => engine/pkg}/models/database.go (100%)
 rename {pkg => engine/pkg}/models/error.go (100%)
 rename {pkg => engine/pkg}/models/fs.go (100%)
 rename {pkg => engine/pkg}/models/instance_status.go (100%)
 rename {pkg => engine/pkg}/models/observation.go (100%)
 rename {pkg => engine/pkg}/models/retrieval.go (100%)
 rename {pkg => engine/pkg}/models/retrieval_test.go (100%)
 rename {pkg => engine/pkg}/models/snapshot.go (100%)
 rename {pkg => engine/pkg}/models/status.go (100%)
 rename {pkg => engine/pkg}/util/bytes.go (100%)
 rename {pkg => engine/pkg}/util/clones.go (100%)
 rename {pkg => engine/pkg}/util/config.go (100%)
 rename {pkg => engine/pkg}/util/config_test.go (100%)
 rename {pkg => engine/pkg}/util/engine/engine.go (100%)
 rename {pkg => engine/pkg}/util/networks/networks.go (100%)
 rename {pkg => engine/pkg}/util/networks/networks_test.go (100%)
 rename {pkg => engine/pkg}/util/pglog/activity.go (100%)
 rename {pkg => engine/pkg}/util/pglog/activity_test.go (100%)
 rename {pkg => engine/pkg}/util/slices.go (100%)
 rename {pkg => engine/pkg}/util/slices_test.go (100%)
 rename {pkg => engine/pkg}/util/testing.go (100%)
 rename {pkg => engine/pkg}/util/time.go (100%)
 rename {pkg => engine/pkg}/util/time_test.go (100%)
 rename {testdata => engine/testdata}/testdata.go (100%)
 rename {version => engine/version}/version.go (100%)
 rename {version => engine/version}/version_test.go (100%)

diff --git a/.gitignore b/.gitignore
index 0c14b71aa..44a297f58 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,14 @@
 .DS_Store
 .idea/
 
-/bin/
+engine/bin/
 /db-lab-run/
 
 # Deploy contains Kubernetes configs with secrets, remove from .gitignore when generalized.
 /deploy/
 
-/configs/config.yml
-/configs/server.yml
-/configs/run_ci.yaml
-/configs/ci_checker.yml
+/engine/configs/config.yml
+/engine/configs/server.yml
+/engine/configs/run_ci.yaml
+/engine/configs/ci_checker.yml
 /packer/example.com.key
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e9670c523..8e0999e50 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,427 +1,8 @@
-image: golang:1.17
-
-include:
-  - template: Security/SAST.gitlab-ci.yml
-  - local: 'web/.gitlab-ci.yml'
-
 variables:
   SAST_EXCLUDED_ANALYZERS: "semgrep-sast"
   DOCKER_DRIVER: overlay2
 
-stages:
-  - test
-  - build-binary
-  - build
-  - integration-test
-  - deploy
-
-## Conditions
-.except_web_rules:
-  rules:
-    - changes:
-        - web/**/*
-      when: never
-
-.only_dle_tag_release: &only_tag_release
-  rules:
-   - if: $CI_COMMIT_TAG =~ /^v[0-9.]+$/
-
-.only_dle_tag_rc: &only_tag_rc
-  rules:
-    - if: $CI_COMMIT_TAG =~ /^v[0-9.]+[\-_]*[a-zA-Z]+[a-zA-Z0-9.\-_]*[a-zA-Z0-9]+$/
-
-.only_dle_master: &only_master
-  rules:
-    - !reference [.except_web_rules, rules]
-    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
-
-.only_dle_feature: &only_feature
-  rules:
-    - !reference [.except_web_rules, rules]
-    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
-
-.dle: &dle
-  rules:
-    - !reference [.only_dle_master, rules]
-    - !reference [.only_dle_feature, rules]
-    - !reference [.only_dle_tag_release, rules]
-    - !reference [.only_dle_tag_rc, rules]
-
-test:
-  <<: *dle
-  stage: test
-  script:
-    - make test
-
-lint:
-  rules:
-    - !reference [.dle, rules]
-  stage: test
-  script:
-    - make lint
-
-### Build binary.
-build-binary-alpine:
-  <<: *dle
-  image: golang:1.17-alpine
-  stage: build-binary
-  artifacts:
-    paths:
-      - bin
-  script:
-    - apk add --update --no-cache make git
-    - make build
-
-build-binary-client-dev:
-  <<: *only_feature
-  stage: build-binary
-  artifacts:
-    paths:
-      - bin
-  script:
-    - make build-client
-
-build-binary-client-master:
-  <<: *only_master
-  stage: build-binary
-  script:
-    - make build-client
-
-    # Install google-cloud-sdk.
-    - echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
-    - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
-    - apt-get update && apt-get install -y google-cloud-sdk
-
-    # Authenticate.
-    - echo $GCP_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
-
-    # Upload artifacts.
-    - gsutil -m cp -r bin/cli/* gs://database-lab-cli/master/
-
-build-binary-client:
-  <<: *only_tag_release
-  stage: build-binary
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-  script:
-    - make build-client
-
-    # Install google-cloud-sdk.
-    - echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
-    - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
-    - apt-get update && apt-get install -y google-cloud-sdk
-
-    # Authenticate.
-    - echo $GCP_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
-
-    # Upload artifacts.
-    - gsutil -m cp -r bin/cli/* gs://database-lab-cli/${CLEAN_TAG}/
-    - gsutil -m cp -r bin/cli/* gs://database-lab-cli/latest/
-
-build-binary-client-rc:
-  <<: *only_tag_rc
-  stage: build-binary
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-  script:
-    - make build-client
-
-    # Install google-cloud-sdk.
-    - echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
-    - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
-    - apt-get update && apt-get install -y google-cloud-sdk
-
-    # Authenticate.
-    - echo $GCP_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
-
-    # Upload artifacts.
-    - gsutil -m cp -r bin/cli/* gs://database-lab-cli/${CLEAN_TAG}/
-
-.job_template: &build_image_definition
-  image: docker:19
-  stage: build
-  artifacts:
-    paths:
-      - bin
-  services:
-    - name: docker:dind
-  script:
-    - apk update && apk upgrade && apk add --no-cache bash # TODO(anatoly): Remove dependency.
-    - bash ./scripts/ci_docker_build_push.sh
-
-build-image-feature-server:
-  <<: *build_image_definition
-  <<: *only_feature
-  variables:
-    REGISTRY_USER: "${CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.dblab-server"
-    DOCKER_NAME: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/dblab-server"
-    TAGS: "${DOCKER_NAME}:${CI_COMMIT_REF_SLUG}"
-
-build-image-feature-ci-checker:
-  <<: *build_image_definition
-  <<: *only_feature
-  variables:
-    REGISTRY_USER: "${CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.ci-checker"
-    DOCKER_NAME: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/dblab-ci-checker"
-    TAGS: "${DOCKER_NAME}:${CI_COMMIT_REF_SLUG}"
-
-build-image-feature-client:
-  <<: *build_image_definition
-  <<: *only_feature
-  variables:
-    REGISTRY_USER: "${CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.dblab-cli"
-    DOCKER_NAME: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/dblab-cli"
-    TAGS: "${DOCKER_NAME}:${CI_COMMIT_REF_SLUG}"
-
-build-image-master-server:
-  <<: *build_image_definition
-  <<: *only_master
-  variables:
-    DOCKER_FILE: "Dockerfile.dblab-server"
-    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-server"
-    TAGS: "${DOCKER_NAME}:master,${DOCKER_NAME}:master-${CI_COMMIT_SHORT_SHA}"
-
-build-image-master-ci-checker:
-  <<: *build_image_definition
-  <<: *only_master
-  variables:
-    DOCKER_FILE: "Dockerfile.ci-checker"
-    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-ci-checker"
-    TAGS: "${DOCKER_NAME}:master,${DOCKER_NAME}:master-${CI_COMMIT_SHORT_SHA}"
-
-build-image-master-client:
-  <<: *build_image_definition
-  <<: *only_master
-  variables:
-    DOCKER_FILE: "Dockerfile.dblab-cli"
-    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-cli"
-    TAGS: "${DOCKER_NAME}:master,${DOCKER_NAME}:master-${CI_COMMIT_SHORT_SHA}"
-
-build-image-latest-server:
-  <<: *build_image_definition
-  <<: *only_tag_release
-  variables:
-    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${DH_CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.dblab-server"
-    DOCKER_NAME: "postgresai/dblab-server"
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-    - export LATEST_TAG=$(echo ${CLEAN_TAG%.*}-latest)
-    - export TAGS="${DOCKER_NAME}:${LATEST_TAG},${DOCKER_NAME}:${CLEAN_TAG}"
-
-build-image-latest-server-dev:
-  <<: *build_image_definition
-  <<: *only_tag_release
-  variables:
-    REGISTRY_USER: "${CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.dblab-server"
-    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-server"
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-    - export TAGS="${DOCKER_NAME}:${CLEAN_TAG}"
-
-build-image-latest-ci-checker:
-  <<: *build_image_definition
-  <<: *only_tag_release
-  variables:
-    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${DH_CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.ci-checker"
-    DOCKER_NAME: "postgresai/dblab-ci-checker"
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-    - export LATEST_TAG=$(echo ${CLEAN_TAG%.*}-latest)
-    - export TAGS="${DOCKER_NAME}:${LATEST_TAG},${DOCKER_NAME}:${CLEAN_TAG}"
-
-build-image-latest-ci-checker-dev:
-  <<: *build_image_definition
-  <<: *only_tag_release
-  variables:
-    REGISTRY_USER: "${CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.ci-checker"
-    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-ci-checker"
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-    - export TAGS="${DOCKER_NAME}:${CLEAN_TAG}"
-
-build-image-latest-client:
-  <<: *build_image_definition
-  <<: *only_tag_release
-  variables:
-    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${DH_CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.dblab-cli"
-    DOCKER_NAME: "postgresai/dblab"
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-    - export LATEST_TAG=$(echo ${CLEAN_TAG%.*}-latest)
-    - export TAGS="${DOCKER_NAME}:${LATEST_TAG},${DOCKER_NAME}:${CLEAN_TAG}"
-
-build-image-rc-server:
-  <<: *build_image_definition
-  <<: *only_tag_rc
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-  variables:
-    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${DH_CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.dblab-server"
-    DOCKER_NAME: "postgresai/dblab-server"
-    TAGS: "${DOCKER_NAME}:${CLEAN_TAG}"
-
-build-image-rc-server-dev:
-  <<: *build_image_definition
-  <<: *only_tag_rc
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-  variables:
-    REGISTRY_USER: "${CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.dblab-server"
-    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-server"
-    TAGS: "${DOCKER_NAME}:${CLEAN_TAG}"
-
-build-image-rc-ci-checker:
-  <<: *build_image_definition
-  <<: *only_tag_rc
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-  variables:
-    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${DH_CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.ci-checker"
-    DOCKER_NAME: "postgresai/dblab-ci-checker"
-    TAGS: "${DOCKER_NAME}:${CLEAN_TAG}"
-
-build-image-rc-ci-checker-dev:
-  <<: *build_image_definition
-  <<: *only_tag_rc
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-  variables:
-    REGISTRY_USER: "${CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.ci-checker"
-    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-ci-checker"
-    TAGS: "${DOCKER_NAME}:${CLEAN_TAG}"
-
-build-image-rc-client:
-  <<: *build_image_definition
-  <<: *only_tag_rc
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-  variables:
-    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
-    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
-    REGISTRY: "${DH_CI_REGISTRY}"
-    DOCKER_FILE: "Dockerfile.dblab-cli"
-    DOCKER_NAME: "postgresai/dblab"
-    TAGS: "${DOCKER_NAME}:${CLEAN_TAG}"
-
-build-image-swagger-latest:
-  <<: *build_image_definition
-  <<: *only_tag_release
-  variables:
-    DOCKER_FILE: "Dockerfile.swagger-ui"
-    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-swagger-ui"
-  before_script:
-    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
-    - export LATEST_TAG=$(echo ${CLEAN_TAG%.*}-latest)
-    - export TAGS="${DOCKER_NAME}:${LATEST_TAG}"
-
-
-.bash-test: &bash_test
-  stage: integration-test
-  variables:
-    IMAGE_TAG: "${CI_COMMIT_REF_SLUG}"
-  rules:
-    - changes:
-        - web/**/*
-      when: never
-    - if: '$CI_PROJECT_NAMESPACE != "postgres-ai"'
-      when: never
-    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
-      changes:
-        - cmd/**/*
-        - configs/**/*
-        - internal/**/*
-        - pkg/**/*
-        - test/**/*
-        - Dockerfile.*
-        - go.*
-        - .gitlab-ci.yml
-  script:
-    - bash test/1.synthetic.sh
-    - bash test/2.logical_generic.sh
-    - bash test/4.physical_basebackup.sh
-  after_script:
-    - bash test/_cleanup.sh
-  tags:
-    - dle-test
-
-bash-test-9-6:
-  <<: *bash_test
-  variables:
-    POSTGRES_VERSION: "9.6"
-
-bash-test-10:
-  <<: *bash_test
-  variables:
-    POSTGRES_VERSION: 10
-
-bash-test-11:
-  <<: *bash_test
-  variables:
-    POSTGRES_VERSION: 11
-
-bash-test-12:
-  <<: *bash_test
-  variables:
-    POSTGRES_VERSION: 12
-
-bash-test-13:
-  <<: *bash_test
-  variables:
-    POSTGRES_VERSION: 13
-
-bash-test-14:
-  <<: *bash_test
-  variables:
-    POSTGRES_VERSION: 14
-
-integration-test:
-  services:
-    - name: docker:dind
-      command: [ "--tls=false" ]
-  <<: *only_feature
-  stage: integration-test
-  variables:
-    # Instruct Testcontainers to use the daemon of DinD.
-    DOCKER_HOST: "tcp://docker:2375"
-    # Instruct Docker not to start over TLS.
-    DOCKER_TLS_CERTDIR: ""
-    # Improve performance with overlayfs.
-    DOCKER_DRIVER: overlay2
-  script:
-    - make test-ci-integration
+include:
+  - template: Security/SAST.gitlab-ci.yml
+  - local: 'engine/.gitlab-ci.yml'
+  - local: 'web/.gitlab-ci.yml'
diff --git a/Dockerfile.ci-checker b/Dockerfile.ci-checker
index e28bc0617..7f6a74388 100644
--- a/Dockerfile.ci-checker
+++ b/Dockerfile.ci-checker
@@ -5,6 +5,6 @@ RUN apk update && apk add --no-cache bash
 
 WORKDIR /home/dblab
 
-COPY ./bin/run-ci ./bin/run-ci
+COPY ./engine/bin/run-ci ./bin/run-ci
 
 CMD ./bin/run-ci
diff --git a/Dockerfile.dblab-cli b/Dockerfile.dblab-cli
index d587937a6..c941049e6 100644
--- a/Dockerfile.dblab-cli
+++ b/Dockerfile.dblab-cli
@@ -4,5 +4,5 @@ FROM docker:19.03.15
 RUN apk update && apk add --no-cache bash jq
 
 WORKDIR /home/dblab
-COPY ./bin/dblab ./bin/dblab
+COPY ./engine/bin/dblab ./bin/dblab
 CMD ./bin/dblab
diff --git a/Dockerfile.dblab-server b/Dockerfile.dblab-server
index 14fdf9f2a..9570e670c 100644
--- a/Dockerfile.dblab-server
+++ b/Dockerfile.dblab-server
@@ -14,10 +14,9 @@ ENV PATH="${PATH}:/usr/share/bcc/tools"
 
 WORKDIR /home/dblab
 
-COPY ./bin/dblab-server ./bin/dblab-server
+COPY ./engine/bin/dblab-server ./bin/dblab-server
+COPY ./engine/configs/standard ./standard
 COPY ./api ./api
-COPY ./web ./web
-COPY ./configs/standard ./standard
 COPY ./scripts ./scripts
 
 CMD ./bin/dblab-server
diff --git a/Dockerfile.swagger-ui b/Dockerfile.swagger-ui
index dd6b90ac0..f137777b0 100644
--- a/Dockerfile.swagger-ui
+++ b/Dockerfile.swagger-ui
@@ -1,3 +1,3 @@
 FROM nginx:1.17-alpine
 COPY ./api/swagger-spec/ /usr/share/nginx/html/api/swagger-spec/
-COPY ./web /usr/share/nginx/html
+COPY ./api/swagger-ui /usr/share/nginx/html
diff --git a/swagger/favicon-16x16.png b/api/swagger-ui/favicon-16x16.png
similarity index 100%
rename from swagger/favicon-16x16.png
rename to api/swagger-ui/favicon-16x16.png
diff --git a/swagger/favicon-32x32.png b/api/swagger-ui/favicon-32x32.png
similarity index 100%
rename from swagger/favicon-32x32.png
rename to api/swagger-ui/favicon-32x32.png
diff --git a/swagger/index.html b/api/swagger-ui/index.html
similarity index 100%
rename from swagger/index.html
rename to api/swagger-ui/index.html
diff --git a/swagger/oauth2-redirect.html b/api/swagger-ui/oauth2-redirect.html
similarity index 100%
rename from swagger/oauth2-redirect.html
rename to api/swagger-ui/oauth2-redirect.html
diff --git a/swagger/swagger-ui-bundle.js b/api/swagger-ui/swagger-ui-bundle.js
similarity index 100%
rename from swagger/swagger-ui-bundle.js
rename to api/swagger-ui/swagger-ui-bundle.js
diff --git a/swagger/swagger-ui-bundle.js.map b/api/swagger-ui/swagger-ui-bundle.js.map
similarity index 100%
rename from swagger/swagger-ui-bundle.js.map
rename to api/swagger-ui/swagger-ui-bundle.js.map
diff --git a/swagger/swagger-ui-es-bundle-core.js b/api/swagger-ui/swagger-ui-es-bundle-core.js
similarity index 100%
rename from swagger/swagger-ui-es-bundle-core.js
rename to api/swagger-ui/swagger-ui-es-bundle-core.js
diff --git a/swagger/swagger-ui-es-bundle-core.js.map b/api/swagger-ui/swagger-ui-es-bundle-core.js.map
similarity index 100%
rename from swagger/swagger-ui-es-bundle-core.js.map
rename to api/swagger-ui/swagger-ui-es-bundle-core.js.map
diff --git a/swagger/swagger-ui-es-bundle.js b/api/swagger-ui/swagger-ui-es-bundle.js
similarity index 100%
rename from swagger/swagger-ui-es-bundle.js
rename to api/swagger-ui/swagger-ui-es-bundle.js
diff --git a/swagger/swagger-ui-es-bundle.js.map b/api/swagger-ui/swagger-ui-es-bundle.js.map
similarity index 100%
rename from swagger/swagger-ui-es-bundle.js.map
rename to api/swagger-ui/swagger-ui-es-bundle.js.map
diff --git a/swagger/swagger-ui-standalone-preset.js b/api/swagger-ui/swagger-ui-standalone-preset.js
similarity index 100%
rename from swagger/swagger-ui-standalone-preset.js
rename to api/swagger-ui/swagger-ui-standalone-preset.js
diff --git a/swagger/swagger-ui-standalone-preset.js.map b/api/swagger-ui/swagger-ui-standalone-preset.js.map
similarity index 100%
rename from swagger/swagger-ui-standalone-preset.js.map
rename to api/swagger-ui/swagger-ui-standalone-preset.js.map
diff --git a/swagger/swagger-ui.css b/api/swagger-ui/swagger-ui.css
similarity index 100%
rename from swagger/swagger-ui.css
rename to api/swagger-ui/swagger-ui.css
diff --git a/swagger/swagger-ui.css.map b/api/swagger-ui/swagger-ui.css.map
similarity index 100%
rename from swagger/swagger-ui.css.map
rename to api/swagger-ui/swagger-ui.css.map
diff --git a/swagger/swagger-ui.js b/api/swagger-ui/swagger-ui.js
similarity index 100%
rename from swagger/swagger-ui.js
rename to api/swagger-ui/swagger-ui.js
diff --git a/swagger/swagger-ui.js.map b/api/swagger-ui/swagger-ui.js.map
similarity index 100%
rename from swagger/swagger-ui.js.map
rename to api/swagger-ui/swagger-ui.js.map
diff --git a/engine/.gitlab-ci.yml b/engine/.gitlab-ci.yml
new file mode 100644
index 000000000..372e8010d
--- /dev/null
+++ b/engine/.gitlab-ci.yml
@@ -0,0 +1,410 @@
+stages:
+  - test
+  - build-binary
+  - build
+  - integration-test
+  - deploy
+
+## Conditions
+.except_web_rules:
+  rules:
+    - changes:
+        - web/**/*
+      when: never
+
+.only_dle_tag_release: &only_tag_release
+  rules:
+   - if: $CI_COMMIT_TAG =~ /^v[0-9.]+$/
+
+.only_dle_tag_rc: &only_tag_rc
+  rules:
+    - if: $CI_COMMIT_TAG =~ /^v[0-9.]+[\-_]*[a-zA-Z]+[a-zA-Z0-9.\-_]*[a-zA-Z0-9]+$/
+
+.only_dle_master: &only_master
+  rules:
+    - !reference [.except_web_rules, rules]
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+
+.only_dle_feature: &only_feature
+  rules:
+    - !reference [.except_web_rules, rules]
+    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
+
+.dle: &dle
+  rules:
+    - !reference [.only_dle_master, rules]
+    - !reference [.only_dle_feature, rules]
+    - !reference [.only_dle_tag_release, rules]
+    - !reference [.only_dle_tag_rc, rules]
+
+test:
+  <<: *dle
+  stage: test
+  script:
+    - make test
+
+lint:
+  rules:
+    - !reference [.dle, rules]
+  stage: test
+  script:
+    - make lint
+
+### Build binary.
+build-binary-alpine:
+  <<: *dle
+  image: golang:1.17-alpine
+  stage: build-binary
+  artifacts:
+    paths:
+      - bin
+  script:
+    - apk add --update --no-cache make git
+    - make build
+
+build-binary-client-dev:
+  <<: *only_feature
+  stage: build-binary
+  artifacts:
+    paths:
+      - bin
+  script:
+    - make build-client
+
+build-binary-client-master:
+  <<: *only_master
+  stage: build-binary
+  script:
+    - make build-client
+
+    # Install google-cloud-sdk.
+    - echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
+    - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
+    - apt-get update && apt-get install -y google-cloud-sdk
+
+    # Authenticate.
+    - echo $GCP_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
+
+    # Upload artifacts.
+    - gsutil -m cp -r bin/cli/* gs://database-lab-cli/master/
+
+build-binary-client:
+  <<: *only_tag_release
+  stage: build-binary
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+  script:
+    - make build-client
+
+    # Install google-cloud-sdk.
+    - echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
+    - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
+    - apt-get update && apt-get install -y google-cloud-sdk
+
+    # Authenticate.
+    - echo $GCP_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
+
+    # Upload artifacts.
+    - gsutil -m cp -r bin/cli/* gs://database-lab-cli/${CLEAN_TAG}/
+    - gsutil -m cp -r bin/cli/* gs://database-lab-cli/latest/
+
+build-binary-client-rc:
+  <<: *only_tag_rc
+  stage: build-binary
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+  script:
+    - make build-client
+
+    # Install google-cloud-sdk.
+    - echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
+    - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
+    - apt-get update && apt-get install -y google-cloud-sdk
+
+    # Authenticate.
+    - echo $GCP_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
+
+    # Upload artifacts.
+    - gsutil -m cp -r bin/cli/* gs://database-lab-cli/${CLEAN_TAG}/
+
+.job_template: &build_image_definition
+  image: docker:19
+  stage: build
+  artifacts:
+    paths:
+      - bin
+  services:
+    - name: docker:dind
+  script:
+    - apk update && apk upgrade && apk add --no-cache bash # TODO(anatoly): Remove dependency.
+    - bash ./scripts/ci_docker_build_push.sh
+
+build-image-feature-server:
+  <<: *build_image_definition
+  <<: *only_feature
+  variables:
+    REGISTRY_USER: "${CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.dblab-server"
+    DOCKER_NAME: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/dblab-server"
+    TAGS: "${DOCKER_NAME}:${CI_COMMIT_REF_SLUG}"
+
+build-image-feature-ci-checker:
+  <<: *build_image_definition
+  <<: *only_feature
+  variables:
+    REGISTRY_USER: "${CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.ci-checker"
+    DOCKER_NAME: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/dblab-ci-checker"
+    TAGS: "${DOCKER_NAME}:${CI_COMMIT_REF_SLUG}"
+
+build-image-feature-client:
+  <<: *build_image_definition
+  <<: *only_feature
+  variables:
+    REGISTRY_USER: "${CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.dblab-cli"
+    DOCKER_NAME: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/dblab-cli"
+    TAGS: "${DOCKER_NAME}:${CI_COMMIT_REF_SLUG}"
+
+build-image-master-server:
+  <<: *build_image_definition
+  <<: *only_master
+  variables:
+    DOCKER_FILE: "Dockerfile.dblab-server"
+    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-server"
+    TAGS: "${DOCKER_NAME}:master,${DOCKER_NAME}:master-${CI_COMMIT_SHORT_SHA}"
+
+build-image-master-ci-checker:
+  <<: *build_image_definition
+  <<: *only_master
+  variables:
+    DOCKER_FILE: "Dockerfile.ci-checker"
+    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-ci-checker"
+    TAGS: "${DOCKER_NAME}:master,${DOCKER_NAME}:master-${CI_COMMIT_SHORT_SHA}"
+
+build-image-master-client:
+  <<: *build_image_definition
+  <<: *only_master
+  variables:
+    DOCKER_FILE: "Dockerfile.dblab-cli"
+    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-cli"
+    TAGS: "${DOCKER_NAME}:master,${DOCKER_NAME}:master-${CI_COMMIT_SHORT_SHA}"
+
+build-image-latest-server:
+  <<: *build_image_definition
+  <<: *only_tag_release
+  variables:
+    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${DH_CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.dblab-server"
+    DOCKER_NAME: "postgresai/dblab-server"
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+    - export LATEST_TAG=$(echo ${CLEAN_TAG%.*}-latest)
+    - export TAGS="${DOCKER_NAME}:${LATEST_TAG},${DOCKER_NAME}:${CLEAN_TAG}"
+
+build-image-latest-server-dev:
+  <<: *build_image_definition
+  <<: *only_tag_release
+  variables:
+    REGISTRY_USER: "${CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.dblab-server"
+    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-server"
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+    - export TAGS="${DOCKER_NAME}:${CLEAN_TAG}"
+
+build-image-latest-ci-checker:
+  <<: *build_image_definition
+  <<: *only_tag_release
+  variables:
+    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${DH_CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.ci-checker"
+    DOCKER_NAME: "postgresai/dblab-ci-checker"
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+    - export LATEST_TAG=$(echo ${CLEAN_TAG%.*}-latest)
+    - export TAGS="${DOCKER_NAME}:${LATEST_TAG},${DOCKER_NAME}:${CLEAN_TAG}"
+
+build-image-latest-ci-checker-dev:
+  <<: *build_image_definition
+  <<: *only_tag_release
+  variables:
+    REGISTRY_USER: "${CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.ci-checker"
+    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-ci-checker"
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+    - export TAGS="${DOCKER_NAME}:${CLEAN_TAG}"
+
+build-image-latest-client:
+  <<: *build_image_definition
+  <<: *only_tag_release
+  variables:
+    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${DH_CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.dblab-cli"
+    DOCKER_NAME: "postgresai/dblab"
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+    - export LATEST_TAG=$(echo ${CLEAN_TAG%.*}-latest)
+    - export TAGS="${DOCKER_NAME}:${LATEST_TAG},${DOCKER_NAME}:${CLEAN_TAG}"
+
+build-image-rc-server:
+  <<: *build_image_definition
+  <<: *only_tag_rc
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+  variables:
+    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${DH_CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.dblab-server"
+    DOCKER_NAME: "postgresai/dblab-server"
+    TAGS: "${DOCKER_NAME}:${CLEAN_TAG}"
+
+build-image-rc-server-dev:
+  <<: *build_image_definition
+  <<: *only_tag_rc
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+  variables:
+    REGISTRY_USER: "${CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.dblab-server"
+    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-server"
+    TAGS: "${DOCKER_NAME}:${CLEAN_TAG}"
+
+build-image-rc-ci-checker:
+  <<: *build_image_definition
+  <<: *only_tag_rc
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+  variables:
+    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${DH_CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.ci-checker"
+    DOCKER_NAME: "postgresai/dblab-ci-checker"
+    TAGS: "${DOCKER_NAME}:${CLEAN_TAG}"
+
+build-image-rc-ci-checker-dev:
+  <<: *build_image_definition
+  <<: *only_tag_rc
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+  variables:
+    REGISTRY_USER: "${CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.ci-checker"
+    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-ci-checker"
+    TAGS: "${DOCKER_NAME}:${CLEAN_TAG}"
+
+build-image-rc-client:
+  <<: *build_image_definition
+  <<: *only_tag_rc
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+  variables:
+    REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
+    REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
+    REGISTRY: "${DH_CI_REGISTRY}"
+    DOCKER_FILE: "Dockerfile.dblab-cli"
+    DOCKER_NAME: "postgresai/dblab"
+    TAGS: "${DOCKER_NAME}:${CLEAN_TAG}"
+
+build-image-swagger-latest:
+  <<: *build_image_definition
+  <<: *only_tag_release
+  variables:
+    DOCKER_FILE: "Dockerfile.swagger-ui"
+    DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-swagger-ui"
+  before_script:
+    - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
+    - export LATEST_TAG=$(echo ${CLEAN_TAG%.*}-latest)
+    - export TAGS="${DOCKER_NAME}:${LATEST_TAG}"
+
+
+.bash-test: &bash_test
+  stage: integration-test
+  variables:
+    IMAGE_TAG: "${CI_COMMIT_REF_SLUG}"
+  rules:
+    - changes:
+        - web/**/*
+      when: never
+    - if: '$CI_PROJECT_NAMESPACE != "postgres-ai"'
+      when: never
+    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
+      changes:
+        - engine/**/*
+  script:
+    - bash test/1.synthetic.sh
+    - bash test/2.logical_generic.sh
+    - bash test/4.physical_basebackup.sh
+  after_script:
+    - bash test/_cleanup.sh
+  tags:
+    - dle-test
+
+bash-test-9-6:
+  <<: *bash_test
+  variables:
+    POSTGRES_VERSION: "9.6"
+
+bash-test-10:
+  <<: *bash_test
+  variables:
+    POSTGRES_VERSION: 10
+
+bash-test-11:
+  <<: *bash_test
+  variables:
+    POSTGRES_VERSION: 11
+
+bash-test-12:
+  <<: *bash_test
+  variables:
+    POSTGRES_VERSION: 12
+
+bash-test-13:
+  <<: *bash_test
+  variables:
+    POSTGRES_VERSION: 13
+
+bash-test-14:
+  <<: *bash_test
+  variables:
+    POSTGRES_VERSION: 14
+
+integration-test:
+  services:
+    - name: docker:dind
+      command: [ "--tls=false" ]
+  <<: *only_feature
+  stage: integration-test
+  variables:
+    # Instruct Testcontainers to use the daemon of DinD.
+    DOCKER_HOST: "tcp://docker:2375"
+    # Instruct Docker not to start over TLS.
+    DOCKER_TLS_CERTDIR: ""
+    # Improve performance with overlayfs.
+    DOCKER_DRIVER: overlay2
+  script:
+    - make test-ci-integration
diff --git a/.golangci.yml b/engine/.golangci.yml
similarity index 100%
rename from .golangci.yml
rename to engine/.golangci.yml
diff --git a/Makefile b/engine/Makefile
similarity index 100%
rename from Makefile
rename to engine/Makefile
diff --git a/cmd/cli/commands/client.go b/engine/cmd/cli/commands/client.go
similarity index 100%
rename from cmd/cli/commands/client.go
rename to engine/cmd/cli/commands/client.go
diff --git a/cmd/cli/commands/clone/actions.go b/engine/cmd/cli/commands/clone/actions.go
similarity index 100%
rename from cmd/cli/commands/clone/actions.go
rename to engine/cmd/cli/commands/clone/actions.go
diff --git a/cmd/cli/commands/clone/command_list.go b/engine/cmd/cli/commands/clone/command_list.go
similarity index 100%
rename from cmd/cli/commands/clone/command_list.go
rename to engine/cmd/cli/commands/clone/command_list.go
diff --git a/cmd/cli/commands/config/actions.go b/engine/cmd/cli/commands/config/actions.go
similarity index 100%
rename from cmd/cli/commands/config/actions.go
rename to engine/cmd/cli/commands/config/actions.go
diff --git a/cmd/cli/commands/config/command_list.go b/engine/cmd/cli/commands/config/command_list.go
similarity index 100%
rename from cmd/cli/commands/config/command_list.go
rename to engine/cmd/cli/commands/config/command_list.go
diff --git a/cmd/cli/commands/config/duration.go b/engine/cmd/cli/commands/config/duration.go
similarity index 100%
rename from cmd/cli/commands/config/duration.go
rename to engine/cmd/cli/commands/config/duration.go
diff --git a/cmd/cli/commands/config/environment.go b/engine/cmd/cli/commands/config/environment.go
similarity index 100%
rename from cmd/cli/commands/config/environment.go
rename to engine/cmd/cli/commands/config/environment.go
diff --git a/cmd/cli/commands/config/file.go b/engine/cmd/cli/commands/config/file.go
similarity index 100%
rename from cmd/cli/commands/config/file.go
rename to engine/cmd/cli/commands/config/file.go
diff --git a/cmd/cli/commands/errors.go b/engine/cmd/cli/commands/errors.go
similarity index 100%
rename from cmd/cli/commands/errors.go
rename to engine/cmd/cli/commands/errors.go
diff --git a/cmd/cli/commands/global/actions.go b/engine/cmd/cli/commands/global/actions.go
similarity index 100%
rename from cmd/cli/commands/global/actions.go
rename to engine/cmd/cli/commands/global/actions.go
diff --git a/cmd/cli/commands/global/command_list.go b/engine/cmd/cli/commands/global/command_list.go
similarity index 100%
rename from cmd/cli/commands/global/command_list.go
rename to engine/cmd/cli/commands/global/command_list.go
diff --git a/cmd/cli/commands/instance/actions.go b/engine/cmd/cli/commands/instance/actions.go
similarity index 100%
rename from cmd/cli/commands/instance/actions.go
rename to engine/cmd/cli/commands/instance/actions.go
diff --git a/cmd/cli/commands/instance/command_list.go b/engine/cmd/cli/commands/instance/command_list.go
similarity index 100%
rename from cmd/cli/commands/instance/command_list.go
rename to engine/cmd/cli/commands/instance/command_list.go
diff --git a/cmd/cli/commands/port_forwarding.go b/engine/cmd/cli/commands/port_forwarding.go
similarity index 100%
rename from cmd/cli/commands/port_forwarding.go
rename to engine/cmd/cli/commands/port_forwarding.go
diff --git a/cmd/cli/commands/snapshot/actions.go b/engine/cmd/cli/commands/snapshot/actions.go
similarity index 100%
rename from cmd/cli/commands/snapshot/actions.go
rename to engine/cmd/cli/commands/snapshot/actions.go
diff --git a/cmd/cli/commands/snapshot/command_list.go b/engine/cmd/cli/commands/snapshot/command_list.go
similarity index 100%
rename from cmd/cli/commands/snapshot/command_list.go
rename to engine/cmd/cli/commands/snapshot/command_list.go
diff --git a/cmd/cli/main.go b/engine/cmd/cli/main.go
similarity index 100%
rename from cmd/cli/main.go
rename to engine/cmd/cli/main.go
diff --git a/cmd/cli/templates/help.go b/engine/cmd/cli/templates/help.go
similarity index 100%
rename from cmd/cli/templates/help.go
rename to engine/cmd/cli/templates/help.go
diff --git a/cmd/database-lab/main.go b/engine/cmd/database-lab/main.go
similarity index 100%
rename from cmd/database-lab/main.go
rename to engine/cmd/database-lab/main.go
diff --git a/cmd/runci/main.go b/engine/cmd/runci/main.go
similarity index 100%
rename from cmd/runci/main.go
rename to engine/cmd/runci/main.go
diff --git a/configs/config.example.ci_checker.yml b/engine/configs/config.example.ci_checker.yml
similarity index 100%
rename from configs/config.example.ci_checker.yml
rename to engine/configs/config.example.ci_checker.yml
diff --git a/configs/config.example.logical_generic.yml b/engine/configs/config.example.logical_generic.yml
similarity index 100%
rename from configs/config.example.logical_generic.yml
rename to engine/configs/config.example.logical_generic.yml
diff --git a/configs/config.example.logical_rds_iam.yml b/engine/configs/config.example.logical_rds_iam.yml
similarity index 100%
rename from configs/config.example.logical_rds_iam.yml
rename to engine/configs/config.example.logical_rds_iam.yml
diff --git a/configs/config.example.physical_generic.yml b/engine/configs/config.example.physical_generic.yml
similarity index 100%
rename from configs/config.example.physical_generic.yml
rename to engine/configs/config.example.physical_generic.yml
diff --git a/configs/config.example.physical_walg.yml b/engine/configs/config.example.physical_walg.yml
similarity index 100%
rename from configs/config.example.physical_walg.yml
rename to engine/configs/config.example.physical_walg.yml
diff --git a/configs/standard/postgres/control/pg_hba.conf b/engine/configs/standard/postgres/control/pg_hba.conf
similarity index 100%
rename from configs/standard/postgres/control/pg_hba.conf
rename to engine/configs/standard/postgres/control/pg_hba.conf
diff --git a/configs/standard/postgres/control/postgresql.conf b/engine/configs/standard/postgres/control/postgresql.conf
similarity index 100%
rename from configs/standard/postgres/control/postgresql.conf
rename to engine/configs/standard/postgres/control/postgresql.conf
diff --git a/configs/standard/postgres/default/10/pg_hba.conf b/engine/configs/standard/postgres/default/10/pg_hba.conf
similarity index 100%
rename from configs/standard/postgres/default/10/pg_hba.conf
rename to engine/configs/standard/postgres/default/10/pg_hba.conf
diff --git a/configs/standard/postgres/default/10/postgresql.dblab.postgresql.conf b/engine/configs/standard/postgres/default/10/postgresql.dblab.postgresql.conf
similarity index 100%
rename from configs/standard/postgres/default/10/postgresql.dblab.postgresql.conf
rename to engine/configs/standard/postgres/default/10/postgresql.dblab.postgresql.conf
diff --git a/configs/standard/postgres/default/11/pg_hba.conf b/engine/configs/standard/postgres/default/11/pg_hba.conf
similarity index 100%
rename from configs/standard/postgres/default/11/pg_hba.conf
rename to engine/configs/standard/postgres/default/11/pg_hba.conf
diff --git a/configs/standard/postgres/default/11/postgresql.dblab.postgresql.conf b/engine/configs/standard/postgres/default/11/postgresql.dblab.postgresql.conf
similarity index 100%
rename from configs/standard/postgres/default/11/postgresql.dblab.postgresql.conf
rename to engine/configs/standard/postgres/default/11/postgresql.dblab.postgresql.conf
diff --git a/configs/standard/postgres/default/12/pg_hba.conf b/engine/configs/standard/postgres/default/12/pg_hba.conf
similarity index 100%
rename from configs/standard/postgres/default/12/pg_hba.conf
rename to engine/configs/standard/postgres/default/12/pg_hba.conf
diff --git a/configs/standard/postgres/default/12/postgresql.dblab.postgresql.conf b/engine/configs/standard/postgres/default/12/postgresql.dblab.postgresql.conf
similarity index 100%
rename from configs/standard/postgres/default/12/postgresql.dblab.postgresql.conf
rename to engine/configs/standard/postgres/default/12/postgresql.dblab.postgresql.conf
diff --git a/configs/standard/postgres/default/13/pg_hba.conf b/engine/configs/standard/postgres/default/13/pg_hba.conf
similarity index 100%
rename from configs/standard/postgres/default/13/pg_hba.conf
rename to engine/configs/standard/postgres/default/13/pg_hba.conf
diff --git a/configs/standard/postgres/default/13/postgresql.dblab.postgresql.conf b/engine/configs/standard/postgres/default/13/postgresql.dblab.postgresql.conf
similarity index 100%
rename from configs/standard/postgres/default/13/postgresql.dblab.postgresql.conf
rename to engine/configs/standard/postgres/default/13/postgresql.dblab.postgresql.conf
diff --git a/configs/standard/postgres/default/14/pg_hba.conf b/engine/configs/standard/postgres/default/14/pg_hba.conf
similarity index 100%
rename from configs/standard/postgres/default/14/pg_hba.conf
rename to engine/configs/standard/postgres/default/14/pg_hba.conf
diff --git a/configs/standard/postgres/default/14/postgresql.dblab.postgresql.conf b/engine/configs/standard/postgres/default/14/postgresql.dblab.postgresql.conf
similarity index 100%
rename from configs/standard/postgres/default/14/postgresql.dblab.postgresql.conf
rename to engine/configs/standard/postgres/default/14/postgresql.dblab.postgresql.conf
diff --git a/configs/standard/postgres/default/9.6/pg_hba.conf b/engine/configs/standard/postgres/default/9.6/pg_hba.conf
similarity index 100%
rename from configs/standard/postgres/default/9.6/pg_hba.conf
rename to engine/configs/standard/postgres/default/9.6/pg_hba.conf
diff --git a/configs/standard/postgres/default/9.6/postgresql.dblab.postgresql.conf b/engine/configs/standard/postgres/default/9.6/postgresql.dblab.postgresql.conf
similarity index 100%
rename from configs/standard/postgres/default/9.6/postgresql.dblab.postgresql.conf
rename to engine/configs/standard/postgres/default/9.6/postgresql.dblab.postgresql.conf
diff --git a/go.mod b/engine/go.mod
similarity index 100%
rename from go.mod
rename to engine/go.mod
diff --git a/go.sum b/engine/go.sum
similarity index 100%
rename from go.sum
rename to engine/go.sum
diff --git a/internal/cloning/base.go b/engine/internal/cloning/base.go
similarity index 100%
rename from internal/cloning/base.go
rename to engine/internal/cloning/base.go
diff --git a/internal/cloning/base_test.go b/engine/internal/cloning/base_test.go
similarity index 100%
rename from internal/cloning/base_test.go
rename to engine/internal/cloning/base_test.go
diff --git a/internal/cloning/snapshots.go b/engine/internal/cloning/snapshots.go
similarity index 100%
rename from internal/cloning/snapshots.go
rename to engine/internal/cloning/snapshots.go
diff --git a/internal/cloning/snapshots_test.go b/engine/internal/cloning/snapshots_test.go
similarity index 100%
rename from internal/cloning/snapshots_test.go
rename to engine/internal/cloning/snapshots_test.go
diff --git a/internal/cloning/storage.go b/engine/internal/cloning/storage.go
similarity index 100%
rename from internal/cloning/storage.go
rename to engine/internal/cloning/storage.go
diff --git a/internal/cloning/storage_test.go b/engine/internal/cloning/storage_test.go
similarity index 100%
rename from internal/cloning/storage_test.go
rename to engine/internal/cloning/storage_test.go
diff --git a/internal/cloning/wrapper.go b/engine/internal/cloning/wrapper.go
similarity index 100%
rename from internal/cloning/wrapper.go
rename to engine/internal/cloning/wrapper.go
diff --git a/internal/embeddedui/embedded_ui.go b/engine/internal/embeddedui/embedded_ui.go
similarity index 100%
rename from internal/embeddedui/embedded_ui.go
rename to engine/internal/embeddedui/embedded_ui.go
diff --git a/internal/estimator/estimator.go b/engine/internal/estimator/estimator.go
similarity index 100%
rename from internal/estimator/estimator.go
rename to engine/internal/estimator/estimator.go
diff --git a/internal/estimator/estimator_test.go b/engine/internal/estimator/estimator_test.go
similarity index 100%
rename from internal/estimator/estimator_test.go
rename to engine/internal/estimator/estimator_test.go
diff --git a/internal/estimator/events.go b/engine/internal/estimator/events.go
similarity index 100%
rename from internal/estimator/events.go
rename to engine/internal/estimator/events.go
diff --git a/internal/estimator/io_events.go b/engine/internal/estimator/io_events.go
similarity index 100%
rename from internal/estimator/io_events.go
rename to engine/internal/estimator/io_events.go
diff --git a/internal/estimator/monitor.go b/engine/internal/estimator/monitor.go
similarity index 100%
rename from internal/estimator/monitor.go
rename to engine/internal/estimator/monitor.go
diff --git a/internal/estimator/monitor_test.go b/engine/internal/estimator/monitor_test.go
similarity index 100%
rename from internal/estimator/monitor_test.go
rename to engine/internal/estimator/monitor_test.go
diff --git a/internal/estimator/profile.go b/engine/internal/estimator/profile.go
similarity index 100%
rename from internal/estimator/profile.go
rename to engine/internal/estimator/profile.go
diff --git a/internal/estimator/timing.go b/engine/internal/estimator/timing.go
similarity index 100%
rename from internal/estimator/timing.go
rename to engine/internal/estimator/timing.go
diff --git a/internal/observer/artifacts.go b/engine/internal/observer/artifacts.go
similarity index 100%
rename from internal/observer/artifacts.go
rename to engine/internal/observer/artifacts.go
diff --git a/internal/observer/observer.go b/engine/internal/observer/observer.go
similarity index 100%
rename from internal/observer/observer.go
rename to engine/internal/observer/observer.go
diff --git a/internal/observer/observer_test.go b/engine/internal/observer/observer_test.go
similarity index 100%
rename from internal/observer/observer_test.go
rename to engine/internal/observer/observer_test.go
diff --git a/internal/observer/observing_clone.go b/engine/internal/observer/observing_clone.go
similarity index 100%
rename from internal/observer/observing_clone.go
rename to engine/internal/observer/observing_clone.go
diff --git a/internal/observer/queries.go b/engine/internal/observer/queries.go
similarity index 100%
rename from internal/observer/queries.go
rename to engine/internal/observer/queries.go
diff --git a/internal/observer/session.go b/engine/internal/observer/session.go
similarity index 100%
rename from internal/observer/session.go
rename to engine/internal/observer/session.go
diff --git a/internal/observer/session_test.go b/engine/internal/observer/session_test.go
similarity index 100%
rename from internal/observer/session_test.go
rename to engine/internal/observer/session_test.go
diff --git a/internal/observer/sql.go b/engine/internal/observer/sql.go
similarity index 100%
rename from internal/observer/sql.go
rename to engine/internal/observer/sql.go
diff --git a/internal/observer/stats.go b/engine/internal/observer/stats.go
similarity index 100%
rename from internal/observer/stats.go
rename to engine/internal/observer/stats.go
diff --git a/internal/platform/platform.go b/engine/internal/platform/platform.go
similarity index 100%
rename from internal/platform/platform.go
rename to engine/internal/platform/platform.go
diff --git a/internal/platform/platform_test.go b/engine/internal/platform/platform_test.go
similarity index 100%
rename from internal/platform/platform_test.go
rename to engine/internal/platform/platform_test.go
diff --git a/internal/portfwd/sshtunnel.go b/engine/internal/portfwd/sshtunnel.go
similarity index 100%
rename from internal/portfwd/sshtunnel.go
rename to engine/internal/portfwd/sshtunnel.go
diff --git a/internal/provision/databases/postgres/pgconfig/configuration.go b/engine/internal/provision/databases/postgres/pgconfig/configuration.go
similarity index 100%
rename from internal/provision/databases/postgres/pgconfig/configuration.go
rename to engine/internal/provision/databases/postgres/pgconfig/configuration.go
diff --git a/internal/provision/databases/postgres/pgconfig/configuration_test.go b/engine/internal/provision/databases/postgres/pgconfig/configuration_test.go
similarity index 100%
rename from internal/provision/databases/postgres/pgconfig/configuration_test.go
rename to engine/internal/provision/databases/postgres/pgconfig/configuration_test.go
diff --git a/internal/provision/databases/postgres/postgres.go b/engine/internal/provision/databases/postgres/postgres.go
similarity index 100%
rename from internal/provision/databases/postgres/postgres.go
rename to engine/internal/provision/databases/postgres/postgres.go
diff --git a/internal/provision/databases/postgres/postgres_mgmt.go b/engine/internal/provision/databases/postgres/postgres_mgmt.go
similarity index 100%
rename from internal/provision/databases/postgres/postgres_mgmt.go
rename to engine/internal/provision/databases/postgres/postgres_mgmt.go
diff --git a/internal/provision/databases/postgres/postgres_mgmt_test.go b/engine/internal/provision/databases/postgres/postgres_mgmt_test.go
similarity index 100%
rename from internal/provision/databases/postgres/postgres_mgmt_test.go
rename to engine/internal/provision/databases/postgres/postgres_mgmt_test.go
diff --git a/internal/provision/databases/postgres/postgres_test.go b/engine/internal/provision/databases/postgres/postgres_test.go
similarity index 100%
rename from internal/provision/databases/postgres/postgres_test.go
rename to engine/internal/provision/databases/postgres/postgres_test.go
diff --git a/internal/provision/docker/docker.go b/engine/internal/provision/docker/docker.go
similarity index 100%
rename from internal/provision/docker/docker.go
rename to engine/internal/provision/docker/docker.go
diff --git a/internal/provision/docker/docker_test.go b/engine/internal/provision/docker/docker_test.go
similarity index 100%
rename from internal/provision/docker/docker_test.go
rename to engine/internal/provision/docker/docker_test.go
diff --git a/internal/provision/mode_local.go b/engine/internal/provision/mode_local.go
similarity index 100%
rename from internal/provision/mode_local.go
rename to engine/internal/provision/mode_local.go
diff --git a/internal/provision/mode_local_test.go b/engine/internal/provision/mode_local_test.go
similarity index 100%
rename from internal/provision/mode_local_test.go
rename to engine/internal/provision/mode_local_test.go
diff --git a/internal/provision/pool/block_devices.go b/engine/internal/provision/pool/block_devices.go
similarity index 100%
rename from internal/provision/pool/block_devices.go
rename to engine/internal/provision/pool/block_devices.go
diff --git a/internal/provision/pool/fstype_bsd.go b/engine/internal/provision/pool/fstype_bsd.go
similarity index 100%
rename from internal/provision/pool/fstype_bsd.go
rename to engine/internal/provision/pool/fstype_bsd.go
diff --git a/internal/provision/pool/fstype_linux.go b/engine/internal/provision/pool/fstype_linux.go
similarity index 100%
rename from internal/provision/pool/fstype_linux.go
rename to engine/internal/provision/pool/fstype_linux.go
diff --git a/internal/provision/pool/fstype_windows.go b/engine/internal/provision/pool/fstype_windows.go
similarity index 100%
rename from internal/provision/pool/fstype_windows.go
rename to engine/internal/provision/pool/fstype_windows.go
diff --git a/internal/provision/pool/manager.go b/engine/internal/provision/pool/manager.go
similarity index 100%
rename from internal/provision/pool/manager.go
rename to engine/internal/provision/pool/manager.go
diff --git a/internal/provision/pool/pool_manager.go b/engine/internal/provision/pool/pool_manager.go
similarity index 100%
rename from internal/provision/pool/pool_manager.go
rename to engine/internal/provision/pool/pool_manager.go
diff --git a/internal/provision/port_checker.go b/engine/internal/provision/port_checker.go
similarity index 100%
rename from internal/provision/port_checker.go
rename to engine/internal/provision/port_checker.go
diff --git a/internal/provision/provision.go b/engine/internal/provision/provision.go
similarity index 100%
rename from internal/provision/provision.go
rename to engine/internal/provision/provision.go
diff --git a/internal/provision/resources/appconfig.go b/engine/internal/provision/resources/appconfig.go
similarity index 100%
rename from internal/provision/resources/appconfig.go
rename to engine/internal/provision/resources/appconfig.go
diff --git a/internal/provision/resources/pool.go b/engine/internal/provision/resources/pool.go
similarity index 100%
rename from internal/provision/resources/pool.go
rename to engine/internal/provision/resources/pool.go
diff --git a/internal/provision/resources/resources.go b/engine/internal/provision/resources/resources.go
similarity index 100%
rename from internal/provision/resources/resources.go
rename to engine/internal/provision/resources/resources.go
diff --git a/internal/provision/runners/runners.go b/engine/internal/provision/runners/runners.go
similarity index 100%
rename from internal/provision/runners/runners.go
rename to engine/internal/provision/runners/runners.go
diff --git a/internal/provision/thinclones/lvm/lvm.go b/engine/internal/provision/thinclones/lvm/lvm.go
similarity index 100%
rename from internal/provision/thinclones/lvm/lvm.go
rename to engine/internal/provision/thinclones/lvm/lvm.go
diff --git a/internal/provision/thinclones/lvm/lvmanager.go b/engine/internal/provision/thinclones/lvm/lvmanager.go
similarity index 100%
rename from internal/provision/thinclones/lvm/lvmanager.go
rename to engine/internal/provision/thinclones/lvm/lvmanager.go
diff --git a/internal/provision/thinclones/manager.go b/engine/internal/provision/thinclones/manager.go
similarity index 100%
rename from internal/provision/thinclones/manager.go
rename to engine/internal/provision/thinclones/manager.go
diff --git a/internal/provision/thinclones/zfs/snapshots_filter.go b/engine/internal/provision/thinclones/zfs/snapshots_filter.go
similarity index 100%
rename from internal/provision/thinclones/zfs/snapshots_filter.go
rename to engine/internal/provision/thinclones/zfs/snapshots_filter.go
diff --git a/internal/provision/thinclones/zfs/snapshots_filter_test.go b/engine/internal/provision/thinclones/zfs/snapshots_filter_test.go
similarity index 100%
rename from internal/provision/thinclones/zfs/snapshots_filter_test.go
rename to engine/internal/provision/thinclones/zfs/snapshots_filter_test.go
diff --git a/internal/provision/thinclones/zfs/zfs.go b/engine/internal/provision/thinclones/zfs/zfs.go
similarity index 100%
rename from internal/provision/thinclones/zfs/zfs.go
rename to engine/internal/provision/thinclones/zfs/zfs.go
diff --git a/internal/provision/thinclones/zfs/zfs_test.go b/engine/internal/provision/thinclones/zfs/zfs_test.go
similarity index 100%
rename from internal/provision/thinclones/zfs/zfs_test.go
rename to engine/internal/provision/thinclones/zfs/zfs_test.go
diff --git a/internal/retrieval/components/components.go b/engine/internal/retrieval/components/components.go
similarity index 100%
rename from internal/retrieval/components/components.go
rename to engine/internal/retrieval/components/components.go
diff --git a/internal/retrieval/config/config.go b/engine/internal/retrieval/config/config.go
similarity index 100%
rename from internal/retrieval/config/config.go
rename to engine/internal/retrieval/config/config.go
diff --git a/internal/retrieval/dbmarker/dbmarker.go b/engine/internal/retrieval/dbmarker/dbmarker.go
similarity index 100%
rename from internal/retrieval/dbmarker/dbmarker.go
rename to engine/internal/retrieval/dbmarker/dbmarker.go
diff --git a/internal/retrieval/engine/engine.go b/engine/internal/retrieval/engine/engine.go
similarity index 100%
rename from internal/retrieval/engine/engine.go
rename to engine/internal/retrieval/engine/engine.go
diff --git a/internal/retrieval/engine/postgres/job_builder.go b/engine/internal/retrieval/engine/postgres/job_builder.go
similarity index 100%
rename from internal/retrieval/engine/postgres/job_builder.go
rename to engine/internal/retrieval/engine/postgres/job_builder.go
diff --git a/internal/retrieval/engine/postgres/logical/archive_types.go b/engine/internal/retrieval/engine/postgres/logical/archive_types.go
similarity index 100%
rename from internal/retrieval/engine/postgres/logical/archive_types.go
rename to engine/internal/retrieval/engine/postgres/logical/archive_types.go
diff --git a/internal/retrieval/engine/postgres/logical/archive_types_test.go b/engine/internal/retrieval/engine/postgres/logical/archive_types_test.go
similarity index 100%
rename from internal/retrieval/engine/postgres/logical/archive_types_test.go
rename to engine/internal/retrieval/engine/postgres/logical/archive_types_test.go
diff --git a/internal/retrieval/engine/postgres/logical/dump.go b/engine/internal/retrieval/engine/postgres/logical/dump.go
similarity index 100%
rename from internal/retrieval/engine/postgres/logical/dump.go
rename to engine/internal/retrieval/engine/postgres/logical/dump.go
diff --git a/internal/retrieval/engine/postgres/logical/dump_default.go b/engine/internal/retrieval/engine/postgres/logical/dump_default.go
similarity index 100%
rename from internal/retrieval/engine/postgres/logical/dump_default.go
rename to engine/internal/retrieval/engine/postgres/logical/dump_default.go
diff --git a/internal/retrieval/engine/postgres/logical/dump_rds.go b/engine/internal/retrieval/engine/postgres/logical/dump_rds.go
similarity index 100%
rename from internal/retrieval/engine/postgres/logical/dump_rds.go
rename to engine/internal/retrieval/engine/postgres/logical/dump_rds.go
diff --git a/internal/retrieval/engine/postgres/logical/logical.go b/engine/internal/retrieval/engine/postgres/logical/logical.go
similarity index 100%
rename from internal/retrieval/engine/postgres/logical/logical.go
rename to engine/internal/retrieval/engine/postgres/logical/logical.go
diff --git a/internal/retrieval/engine/postgres/logical/restore.go b/engine/internal/retrieval/engine/postgres/logical/restore.go
similarity index 100%
rename from internal/retrieval/engine/postgres/logical/restore.go
rename to engine/internal/retrieval/engine/postgres/logical/restore.go
diff --git a/internal/retrieval/engine/postgres/logical/restore_test.go b/engine/internal/retrieval/engine/postgres/logical/restore_test.go
similarity index 100%
rename from internal/retrieval/engine/postgres/logical/restore_test.go
rename to engine/internal/retrieval/engine/postgres/logical/restore_test.go
diff --git a/internal/retrieval/engine/postgres/physical/custom.go b/engine/internal/retrieval/engine/postgres/physical/custom.go
similarity index 100%
rename from internal/retrieval/engine/postgres/physical/custom.go
rename to engine/internal/retrieval/engine/postgres/physical/custom.go
diff --git a/internal/retrieval/engine/postgres/physical/custom_test.go b/engine/internal/retrieval/engine/postgres/physical/custom_test.go
similarity index 100%
rename from internal/retrieval/engine/postgres/physical/custom_test.go
rename to engine/internal/retrieval/engine/postgres/physical/custom_test.go
diff --git a/internal/retrieval/engine/postgres/physical/physical.go b/engine/internal/retrieval/engine/postgres/physical/physical.go
similarity index 100%
rename from internal/retrieval/engine/postgres/physical/physical.go
rename to engine/internal/retrieval/engine/postgres/physical/physical.go
diff --git a/internal/retrieval/engine/postgres/physical/physical_test.go b/engine/internal/retrieval/engine/postgres/physical/physical_test.go
similarity index 100%
rename from internal/retrieval/engine/postgres/physical/physical_test.go
rename to engine/internal/retrieval/engine/postgres/physical/physical_test.go
diff --git a/internal/retrieval/engine/postgres/physical/wal_g.go b/engine/internal/retrieval/engine/postgres/physical/wal_g.go
similarity index 100%
rename from internal/retrieval/engine/postgres/physical/wal_g.go
rename to engine/internal/retrieval/engine/postgres/physical/wal_g.go
diff --git a/internal/retrieval/engine/postgres/physical/wal_g_test.go b/engine/internal/retrieval/engine/postgres/physical/wal_g_test.go
similarity index 100%
rename from internal/retrieval/engine/postgres/physical/wal_g_test.go
rename to engine/internal/retrieval/engine/postgres/physical/wal_g_test.go
diff --git a/internal/retrieval/engine/postgres/snapshot/errors.go b/engine/internal/retrieval/engine/postgres/snapshot/errors.go
similarity index 100%
rename from internal/retrieval/engine/postgres/snapshot/errors.go
rename to engine/internal/retrieval/engine/postgres/snapshot/errors.go
diff --git a/internal/retrieval/engine/postgres/snapshot/logical.go b/engine/internal/retrieval/engine/postgres/snapshot/logical.go
similarity index 100%
rename from internal/retrieval/engine/postgres/snapshot/logical.go
rename to engine/internal/retrieval/engine/postgres/snapshot/logical.go
diff --git a/internal/retrieval/engine/postgres/snapshot/physical.go b/engine/internal/retrieval/engine/postgres/snapshot/physical.go
similarity index 100%
rename from internal/retrieval/engine/postgres/snapshot/physical.go
rename to engine/internal/retrieval/engine/postgres/snapshot/physical.go
diff --git a/internal/retrieval/engine/postgres/snapshot/physical_integration_test.go b/engine/internal/retrieval/engine/postgres/snapshot/physical_integration_test.go
similarity index 100%
rename from internal/retrieval/engine/postgres/snapshot/physical_integration_test.go
rename to engine/internal/retrieval/engine/postgres/snapshot/physical_integration_test.go
diff --git a/internal/retrieval/engine/postgres/snapshot/physical_test.go b/engine/internal/retrieval/engine/postgres/snapshot/physical_test.go
similarity index 100%
rename from internal/retrieval/engine/postgres/snapshot/physical_test.go
rename to engine/internal/retrieval/engine/postgres/snapshot/physical_test.go
diff --git a/internal/retrieval/engine/postgres/snapshot/queryPreprocessor.go b/engine/internal/retrieval/engine/postgres/snapshot/queryPreprocessor.go
similarity index 100%
rename from internal/retrieval/engine/postgres/snapshot/queryPreprocessor.go
rename to engine/internal/retrieval/engine/postgres/snapshot/queryPreprocessor.go
diff --git a/internal/retrieval/engine/postgres/snapshot/snapshot.go b/engine/internal/retrieval/engine/postgres/snapshot/snapshot.go
similarity index 100%
rename from internal/retrieval/engine/postgres/snapshot/snapshot.go
rename to engine/internal/retrieval/engine/postgres/snapshot/snapshot.go
diff --git a/internal/retrieval/engine/postgres/tools/cont/container.go b/engine/internal/retrieval/engine/postgres/tools/cont/container.go
similarity index 100%
rename from internal/retrieval/engine/postgres/tools/cont/container.go
rename to engine/internal/retrieval/engine/postgres/tools/cont/container.go
diff --git a/internal/retrieval/engine/postgres/tools/cont/container_test.go b/engine/internal/retrieval/engine/postgres/tools/cont/container_test.go
similarity index 100%
rename from internal/retrieval/engine/postgres/tools/cont/container_test.go
rename to engine/internal/retrieval/engine/postgres/tools/cont/container_test.go
diff --git a/internal/retrieval/engine/postgres/tools/db/pg.go b/engine/internal/retrieval/engine/postgres/tools/db/pg.go
similarity index 100%
rename from internal/retrieval/engine/postgres/tools/db/pg.go
rename to engine/internal/retrieval/engine/postgres/tools/db/pg.go
diff --git a/internal/retrieval/engine/postgres/tools/defaults/defaults.go b/engine/internal/retrieval/engine/postgres/tools/defaults/defaults.go
similarity index 100%
rename from internal/retrieval/engine/postgres/tools/defaults/defaults.go
rename to engine/internal/retrieval/engine/postgres/tools/defaults/defaults.go
diff --git a/internal/retrieval/engine/postgres/tools/dump.go b/engine/internal/retrieval/engine/postgres/tools/dump.go
similarity index 100%
rename from internal/retrieval/engine/postgres/tools/dump.go
rename to engine/internal/retrieval/engine/postgres/tools/dump.go
diff --git a/internal/retrieval/engine/postgres/tools/fs/tools.go b/engine/internal/retrieval/engine/postgres/tools/fs/tools.go
similarity index 100%
rename from internal/retrieval/engine/postgres/tools/fs/tools.go
rename to engine/internal/retrieval/engine/postgres/tools/fs/tools.go
diff --git a/internal/retrieval/engine/postgres/tools/health/healthcheck.go b/engine/internal/retrieval/engine/postgres/tools/health/healthcheck.go
similarity index 100%
rename from internal/retrieval/engine/postgres/tools/health/healthcheck.go
rename to engine/internal/retrieval/engine/postgres/tools/health/healthcheck.go
diff --git a/internal/retrieval/engine/postgres/tools/pgtool/pgtool.go b/engine/internal/retrieval/engine/postgres/tools/pgtool/pgtool.go
similarity index 100%
rename from internal/retrieval/engine/postgres/tools/pgtool/pgtool.go
rename to engine/internal/retrieval/engine/postgres/tools/pgtool/pgtool.go
diff --git a/internal/retrieval/engine/postgres/tools/tools.go b/engine/internal/retrieval/engine/postgres/tools/tools.go
similarity index 100%
rename from internal/retrieval/engine/postgres/tools/tools.go
rename to engine/internal/retrieval/engine/postgres/tools/tools.go
diff --git a/internal/retrieval/engine/postgres/tools/tools_test.go b/engine/internal/retrieval/engine/postgres/tools/tools_test.go
similarity index 100%
rename from internal/retrieval/engine/postgres/tools/tools_test.go
rename to engine/internal/retrieval/engine/postgres/tools/tools_test.go
diff --git a/internal/retrieval/options/options.go b/engine/internal/retrieval/options/options.go
similarity index 100%
rename from internal/retrieval/options/options.go
rename to engine/internal/retrieval/options/options.go
diff --git a/internal/retrieval/refresh_errors.go b/engine/internal/retrieval/refresh_errors.go
similarity index 100%
rename from internal/retrieval/refresh_errors.go
rename to engine/internal/retrieval/refresh_errors.go
diff --git a/internal/retrieval/retrieval.go b/engine/internal/retrieval/retrieval.go
similarity index 100%
rename from internal/retrieval/retrieval.go
rename to engine/internal/retrieval/retrieval.go
diff --git a/internal/retrieval/retrieval_test.go b/engine/internal/retrieval/retrieval_test.go
similarity index 100%
rename from internal/retrieval/retrieval_test.go
rename to engine/internal/retrieval/retrieval_test.go
diff --git a/internal/retrieval/state.go b/engine/internal/retrieval/state.go
similarity index 100%
rename from internal/retrieval/state.go
rename to engine/internal/retrieval/state.go
diff --git a/internal/retrieval/state_test.go b/engine/internal/retrieval/state_test.go
similarity index 100%
rename from internal/retrieval/state_test.go
rename to engine/internal/retrieval/state_test.go
diff --git a/internal/runci/clone.go b/engine/internal/runci/clone.go
similarity index 100%
rename from internal/runci/clone.go
rename to engine/internal/runci/clone.go
diff --git a/internal/runci/config.go b/engine/internal/runci/config.go
similarity index 100%
rename from internal/runci/config.go
rename to engine/internal/runci/config.go
diff --git a/internal/runci/handlers.go b/engine/internal/runci/handlers.go
similarity index 100%
rename from internal/runci/handlers.go
rename to engine/internal/runci/handlers.go
diff --git a/internal/runci/server.go b/engine/internal/runci/server.go
similarity index 100%
rename from internal/runci/server.go
rename to engine/internal/runci/server.go
diff --git a/internal/runci/source/github.go b/engine/internal/runci/source/github.go
similarity index 100%
rename from internal/runci/source/github.go
rename to engine/internal/runci/source/github.go
diff --git a/internal/runci/source/source.go b/engine/internal/runci/source/source.go
similarity index 100%
rename from internal/runci/source/source.go
rename to engine/internal/runci/source/source.go
diff --git a/internal/srv/api/errors.go b/engine/internal/srv/api/errors.go
similarity index 100%
rename from internal/srv/api/errors.go
rename to engine/internal/srv/api/errors.go
diff --git a/internal/srv/api/errors_test.go b/engine/internal/srv/api/errors_test.go
similarity index 100%
rename from internal/srv/api/errors_test.go
rename to engine/internal/srv/api/errors_test.go
diff --git a/internal/srv/api/util.go b/engine/internal/srv/api/util.go
similarity index 100%
rename from internal/srv/api/util.go
rename to engine/internal/srv/api/util.go
diff --git a/internal/srv/config/config.go b/engine/internal/srv/config/config.go
similarity index 100%
rename from internal/srv/config/config.go
rename to engine/internal/srv/config/config.go
diff --git a/internal/srv/mw/auth.go b/engine/internal/srv/mw/auth.go
similarity index 100%
rename from internal/srv/mw/auth.go
rename to engine/internal/srv/mw/auth.go
diff --git a/internal/srv/mw/auth_test.go b/engine/internal/srv/mw/auth_test.go
similarity index 100%
rename from internal/srv/mw/auth_test.go
rename to engine/internal/srv/mw/auth_test.go
diff --git a/internal/srv/mw/logging.go b/engine/internal/srv/mw/logging.go
similarity index 100%
rename from internal/srv/mw/logging.go
rename to engine/internal/srv/mw/logging.go
diff --git a/internal/srv/routes.go b/engine/internal/srv/routes.go
similarity index 100%
rename from internal/srv/routes.go
rename to engine/internal/srv/routes.go
diff --git a/internal/srv/server.go b/engine/internal/srv/server.go
similarity index 100%
rename from internal/srv/server.go
rename to engine/internal/srv/server.go
diff --git a/internal/srv/ws.go b/engine/internal/srv/ws.go
similarity index 100%
rename from internal/srv/ws.go
rename to engine/internal/srv/ws.go
diff --git a/internal/telemetry/events.go b/engine/internal/telemetry/events.go
similarity index 100%
rename from internal/telemetry/events.go
rename to engine/internal/telemetry/events.go
diff --git a/internal/telemetry/telemetry.go b/engine/internal/telemetry/telemetry.go
similarity index 100%
rename from internal/telemetry/telemetry.go
rename to engine/internal/telemetry/telemetry.go
diff --git a/internal/validator/validator.go b/engine/internal/validator/validator.go
similarity index 100%
rename from internal/validator/validator.go
rename to engine/internal/validator/validator.go
diff --git a/internal/validator/validator_test.go b/engine/internal/validator/validator_test.go
similarity index 100%
rename from internal/validator/validator_test.go
rename to engine/internal/validator/validator_test.go
diff --git a/pkg/client/dblabapi/client.go b/engine/pkg/client/dblabapi/client.go
similarity index 100%
rename from pkg/client/dblabapi/client.go
rename to engine/pkg/client/dblabapi/client.go
diff --git a/pkg/client/dblabapi/client_test.go b/engine/pkg/client/dblabapi/client_test.go
similarity index 100%
rename from pkg/client/dblabapi/client_test.go
rename to engine/pkg/client/dblabapi/client_test.go
diff --git a/pkg/client/dblabapi/clone.go b/engine/pkg/client/dblabapi/clone.go
similarity index 100%
rename from pkg/client/dblabapi/clone.go
rename to engine/pkg/client/dblabapi/clone.go
diff --git a/pkg/client/dblabapi/clone_test.go b/engine/pkg/client/dblabapi/clone_test.go
similarity index 100%
rename from pkg/client/dblabapi/clone_test.go
rename to engine/pkg/client/dblabapi/clone_test.go
diff --git a/pkg/client/dblabapi/estimator.go b/engine/pkg/client/dblabapi/estimator.go
similarity index 100%
rename from pkg/client/dblabapi/estimator.go
rename to engine/pkg/client/dblabapi/estimator.go
diff --git a/pkg/client/dblabapi/snapshot.go b/engine/pkg/client/dblabapi/snapshot.go
similarity index 100%
rename from pkg/client/dblabapi/snapshot.go
rename to engine/pkg/client/dblabapi/snapshot.go
diff --git a/pkg/client/dblabapi/snapshot_test.go b/engine/pkg/client/dblabapi/snapshot_test.go
similarity index 100%
rename from pkg/client/dblabapi/snapshot_test.go
rename to engine/pkg/client/dblabapi/snapshot_test.go
diff --git a/pkg/client/dblabapi/status.go b/engine/pkg/client/dblabapi/status.go
similarity index 100%
rename from pkg/client/dblabapi/status.go
rename to engine/pkg/client/dblabapi/status.go
diff --git a/pkg/client/dblabapi/status_test.go b/engine/pkg/client/dblabapi/status_test.go
similarity index 100%
rename from pkg/client/dblabapi/status_test.go
rename to engine/pkg/client/dblabapi/status_test.go
diff --git a/pkg/client/dblabapi/types/clone.go b/engine/pkg/client/dblabapi/types/clone.go
similarity index 100%
rename from pkg/client/dblabapi/types/clone.go
rename to engine/pkg/client/dblabapi/types/clone.go
diff --git a/pkg/client/dblabapi/types/observation.go b/engine/pkg/client/dblabapi/types/observation.go
similarity index 100%
rename from pkg/client/dblabapi/types/observation.go
rename to engine/pkg/client/dblabapi/types/observation.go
diff --git a/pkg/client/platform/client.go b/engine/pkg/client/platform/client.go
similarity index 100%
rename from pkg/client/platform/client.go
rename to engine/pkg/client/platform/client.go
diff --git a/pkg/client/platform/client_test.go b/engine/pkg/client/platform/client_test.go
similarity index 100%
rename from pkg/client/platform/client_test.go
rename to engine/pkg/client/platform/client_test.go
diff --git a/pkg/client/platform/observation.go b/engine/pkg/client/platform/observation.go
similarity index 100%
rename from pkg/client/platform/observation.go
rename to engine/pkg/client/platform/observation.go
diff --git a/pkg/client/platform/telemetry.go b/engine/pkg/client/platform/telemetry.go
similarity index 100%
rename from pkg/client/platform/telemetry.go
rename to engine/pkg/client/platform/telemetry.go
diff --git a/pkg/client/platform/token.go b/engine/pkg/client/platform/token.go
similarity index 100%
rename from pkg/client/platform/token.go
rename to engine/pkg/client/platform/token.go
diff --git a/pkg/config/config.go b/engine/pkg/config/config.go
similarity index 100%
rename from pkg/config/config.go
rename to engine/pkg/config/config.go
diff --git a/pkg/config/config_test.go b/engine/pkg/config/config_test.go
similarity index 100%
rename from pkg/config/config_test.go
rename to engine/pkg/config/config_test.go
diff --git a/pkg/config/global/config.go b/engine/pkg/config/global/config.go
similarity index 100%
rename from pkg/config/global/config.go
rename to engine/pkg/config/global/config.go
diff --git a/pkg/log/log.go b/engine/pkg/log/log.go
similarity index 100%
rename from pkg/log/log.go
rename to engine/pkg/log/log.go
diff --git a/pkg/models/clone.go b/engine/pkg/models/clone.go
similarity index 100%
rename from pkg/models/clone.go
rename to engine/pkg/models/clone.go
diff --git a/pkg/models/database.go b/engine/pkg/models/database.go
similarity index 100%
rename from pkg/models/database.go
rename to engine/pkg/models/database.go
diff --git a/pkg/models/error.go b/engine/pkg/models/error.go
similarity index 100%
rename from pkg/models/error.go
rename to engine/pkg/models/error.go
diff --git a/pkg/models/fs.go b/engine/pkg/models/fs.go
similarity index 100%
rename from pkg/models/fs.go
rename to engine/pkg/models/fs.go
diff --git a/pkg/models/instance_status.go b/engine/pkg/models/instance_status.go
similarity index 100%
rename from pkg/models/instance_status.go
rename to engine/pkg/models/instance_status.go
diff --git a/pkg/models/observation.go b/engine/pkg/models/observation.go
similarity index 100%
rename from pkg/models/observation.go
rename to engine/pkg/models/observation.go
diff --git a/pkg/models/retrieval.go b/engine/pkg/models/retrieval.go
similarity index 100%
rename from pkg/models/retrieval.go
rename to engine/pkg/models/retrieval.go
diff --git a/pkg/models/retrieval_test.go b/engine/pkg/models/retrieval_test.go
similarity index 100%
rename from pkg/models/retrieval_test.go
rename to engine/pkg/models/retrieval_test.go
diff --git a/pkg/models/snapshot.go b/engine/pkg/models/snapshot.go
similarity index 100%
rename from pkg/models/snapshot.go
rename to engine/pkg/models/snapshot.go
diff --git a/pkg/models/status.go b/engine/pkg/models/status.go
similarity index 100%
rename from pkg/models/status.go
rename to engine/pkg/models/status.go
diff --git a/pkg/util/bytes.go b/engine/pkg/util/bytes.go
similarity index 100%
rename from pkg/util/bytes.go
rename to engine/pkg/util/bytes.go
diff --git a/pkg/util/clones.go b/engine/pkg/util/clones.go
similarity index 100%
rename from pkg/util/clones.go
rename to engine/pkg/util/clones.go
diff --git a/pkg/util/config.go b/engine/pkg/util/config.go
similarity index 100%
rename from pkg/util/config.go
rename to engine/pkg/util/config.go
diff --git a/pkg/util/config_test.go b/engine/pkg/util/config_test.go
similarity index 100%
rename from pkg/util/config_test.go
rename to engine/pkg/util/config_test.go
diff --git a/pkg/util/engine/engine.go b/engine/pkg/util/engine/engine.go
similarity index 100%
rename from pkg/util/engine/engine.go
rename to engine/pkg/util/engine/engine.go
diff --git a/pkg/util/networks/networks.go b/engine/pkg/util/networks/networks.go
similarity index 100%
rename from pkg/util/networks/networks.go
rename to engine/pkg/util/networks/networks.go
diff --git a/pkg/util/networks/networks_test.go b/engine/pkg/util/networks/networks_test.go
similarity index 100%
rename from pkg/util/networks/networks_test.go
rename to engine/pkg/util/networks/networks_test.go
diff --git a/pkg/util/pglog/activity.go b/engine/pkg/util/pglog/activity.go
similarity index 100%
rename from pkg/util/pglog/activity.go
rename to engine/pkg/util/pglog/activity.go
diff --git a/pkg/util/pglog/activity_test.go b/engine/pkg/util/pglog/activity_test.go
similarity index 100%
rename from pkg/util/pglog/activity_test.go
rename to engine/pkg/util/pglog/activity_test.go
diff --git a/pkg/util/slices.go b/engine/pkg/util/slices.go
similarity index 100%
rename from pkg/util/slices.go
rename to engine/pkg/util/slices.go
diff --git a/pkg/util/slices_test.go b/engine/pkg/util/slices_test.go
similarity index 100%
rename from pkg/util/slices_test.go
rename to engine/pkg/util/slices_test.go
diff --git a/pkg/util/testing.go b/engine/pkg/util/testing.go
similarity index 100%
rename from pkg/util/testing.go
rename to engine/pkg/util/testing.go
diff --git a/pkg/util/time.go b/engine/pkg/util/time.go
similarity index 100%
rename from pkg/util/time.go
rename to engine/pkg/util/time.go
diff --git a/pkg/util/time_test.go b/engine/pkg/util/time_test.go
similarity index 100%
rename from pkg/util/time_test.go
rename to engine/pkg/util/time_test.go
diff --git a/testdata/testdata.go b/engine/testdata/testdata.go
similarity index 100%
rename from testdata/testdata.go
rename to engine/testdata/testdata.go
diff --git a/version/version.go b/engine/version/version.go
similarity index 100%
rename from version/version.go
rename to engine/version/version.go
diff --git a/version/version_test.go b/engine/version/version_test.go
similarity index 100%
rename from version/version_test.go
rename to engine/version/version_test.go
-- 
GitLab


From 7bbe6f1e55ada3cf8be1d39cc010bda5e717aba7 Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 12:16:04 +0700
Subject: [PATCH 02/18] fix: [UI] disable workflow

---
 web/packages/platform/.gitlab-ci.yml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/web/packages/platform/.gitlab-ci.yml b/web/packages/platform/.gitlab-ci.yml
index 77f024d74..39ffe4bd8 100644
--- a/web/packages/platform/.gitlab-ci.yml
+++ b/web/packages/platform/.gitlab-ci.yml
@@ -9,7 +9,6 @@ workflow:
   rules:
     - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
       when: never
-    - when: always
 
 # Environments.
 .environment_production: &env_production
-- 
GitLab


From b9f83512c3a9990fb994cc37ee809dfbc49b2beb Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 12:23:11 +0700
Subject: [PATCH 03/18] fix: [UI] enable workflow rules

---
 web/packages/platform/.gitlab-ci.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/web/packages/platform/.gitlab-ci.yml b/web/packages/platform/.gitlab-ci.yml
index 39ffe4bd8..d36e12f5f 100644
--- a/web/packages/platform/.gitlab-ci.yml
+++ b/web/packages/platform/.gitlab-ci.yml
@@ -7,8 +7,10 @@
 
 workflow:
   rules:
-    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
       when: never
+    - if: $CI_COMMIT_BRANCH
+    - if: $CI_COMMIT_TAG
 
 # Environments.
 .environment_production: &env_production
-- 
GitLab


From 82024cd9325b93ccb99abb1106094519795cea0d Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 12:31:02 +0700
Subject: [PATCH 04/18] chore: [engine] run engine jobs

---
 .gitlab-ci.yml        | 2 --
 engine/.gitlab-ci.yml | 9 ++++-----
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8e0999e50..871837800 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,8 +1,6 @@
 variables:
-  SAST_EXCLUDED_ANALYZERS: "semgrep-sast"
   DOCKER_DRIVER: overlay2
 
 include:
-  - template: Security/SAST.gitlab-ci.yml
   - local: 'engine/.gitlab-ci.yml'
   - local: 'web/.gitlab-ci.yml'
diff --git a/engine/.gitlab-ci.yml b/engine/.gitlab-ci.yml
index 372e8010d..c90768317 100644
--- a/engine/.gitlab-ci.yml
+++ b/engine/.gitlab-ci.yml
@@ -6,11 +6,10 @@ stages:
   - deploy
 
 ## Conditions
-.except_web_rules:
+.only_engine:
   rules:
     - changes:
-        - web/**/*
-      when: never
+        - engine/**/*
 
 .only_dle_tag_release: &only_tag_release
   rules:
@@ -22,12 +21,12 @@ stages:
 
 .only_dle_master: &only_master
   rules:
-    - !reference [.except_web_rules, rules]
+    - !reference [.only_engine, rules]
     - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
 
 .only_dle_feature: &only_feature
   rules:
-    - !reference [.except_web_rules, rules]
+    - !reference [.only_engine, rules]
     - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
 
 .dle: &dle
-- 
GitLab


From 98909c54ad6cf1fc01f9d07ed6f7c626adf32d5f Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 12:32:38 +0700
Subject: [PATCH 05/18] fix: [web] run ui jobs

---
 web/.gitlab-ci.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/web/.gitlab-ci.yml b/web/.gitlab-ci.yml
index a301b84e3..c330ca779 100644
--- a/web/.gitlab-ci.yml
+++ b/web/.gitlab-ci.yml
@@ -1,3 +1,6 @@
+variables:
+  SAST_EXCLUDED_ANALYZERS: "semgrep-sast"
+
 .only_web: &only_web
   rules:
     - changes:
@@ -13,5 +16,6 @@ check_code_style:
     - npm --prefix web/ run lint -w packages/platform
 
 include:
+  - template: Security/SAST.gitlab-ci.yml
   - local: 'web/packages/ce/.gitlab-ci.yml'
   - local: 'web/packages/platform/.gitlab-ci.yml'
-- 
GitLab


From 7d806d313993e1150340bb83a6598a5ee4d8bbde Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 12:45:41 +0700
Subject: [PATCH 06/18] fix: [engine] run jobs

---
 engine/.gitlab-ci.yml | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/engine/.gitlab-ci.yml b/engine/.gitlab-ci.yml
index c90768317..55e15d9d6 100644
--- a/engine/.gitlab-ci.yml
+++ b/engine/.gitlab-ci.yml
@@ -6,7 +6,7 @@ stages:
   - deploy
 
 ## Conditions
-.only_engine:
+.only_engine: &only_engine
   rules:
     - changes:
         - engine/**/*
@@ -29,29 +29,23 @@ stages:
     - !reference [.only_engine, rules]
     - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
 
-.dle: &dle
-  rules:
-    - !reference [.only_dle_master, rules]
-    - !reference [.only_dle_feature, rules]
-    - !reference [.only_dle_tag_release, rules]
-    - !reference [.only_dle_tag_rc, rules]
-
 test:
-  <<: *dle
+  <<: *only_engine
   stage: test
   script:
+    - cd engine
     - make test
 
 lint:
-  rules:
-    - !reference [.dle, rules]
+  <<: *only_engine
   stage: test
   script:
+    - cd engine
     - make lint
 
 ### Build binary.
 build-binary-alpine:
-  <<: *dle
+  <<: *only_engine
   image: golang:1.17-alpine
   stage: build-binary
   artifacts:
@@ -59,6 +53,7 @@ build-binary-alpine:
       - bin
   script:
     - apk add --update --no-cache make git
+    - cd engine
     - make build
 
 build-binary-client-dev:
@@ -68,12 +63,14 @@ build-binary-client-dev:
     paths:
       - bin
   script:
+    - cd engine
     - make build-client
 
 build-binary-client-master:
   <<: *only_master
   stage: build-binary
   script:
+    - cd engine
     - make build-client
 
     # Install google-cloud-sdk.
@@ -93,6 +90,7 @@ build-binary-client:
   before_script:
     - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
   script:
+    - cd engine
     - make build-client
 
     # Install google-cloud-sdk.
@@ -113,6 +111,7 @@ build-binary-client-rc:
   before_script:
     - export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
   script:
+    - cd engine
     - make build-client
 
     # Install google-cloud-sdk.
@@ -406,4 +405,5 @@ integration-test:
     # Improve performance with overlayfs.
     DOCKER_DRIVER: overlay2
   script:
+    - cd engine
     - make test-ci-integration
-- 
GitLab


From 673302f67e5ff5f85c8674e37bef09c971b963f8 Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 12:49:27 +0700
Subject: [PATCH 07/18] fix: [engine] add default image

---
 engine/.gitlab-ci.yml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/engine/.gitlab-ci.yml b/engine/.gitlab-ci.yml
index 55e15d9d6..b7578117a 100644
--- a/engine/.gitlab-ci.yml
+++ b/engine/.gitlab-ci.yml
@@ -1,3 +1,6 @@
+default:
+  image: golang:1.17
+
 stages:
   - test
   - build-binary
-- 
GitLab


From fb25018d89e8a1a8a85e716ef7524b5da1f3b8ff Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 12:57:36 +0700
Subject: [PATCH 08/18] fix: [engine] disable gosec-sast because it cannot run

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 871837800..8946d1cf3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,5 @@
 variables:
+  SAST_EXCLUDED_ANALYZERS: "semgrep-sast,gosec-sast"
   DOCKER_DRIVER: overlay2
 
 include:
-- 
GitLab


From 1356ffc1725a82b76be83dda61586c0a0d84f3f3 Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 13:13:28 +0700
Subject: [PATCH 09/18] refactor: [engine] move Dockerfiles, scripts and
 SwaggerUI definitions into the engine directory

---
 .../Dockerfile.ci-checker                           |   2 +-
 Dockerfile.dblab-cli => engine/Dockerfile.dblab-cli |   2 +-
 .../Dockerfile.dblab-server                         |   4 ++--
 .../Dockerfile.swagger-ui                           |   0
 .../api}/postman/dblab.postman_collection.json      |   0
 .../api}/postman/dblab.postman_environment.json     |   0
 .../api}/swagger-spec/dblab_server_swagger.yaml     |   0
 {api => engine/api}/swagger-ui/favicon-16x16.png    | Bin
 {api => engine/api}/swagger-ui/favicon-32x32.png    | Bin
 {api => engine/api}/swagger-ui/index.html           |   0
 {api => engine/api}/swagger-ui/oauth2-redirect.html |   0
 {api => engine/api}/swagger-ui/swagger-ui-bundle.js |   0
 .../api}/swagger-ui/swagger-ui-bundle.js.map        |   0
 .../api}/swagger-ui/swagger-ui-es-bundle-core.js    |   0
 .../swagger-ui/swagger-ui-es-bundle-core.js.map     |   0
 .../api}/swagger-ui/swagger-ui-es-bundle.js         |   0
 .../api}/swagger-ui/swagger-ui-es-bundle.js.map     |   0
 .../api}/swagger-ui/swagger-ui-standalone-preset.js |   0
 .../swagger-ui/swagger-ui-standalone-preset.js.map  |   0
 {api => engine/api}/swagger-ui/swagger-ui.css       |   0
 {api => engine/api}/swagger-ui/swagger-ui.css.map   |   0
 {api => engine/api}/swagger-ui/swagger-ui.js        |   0
 {api => engine/api}/swagger-ui/swagger-ui.js.map    |   0
 engine/pkg/util/config.go                           |   2 +-
 engine/pkg/util/config_test.go                      |   2 +-
 {scripts => engine/scripts}/adjust_configs.sh       |   0
 {scripts => engine/scripts}/bash_autocomplete       |   0
 {scripts => engine/scripts}/ci_docker_build_push.sh |   0
 {scripts => engine/scripts}/cleanup_zfs_snapshot.sh |   0
 {scripts => engine/scripts}/cli_install.sh          |   0
 {scripts => engine/scripts}/create_zfs_snapshot.sh  |   0
 {scripts => engine/scripts}/preprocess_example.sh   |   0
 32 files changed, 6 insertions(+), 6 deletions(-)
 rename Dockerfile.ci-checker => engine/Dockerfile.ci-checker (77%)
 rename Dockerfile.dblab-cli => engine/Dockerfile.dblab-cli (78%)
 rename Dockerfile.dblab-server => engine/Dockerfile.dblab-server (90%)
 rename Dockerfile.swagger-ui => engine/Dockerfile.swagger-ui (100%)
 rename {api => engine/api}/postman/dblab.postman_collection.json (100%)
 rename {api => engine/api}/postman/dblab.postman_environment.json (100%)
 rename {api => engine/api}/swagger-spec/dblab_server_swagger.yaml (100%)
 rename {api => engine/api}/swagger-ui/favicon-16x16.png (100%)
 rename {api => engine/api}/swagger-ui/favicon-32x32.png (100%)
 rename {api => engine/api}/swagger-ui/index.html (100%)
 rename {api => engine/api}/swagger-ui/oauth2-redirect.html (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui-bundle.js (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui-bundle.js.map (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui-es-bundle-core.js (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui-es-bundle-core.js.map (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui-es-bundle.js (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui-es-bundle.js.map (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui-standalone-preset.js (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui-standalone-preset.js.map (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui.css (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui.css.map (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui.js (100%)
 rename {api => engine/api}/swagger-ui/swagger-ui.js.map (100%)
 rename {scripts => engine/scripts}/adjust_configs.sh (100%)
 rename {scripts => engine/scripts}/bash_autocomplete (100%)
 rename {scripts => engine/scripts}/ci_docker_build_push.sh (100%)
 rename {scripts => engine/scripts}/cleanup_zfs_snapshot.sh (100%)
 rename {scripts => engine/scripts}/cli_install.sh (100%)
 rename {scripts => engine/scripts}/create_zfs_snapshot.sh (100%)
 rename {scripts => engine/scripts}/preprocess_example.sh (100%)

diff --git a/Dockerfile.ci-checker b/engine/Dockerfile.ci-checker
similarity index 77%
rename from Dockerfile.ci-checker
rename to engine/Dockerfile.ci-checker
index 7f6a74388..e28bc0617 100644
--- a/Dockerfile.ci-checker
+++ b/engine/Dockerfile.ci-checker
@@ -5,6 +5,6 @@ RUN apk update && apk add --no-cache bash
 
 WORKDIR /home/dblab
 
-COPY ./engine/bin/run-ci ./bin/run-ci
+COPY ./bin/run-ci ./bin/run-ci
 
 CMD ./bin/run-ci
diff --git a/Dockerfile.dblab-cli b/engine/Dockerfile.dblab-cli
similarity index 78%
rename from Dockerfile.dblab-cli
rename to engine/Dockerfile.dblab-cli
index c941049e6..d587937a6 100644
--- a/Dockerfile.dblab-cli
+++ b/engine/Dockerfile.dblab-cli
@@ -4,5 +4,5 @@ FROM docker:19.03.15
 RUN apk update && apk add --no-cache bash jq
 
 WORKDIR /home/dblab
-COPY ./engine/bin/dblab ./bin/dblab
+COPY ./bin/dblab ./bin/dblab
 CMD ./bin/dblab
diff --git a/Dockerfile.dblab-server b/engine/Dockerfile.dblab-server
similarity index 90%
rename from Dockerfile.dblab-server
rename to engine/Dockerfile.dblab-server
index 9570e670c..3cf2f821b 100644
--- a/Dockerfile.dblab-server
+++ b/engine/Dockerfile.dblab-server
@@ -14,8 +14,8 @@ ENV PATH="${PATH}:/usr/share/bcc/tools"
 
 WORKDIR /home/dblab
 
-COPY ./engine/bin/dblab-server ./bin/dblab-server
-COPY ./engine/configs/standard ./standard
+COPY ./bin/dblab-server ./bin/dblab-server
+COPY ./configs/standard ./standard
 COPY ./api ./api
 COPY ./scripts ./scripts
 
diff --git a/Dockerfile.swagger-ui b/engine/Dockerfile.swagger-ui
similarity index 100%
rename from Dockerfile.swagger-ui
rename to engine/Dockerfile.swagger-ui
diff --git a/api/postman/dblab.postman_collection.json b/engine/api/postman/dblab.postman_collection.json
similarity index 100%
rename from api/postman/dblab.postman_collection.json
rename to engine/api/postman/dblab.postman_collection.json
diff --git a/api/postman/dblab.postman_environment.json b/engine/api/postman/dblab.postman_environment.json
similarity index 100%
rename from api/postman/dblab.postman_environment.json
rename to engine/api/postman/dblab.postman_environment.json
diff --git a/api/swagger-spec/dblab_server_swagger.yaml b/engine/api/swagger-spec/dblab_server_swagger.yaml
similarity index 100%
rename from api/swagger-spec/dblab_server_swagger.yaml
rename to engine/api/swagger-spec/dblab_server_swagger.yaml
diff --git a/api/swagger-ui/favicon-16x16.png b/engine/api/swagger-ui/favicon-16x16.png
similarity index 100%
rename from api/swagger-ui/favicon-16x16.png
rename to engine/api/swagger-ui/favicon-16x16.png
diff --git a/api/swagger-ui/favicon-32x32.png b/engine/api/swagger-ui/favicon-32x32.png
similarity index 100%
rename from api/swagger-ui/favicon-32x32.png
rename to engine/api/swagger-ui/favicon-32x32.png
diff --git a/api/swagger-ui/index.html b/engine/api/swagger-ui/index.html
similarity index 100%
rename from api/swagger-ui/index.html
rename to engine/api/swagger-ui/index.html
diff --git a/api/swagger-ui/oauth2-redirect.html b/engine/api/swagger-ui/oauth2-redirect.html
similarity index 100%
rename from api/swagger-ui/oauth2-redirect.html
rename to engine/api/swagger-ui/oauth2-redirect.html
diff --git a/api/swagger-ui/swagger-ui-bundle.js b/engine/api/swagger-ui/swagger-ui-bundle.js
similarity index 100%
rename from api/swagger-ui/swagger-ui-bundle.js
rename to engine/api/swagger-ui/swagger-ui-bundle.js
diff --git a/api/swagger-ui/swagger-ui-bundle.js.map b/engine/api/swagger-ui/swagger-ui-bundle.js.map
similarity index 100%
rename from api/swagger-ui/swagger-ui-bundle.js.map
rename to engine/api/swagger-ui/swagger-ui-bundle.js.map
diff --git a/api/swagger-ui/swagger-ui-es-bundle-core.js b/engine/api/swagger-ui/swagger-ui-es-bundle-core.js
similarity index 100%
rename from api/swagger-ui/swagger-ui-es-bundle-core.js
rename to engine/api/swagger-ui/swagger-ui-es-bundle-core.js
diff --git a/api/swagger-ui/swagger-ui-es-bundle-core.js.map b/engine/api/swagger-ui/swagger-ui-es-bundle-core.js.map
similarity index 100%
rename from api/swagger-ui/swagger-ui-es-bundle-core.js.map
rename to engine/api/swagger-ui/swagger-ui-es-bundle-core.js.map
diff --git a/api/swagger-ui/swagger-ui-es-bundle.js b/engine/api/swagger-ui/swagger-ui-es-bundle.js
similarity index 100%
rename from api/swagger-ui/swagger-ui-es-bundle.js
rename to engine/api/swagger-ui/swagger-ui-es-bundle.js
diff --git a/api/swagger-ui/swagger-ui-es-bundle.js.map b/engine/api/swagger-ui/swagger-ui-es-bundle.js.map
similarity index 100%
rename from api/swagger-ui/swagger-ui-es-bundle.js.map
rename to engine/api/swagger-ui/swagger-ui-es-bundle.js.map
diff --git a/api/swagger-ui/swagger-ui-standalone-preset.js b/engine/api/swagger-ui/swagger-ui-standalone-preset.js
similarity index 100%
rename from api/swagger-ui/swagger-ui-standalone-preset.js
rename to engine/api/swagger-ui/swagger-ui-standalone-preset.js
diff --git a/api/swagger-ui/swagger-ui-standalone-preset.js.map b/engine/api/swagger-ui/swagger-ui-standalone-preset.js.map
similarity index 100%
rename from api/swagger-ui/swagger-ui-standalone-preset.js.map
rename to engine/api/swagger-ui/swagger-ui-standalone-preset.js.map
diff --git a/api/swagger-ui/swagger-ui.css b/engine/api/swagger-ui/swagger-ui.css
similarity index 100%
rename from api/swagger-ui/swagger-ui.css
rename to engine/api/swagger-ui/swagger-ui.css
diff --git a/api/swagger-ui/swagger-ui.css.map b/engine/api/swagger-ui/swagger-ui.css.map
similarity index 100%
rename from api/swagger-ui/swagger-ui.css.map
rename to engine/api/swagger-ui/swagger-ui.css.map
diff --git a/api/swagger-ui/swagger-ui.js b/engine/api/swagger-ui/swagger-ui.js
similarity index 100%
rename from api/swagger-ui/swagger-ui.js
rename to engine/api/swagger-ui/swagger-ui.js
diff --git a/api/swagger-ui/swagger-ui.js.map b/engine/api/swagger-ui/swagger-ui.js.map
similarity index 100%
rename from api/swagger-ui/swagger-ui.js.map
rename to engine/api/swagger-ui/swagger-ui.js.map
diff --git a/engine/pkg/util/config.go b/engine/pkg/util/config.go
index ca2c7bb15..9c93531b5 100644
--- a/engine/pkg/util/config.go
+++ b/engine/pkg/util/config.go
@@ -14,7 +14,7 @@ import (
 )
 
 const (
-	swaggerDir  = "web"
+	swaggerDir  = "swagger-ui"
 	apiDir      = "api"
 	configDir   = "configs"
 	standardDir = "standard"
diff --git a/engine/pkg/util/config_test.go b/engine/pkg/util/config_test.go
index c9d4292e3..27b58c2a1 100644
--- a/engine/pkg/util/config_test.go
+++ b/engine/pkg/util/config_test.go
@@ -24,7 +24,7 @@ func TestBinRootPath(t *testing.T) {
 
 func TestSwaggerUIPath(t *testing.T) {
 	_, filename, _, _ := runtime.Caller(0)
-	expected := path.Dir(filename) + "/web"
+	expected := path.Dir(filename) + "/swagger-ui"
 
 	swaggerUIPath, err := GetSwaggerUIPath()
 	require.Nil(t, err)
diff --git a/scripts/adjust_configs.sh b/engine/scripts/adjust_configs.sh
similarity index 100%
rename from scripts/adjust_configs.sh
rename to engine/scripts/adjust_configs.sh
diff --git a/scripts/bash_autocomplete b/engine/scripts/bash_autocomplete
similarity index 100%
rename from scripts/bash_autocomplete
rename to engine/scripts/bash_autocomplete
diff --git a/scripts/ci_docker_build_push.sh b/engine/scripts/ci_docker_build_push.sh
similarity index 100%
rename from scripts/ci_docker_build_push.sh
rename to engine/scripts/ci_docker_build_push.sh
diff --git a/scripts/cleanup_zfs_snapshot.sh b/engine/scripts/cleanup_zfs_snapshot.sh
similarity index 100%
rename from scripts/cleanup_zfs_snapshot.sh
rename to engine/scripts/cleanup_zfs_snapshot.sh
diff --git a/scripts/cli_install.sh b/engine/scripts/cli_install.sh
similarity index 100%
rename from scripts/cli_install.sh
rename to engine/scripts/cli_install.sh
diff --git a/scripts/create_zfs_snapshot.sh b/engine/scripts/create_zfs_snapshot.sh
similarity index 100%
rename from scripts/create_zfs_snapshot.sh
rename to engine/scripts/create_zfs_snapshot.sh
diff --git a/scripts/preprocess_example.sh b/engine/scripts/preprocess_example.sh
similarity index 100%
rename from scripts/preprocess_example.sh
rename to engine/scripts/preprocess_example.sh
-- 
GitLab


From e4e69899b4d40ff497ad39b2d2c80216f3f70843 Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 13:17:26 +0700
Subject: [PATCH 10/18] refactor: [web] run jobs

---
 web/.gitlab-ci.yml                   | 3 ---
 web/packages/platform/.gitlab-ci.yml | 1 -
 2 files changed, 4 deletions(-)

diff --git a/web/.gitlab-ci.yml b/web/.gitlab-ci.yml
index c330ca779..b714170e2 100644
--- a/web/.gitlab-ci.yml
+++ b/web/.gitlab-ci.yml
@@ -1,6 +1,3 @@
-variables:
-  SAST_EXCLUDED_ANALYZERS: "semgrep-sast"
-
 .only_web: &only_web
   rules:
     - changes:
diff --git a/web/packages/platform/.gitlab-ci.yml b/web/packages/platform/.gitlab-ci.yml
index d36e12f5f..b0b1fa550 100644
--- a/web/packages/platform/.gitlab-ci.yml
+++ b/web/packages/platform/.gitlab-ci.yml
@@ -4,7 +4,6 @@
 # Unauthorized copying of this file, via any medium is strictly prohibited
 # Proprietary and confidential
 #--------------------------------------------------------------------------
-
 workflow:
   rules:
     - if: $CI_PIPELINE_SOURCE == "merge_request_event"
-- 
GitLab


From 806f86c001d81147071f24186f61f9fb15a2e559 Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 13:36:23 +0700
Subject: [PATCH 11/18] fix: [engine] change branch rules and correct the
 scripts path

---
 engine/.gitlab-ci.yml | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/engine/.gitlab-ci.yml b/engine/.gitlab-ci.yml
index b7578117a..34dcaf4cb 100644
--- a/engine/.gitlab-ci.yml
+++ b/engine/.gitlab-ci.yml
@@ -24,13 +24,15 @@ stages:
 
 .only_dle_master: &only_master
   rules:
-    - !reference [.only_engine, rules]
     - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+      changes:
+        - engine/**/*
 
 .only_dle_feature: &only_feature
   rules:
-    - !reference [.only_engine, rules]
     - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
+      changes:
+        - engine/**/*
 
 test:
   <<: *only_engine
@@ -138,7 +140,7 @@ build-binary-client-rc:
     - name: docker:dind
   script:
     - apk update && apk upgrade && apk add --no-cache bash # TODO(anatoly): Remove dependency.
-    - bash ./scripts/ci_docker_build_push.sh
+    - bash ./engine/scripts/ci_docker_build_push.sh
 
 build-image-feature-server:
   <<: *build_image_definition
-- 
GitLab


From e54d082f1a0b38e2e08ad9369d42dcd6a6ce6036 Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 13:38:28 +0700
Subject: [PATCH 12/18] chore: [web] run jobs

---
 web/packages/platform/.gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/web/packages/platform/.gitlab-ci.yml b/web/packages/platform/.gitlab-ci.yml
index b0b1fa550..d36e12f5f 100644
--- a/web/packages/platform/.gitlab-ci.yml
+++ b/web/packages/platform/.gitlab-ci.yml
@@ -4,6 +4,7 @@
 # Unauthorized copying of this file, via any medium is strictly prohibited
 # Proprietary and confidential
 #--------------------------------------------------------------------------
+
 workflow:
   rules:
     - if: $CI_PIPELINE_SOURCE == "merge_request_event"
-- 
GitLab


From a765f423c807aca0fb5861b39de273c18669d967 Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 13:52:59 +0700
Subject: [PATCH 13/18] fix: [engine] change the dockerfile path

---
 engine/scripts/ci_docker_build_push.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/engine/scripts/ci_docker_build_push.sh b/engine/scripts/ci_docker_build_push.sh
index 58ef78113..5f905d858 100644
--- a/engine/scripts/ci_docker_build_push.sh
+++ b/engine/scripts/ci_docker_build_push.sh
@@ -3,6 +3,7 @@
 set -euo pipefail
 
 docker_file=${DOCKER_FILE:-"Dockerfile"}
+dockerfile_path=${DOCKERFILE_PATH:-"engine/"}
 tags=${TAGS:-""}
 
 registry_user=${REGISTRY_USER:-"${CI_REGISTRY_USER}"}
@@ -24,7 +25,7 @@ for tag in "${ADDR[@]}"; do
 done
 
 set -x
-docker build $tags_build --file $docker_file .
+docker build $tags_build --file $dockerfile_path$docker_file .
 set +x
 
 echo -e "$tags_push" | while read -r tag; do
-- 
GitLab


From 2c9df131b122abcf9609c271de0dbcbeb282007c Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 14:06:55 +0700
Subject: [PATCH 14/18] fix: [engine] change script path

---
 engine/.gitlab-ci.yml                  | 3 ++-
 engine/scripts/ci_docker_build_push.sh | 3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/engine/.gitlab-ci.yml b/engine/.gitlab-ci.yml
index 34dcaf4cb..91106e9a1 100644
--- a/engine/.gitlab-ci.yml
+++ b/engine/.gitlab-ci.yml
@@ -139,8 +139,9 @@ build-binary-client-rc:
   services:
     - name: docker:dind
   script:
+    - cd engine
     - apk update && apk upgrade && apk add --no-cache bash # TODO(anatoly): Remove dependency.
-    - bash ./engine/scripts/ci_docker_build_push.sh
+    - bash ./scripts/ci_docker_build_push.sh
 
 build-image-feature-server:
   <<: *build_image_definition
diff --git a/engine/scripts/ci_docker_build_push.sh b/engine/scripts/ci_docker_build_push.sh
index 5f905d858..58ef78113 100644
--- a/engine/scripts/ci_docker_build_push.sh
+++ b/engine/scripts/ci_docker_build_push.sh
@@ -3,7 +3,6 @@
 set -euo pipefail
 
 docker_file=${DOCKER_FILE:-"Dockerfile"}
-dockerfile_path=${DOCKERFILE_PATH:-"engine/"}
 tags=${TAGS:-""}
 
 registry_user=${REGISTRY_USER:-"${CI_REGISTRY_USER}"}
@@ -25,7 +24,7 @@ for tag in "${ADDR[@]}"; do
 done
 
 set -x
-docker build $tags_build --file $dockerfile_path$docker_file .
+docker build $tags_build --file $docker_file .
 set +x
 
 echo -e "$tags_push" | while read -r tag; do
-- 
GitLab


From 3b8a9ffd2054ebd95f0cba527b199fb59df16e82 Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 14:30:28 +0700
Subject: [PATCH 15/18] fix: [engine] change artifacts path

---
 engine/.gitlab-ci.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/engine/.gitlab-ci.yml b/engine/.gitlab-ci.yml
index 91106e9a1..86d800606 100644
--- a/engine/.gitlab-ci.yml
+++ b/engine/.gitlab-ci.yml
@@ -55,7 +55,7 @@ build-binary-alpine:
   stage: build-binary
   artifacts:
     paths:
-      - bin
+      - engine/bin
   script:
     - apk add --update --no-cache make git
     - cd engine
@@ -66,7 +66,7 @@ build-binary-client-dev:
   stage: build-binary
   artifacts:
     paths:
-      - bin
+      - engine/bin
   script:
     - cd engine
     - make build-client
@@ -135,7 +135,7 @@ build-binary-client-rc:
   stage: build
   artifacts:
     paths:
-      - bin
+      - engine/bin
   services:
     - name: docker:dind
   script:
-- 
GitLab


From 5abc3cb39bacbdb081f17aaabe89c74359fc1006 Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 14:59:23 +0700
Subject: [PATCH 16/18] fix: [engine] update configuration paths in bash tests

---
 test/1.synthetic.sh           | 4 ++--
 test/2.logical_generic.sh     | 4 ++--
 test/3.physical_walg.sh       | 4 ++--
 test/4.physical_basebackup.sh | 4 ++--
 test/5.logical_rds.sh         | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/1.synthetic.sh b/test/1.synthetic.sh
index 2cb64c633..4d11a36e3 100644
--- a/test/1.synthetic.sh
+++ b/test/1.synthetic.sh
@@ -74,7 +74,7 @@ metaDir="$HOME/.dblab/engine/meta"
 # Copy the contents of configuration example
 mkdir -p "${configDir}"
 
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/configs/config.example.logical_generic.yml \
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/engine/configs/config.example.logical_generic.yml \
  --output "${configDir}/server.yml"
 
 # Edit the following options
@@ -136,7 +136,7 @@ check_dle_readiness || (echo "Database Lab Engine is not ready" && exit 1)
 ### Step 3. Start cloning
 
 # Install Database Lab client CLI
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/scripts/cli_install.sh | bash
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/engine/scripts/cli_install.sh | bash
 sudo mv ~/.dblab/dblab /usr/local/bin/dblab
 
 dblab --version
diff --git a/test/2.logical_generic.sh b/test/2.logical_generic.sh
index 31ba5d900..6fb0b13e6 100644
--- a/test/2.logical_generic.sh
+++ b/test/2.logical_generic.sh
@@ -83,7 +83,7 @@ metaDir="$HOME/.dblab/engine/meta"
 # Copy the contents of configuration example 
 mkdir -p "${configDir}"
 
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/configs/config.example.logical_generic.yml \
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/engine/configs/config.example.logical_generic.yml \
  --output "${configDir}/server.yml"
 
 # Edit the following options
@@ -150,7 +150,7 @@ check_dle_readiness || (echo "Database Lab Engine is not ready" && exit 1)
 ### Step 3. Start cloning
 
 # Install Database Lab client CLI
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/scripts/cli_install.sh | bash
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/engine/scripts/cli_install.sh | bash
 sudo mv ~/.dblab/dblab /usr/local/bin/dblab
 
 dblab --version
diff --git a/test/3.physical_walg.sh b/test/3.physical_walg.sh
index a54936e05..6d0cf06d2 100644
--- a/test/3.physical_walg.sh
+++ b/test/3.physical_walg.sh
@@ -40,7 +40,7 @@ metaDir="$HOME/.dblab/engine/meta"
 # Copy the contents of configuration example
 mkdir -p "${configDir}"
 
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/configs/config.example.physical_walg.yml \
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/engine/configs/config.example.physical_walg.yml \
  --output "${configDir}/server.yml"
 
 # Edit the following options
@@ -156,7 +156,7 @@ check_dle_readiness || (echo "Database Lab Engine is not ready" && exit 1)
 ### Step 3. Start cloning
 
 # Install Database Lab client CLI
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/scripts/cli_install.sh | bash
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/engine/scripts/cli_install.sh | bash
 sudo mv ~/.dblab/dblab /usr/local/bin/dblab
 
 dblab --version
diff --git a/test/4.physical_basebackup.sh b/test/4.physical_basebackup.sh
index 6db7d024a..92f27b93a 100644
--- a/test/4.physical_basebackup.sh
+++ b/test/4.physical_basebackup.sh
@@ -98,7 +98,7 @@ metaDir="$HOME/.dblab/engine/meta"
 # Copy the contents of configuration example 
 mkdir -p "${configDir}"
 
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/configs/config.example.physical_generic.yml \
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/engine/configs/config.example.physical_generic.yml \
  --output "${configDir}/server.yml"
 
 # Edit the following options
@@ -172,7 +172,7 @@ check_dle_readiness || (echo "Database Lab Engine is not ready" && exit 1)
 ### Step 3. Start cloning
 
 # Install Database Lab client CLI
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/scripts/cli_install.sh | bash
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/engine/scripts/cli_install.sh | bash
 sudo mv ~/.dblab/dblab /usr/local/bin/dblab
 
 dblab --version
diff --git a/test/5.logical_rds.sh b/test/5.logical_rds.sh
index 6069fa822..c6de7550a 100644
--- a/test/5.logical_rds.sh
+++ b/test/5.logical_rds.sh
@@ -36,7 +36,7 @@ metaDir="$HOME/.dblab/engine/meta"
 # Copy the contents of configuration example 
 mkdir -p "${configDir}"
 
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/configs/config.example.logical_rds_iam.yml \
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/engine/configs/config.example.logical_rds_iam.yml \
  --output "${configDir}/server.yml"
 
 # Edit the following options
@@ -109,7 +109,7 @@ check_dle_readiness || (echo "Database Lab Engine is not ready" && exit 1)
 ### Step 3. Start cloning
 
 # Install Database Lab client CLI
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/scripts/cli_install.sh | bash
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/engine/scripts/cli_install.sh | bash
 sudo mv ~/.dblab/dblab /usr/local/bin/dblab
 
 dblab --version
-- 
GitLab


From a2f19dd88c9faccdf893320b7b44639a9386fc13 Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 15:03:12 +0700
Subject: [PATCH 17/18] refactor: [engine] move tests into the engine dir

---
 engine/.gitlab-ci.yml                          | 8 ++++----
 {test => engine/test}/1.synthetic.sh           | 0
 {test => engine/test}/2.logical_generic.sh     | 0
 {test => engine/test}/3.physical_walg.sh       | 0
 {test => engine/test}/4.physical_basebackup.sh | 0
 {test => engine/test}/5.logical_rds.sh         | 0
 {test => engine/test}/_cleanup.sh              | 0
 {test => engine/test}/_prerequisites.ubuntu.sh | 0
 {test => engine/test}/_zfs.file.sh             | 0
 9 files changed, 4 insertions(+), 4 deletions(-)
 rename {test => engine/test}/1.synthetic.sh (100%)
 rename {test => engine/test}/2.logical_generic.sh (100%)
 rename {test => engine/test}/3.physical_walg.sh (100%)
 rename {test => engine/test}/4.physical_basebackup.sh (100%)
 rename {test => engine/test}/5.logical_rds.sh (100%)
 rename {test => engine/test}/_cleanup.sh (100%)
 rename {test => engine/test}/_prerequisites.ubuntu.sh (100%)
 rename {test => engine/test}/_zfs.file.sh (100%)

diff --git a/engine/.gitlab-ci.yml b/engine/.gitlab-ci.yml
index 86d800606..4bab77c3c 100644
--- a/engine/.gitlab-ci.yml
+++ b/engine/.gitlab-ci.yml
@@ -359,11 +359,11 @@ build-image-swagger-latest:
       changes:
         - engine/**/*
   script:
-    - bash test/1.synthetic.sh
-    - bash test/2.logical_generic.sh
-    - bash test/4.physical_basebackup.sh
+    - bash engine/test/1.synthetic.sh
+    - bash engine/test/2.logical_generic.sh
+    - bash engine/test/4.physical_basebackup.sh
   after_script:
-    - bash test/_cleanup.sh
+    - bash engine/test/_cleanup.sh
   tags:
     - dle-test
 
diff --git a/test/1.synthetic.sh b/engine/test/1.synthetic.sh
similarity index 100%
rename from test/1.synthetic.sh
rename to engine/test/1.synthetic.sh
diff --git a/test/2.logical_generic.sh b/engine/test/2.logical_generic.sh
similarity index 100%
rename from test/2.logical_generic.sh
rename to engine/test/2.logical_generic.sh
diff --git a/test/3.physical_walg.sh b/engine/test/3.physical_walg.sh
similarity index 100%
rename from test/3.physical_walg.sh
rename to engine/test/3.physical_walg.sh
diff --git a/test/4.physical_basebackup.sh b/engine/test/4.physical_basebackup.sh
similarity index 100%
rename from test/4.physical_basebackup.sh
rename to engine/test/4.physical_basebackup.sh
diff --git a/test/5.logical_rds.sh b/engine/test/5.logical_rds.sh
similarity index 100%
rename from test/5.logical_rds.sh
rename to engine/test/5.logical_rds.sh
diff --git a/test/_cleanup.sh b/engine/test/_cleanup.sh
similarity index 100%
rename from test/_cleanup.sh
rename to engine/test/_cleanup.sh
diff --git a/test/_prerequisites.ubuntu.sh b/engine/test/_prerequisites.ubuntu.sh
similarity index 100%
rename from test/_prerequisites.ubuntu.sh
rename to engine/test/_prerequisites.ubuntu.sh
diff --git a/test/_zfs.file.sh b/engine/test/_zfs.file.sh
similarity index 100%
rename from test/_zfs.file.sh
rename to engine/test/_zfs.file.sh
-- 
GitLab


From 07d75116d6841e8fa8b86b7117621238e09c46cb Mon Sep 17 00:00:00 2001
From: akartasov <agneum@gmail.com>
Date: Tue, 8 Feb 2022 17:02:45 +0700
Subject: [PATCH 18/18] fix: [engine] fix script path

---
 engine/test/1.synthetic.sh           | 2 +-
 engine/test/2.logical_generic.sh     | 2 +-
 engine/test/3.physical_walg.sh       | 2 +-
 engine/test/4.physical_basebackup.sh | 2 +-
 engine/test/5.logical_rds.sh         | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/engine/test/1.synthetic.sh b/engine/test/1.synthetic.sh
index 4d11a36e3..1bb336c83 100644
--- a/engine/test/1.synthetic.sh
+++ b/engine/test/1.synthetic.sh
@@ -136,7 +136,7 @@ check_dle_readiness || (echo "Database Lab Engine is not ready" && exit 1)
 ### Step 3. Start cloning
 
 # Install Database Lab client CLI
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/engine/scripts/cli_install.sh | bash
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/engine/scripts/cli_install.sh | bash
 sudo mv ~/.dblab/dblab /usr/local/bin/dblab
 
 dblab --version
diff --git a/engine/test/2.logical_generic.sh b/engine/test/2.logical_generic.sh
index 6fb0b13e6..6d5e51e36 100644
--- a/engine/test/2.logical_generic.sh
+++ b/engine/test/2.logical_generic.sh
@@ -150,7 +150,7 @@ check_dle_readiness || (echo "Database Lab Engine is not ready" && exit 1)
 ### Step 3. Start cloning
 
 # Install Database Lab client CLI
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/engine/scripts/cli_install.sh | bash
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/engine/scripts/cli_install.sh | bash
 sudo mv ~/.dblab/dblab /usr/local/bin/dblab
 
 dblab --version
diff --git a/engine/test/3.physical_walg.sh b/engine/test/3.physical_walg.sh
index 6d0cf06d2..5e97f32b0 100644
--- a/engine/test/3.physical_walg.sh
+++ b/engine/test/3.physical_walg.sh
@@ -156,7 +156,7 @@ check_dle_readiness || (echo "Database Lab Engine is not ready" && exit 1)
 ### Step 3. Start cloning
 
 # Install Database Lab client CLI
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/engine/scripts/cli_install.sh | bash
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/engine/scripts/cli_install.sh | bash
 sudo mv ~/.dblab/dblab /usr/local/bin/dblab
 
 dblab --version
diff --git a/engine/test/4.physical_basebackup.sh b/engine/test/4.physical_basebackup.sh
index 92f27b93a..76b62e347 100644
--- a/engine/test/4.physical_basebackup.sh
+++ b/engine/test/4.physical_basebackup.sh
@@ -172,7 +172,7 @@ check_dle_readiness || (echo "Database Lab Engine is not ready" && exit 1)
 ### Step 3. Start cloning
 
 # Install Database Lab client CLI
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/engine/scripts/cli_install.sh | bash
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/engine/scripts/cli_install.sh | bash
 sudo mv ~/.dblab/dblab /usr/local/bin/dblab
 
 dblab --version
diff --git a/engine/test/5.logical_rds.sh b/engine/test/5.logical_rds.sh
index c6de7550a..9d576e501 100644
--- a/engine/test/5.logical_rds.sh
+++ b/engine/test/5.logical_rds.sh
@@ -109,7 +109,7 @@ check_dle_readiness || (echo "Database Lab Engine is not ready" && exit 1)
 ### Step 3. Start cloning
 
 # Install Database Lab client CLI
-curl https://gitlab.com/postgres-ai/database-lab/-/raw/master/engine/scripts/cli_install.sh | bash
+curl https://gitlab.com/postgres-ai/database-lab/-/raw/"${CI_COMMIT_BRANCH:-master}"/engine/scripts/cli_install.sh | bash
 sudo mv ~/.dblab/dblab /usr/local/bin/dblab
 
 dblab --version
-- 
GitLab