diff --git a/docker/postgres/docker-compose-deps-postgres.yml b/docker/postgres/docker-compose-deps-postgres.yml index 62975d1499..9e9bd23b9f 100644 --- a/docker/postgres/docker-compose-deps-postgres.yml +++ b/docker/postgres/docker-compose-deps-postgres.yml @@ -21,11 +21,11 @@ services: restart_policy: condition: on-failure environment: + POSTGRES_DB: "hawkbit" POSTGRES_USER: "postgres" POSTGRES_PASSWORD: "admin" - POSTGRES_DB: "hawkbit" healthcheck: - test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}"] + test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB:-hawkbit} -U ${POSTGRES_USER:-postgres}"] interval: 20s retries: 10 @@ -44,5 +44,4 @@ services: - "5672:5672" deploy: restart_policy: - condition: on-failure - + condition: on-failure \ No newline at end of file diff --git a/docs/quick-start.md b/docs/quick-start.md index 809cd4298b..52aa715a7e 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -123,7 +123,7 @@ $ mvn clean install -DskipTests $ java -jar ./hawkbit-monolith/hawkbit-update-server/target/hawkbit-update-server-0-SNAPSHOT.jar ``` -> **Note:** you could start it also in **microservices mode** by: +**Note:** you could start it also in **microservices mode** by: ```bash $ java -jar ./hawkbit-mgmt/hawkbit-mgmt-server/target/hawkbit-mgmt-server-0-SNAPSHOT.jar @@ -137,10 +137,22 @@ And (only if you want to use the DMF feature): $ java -jar ./hawkbit-monolith/hawkbit-update-server/target/hawkbit-update-server-0-SNAPSHOT.jar ``` +**Note:** You could also start with H2 console enabled with: +```bash +$java -jar ./hawkbit-monolith/hawkbit-update-server/target/hawkbit-update-server-0-SNAPSHOT.jar --spring.h2.console.enabled=true --spring.h2.console.path=/h2-console +``` +for monolith, and: +```bash +$java -jar ./hawkbit-mgmt/hawkbit-mgmt-server/target/hawkbit-mgmt-server-0-SNAPSHOT.jar --spring.h2.console.enabled=true --spring.h2.console.path=/h2-console +``` +for mgmt server in micro-service mode. + +Then you will get H2 console available at '/h2-console' (Database available at 'jdbc:h2:mem:hawkbit') + You could also start the **hawkBit UI** by: ```bash -$ java -jar ./hawkbit--ui/target/hawkbit-ui-0-SNAPSHOT.jar +$ java -jar ./hawkbit-ui/target/hawkbit-ui-0-SNAPSHOT.jar ``` --- diff --git a/eclipse_codeformatter.xml b/eclipse_codeformatter.xml index a985b3a23d..7f22ee69db 100644 --- a/eclipse_codeformatter.xml +++ b/eclipse_codeformatter.xml @@ -1,504 +1,380 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/H2/V1_12_37__unify__H2.sql b/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/H2/V1_12_37__unify__H2.sql new file mode 100644 index 0000000000..78fc86e03d --- /dev/null +++ b/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/H2/V1_12_37__unify__H2.sql @@ -0,0 +1,5 @@ +-- remove unnecessary / faulty default for a tenant's scope unique key +ALTER TABLE sp_target_type ALTER COLUMN type_key DROP DEFAULT; + +-- remove unused column +ALTER TABLE sp_rollout DROP COLUMN group_theshold; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/MYSQL/V1_12_37__unify__MYSQL.sql b/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/MYSQL/V1_12_37__unify__MYSQL.sql new file mode 100644 index 0000000000..adf0764ce7 --- /dev/null +++ b/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/MYSQL/V1_12_37__unify__MYSQL.sql @@ -0,0 +1,35 @@ +-- fix NOT NULL disappeared in V1_12_12__change_length_of_controller_id_and_name___MYSQL.sql and V1_12_22__change_target_type_name_length___MYSQL.sql +UPDATE sp_software_module SET name = '' WHERE name IS NULL; +ALTER TABLE sp_software_module MODIFY name VARCHAR(128) NOT NULL; +UPDATE sp_software_module_type SET name = '' WHERE name IS NULL; +ALTER TABLE sp_software_module_type MODIFY name VARCHAR(128) NOT NULL; + +UPDATE sp_distribution_set SET name = '' WHERE name IS NULL; +ALTER TABLE sp_distribution_set MODIFY name VARCHAR(128) NOT NULL; +UPDATE sp_distribution_set_type SET name = '' WHERE name IS NULL; +ALTER TABLE sp_distribution_set_type MODIFY name VARCHAR(128) NOT NULL; +UPDATE sp_distribution_set_tag SET name = '' WHERE name IS NULL; +ALTER TABLE sp_distribution_set_tag MODIFY name VARCHAR(128) NOT NULL; + +UPDATE sp_target SET name = '' WHERE name IS NULL; +ALTER TABLE sp_target MODIFY name VARCHAR(128) NOT NULL; +UPDATE sp_target_type SET name = '' WHERE name IS NULL; +ALTER TABLE sp_target_type MODIFY name VARCHAR(128) NOT NULL; +UPDATE sp_target_tag SET name = '' WHERE name IS NULL; +ALTER TABLE sp_target_tag MODIFY name VARCHAR(128) NOT NULL; +UPDATE sp_target_filter_query SET name = '' WHERE name IS NULL; +ALTER TABLE sp_target_filter_query MODIFY name VARCHAR(128) NOT NULL; + +UPDATE sp_rollout SET name = '' WHERE name IS NULL; +ALTER TABLE sp_rollout MODIFY name VARCHAR(128) NOT NULL; +UPDATE sp_rollout_group SET name = '' WHERE name IS NULL; +ALTER TABLE sp_rollout_group MODIFY name VARCHAR(128) NOT NULL; + +UPDATE sp_target SET controller_id = '' WHERE controller_id IS NULL; +ALTER TABLE sp_target MODIFY controller_id VARCHAR(256) NOT NULL; + +-- remove unnecessary / faulty default for a tenant's scope unique key +ALTER TABLE sp_target_type ALTER COLUMN type_key DROP DEFAULT; + +-- remove unused column +ALTER TABLE sp_rollout DROP COLUMN group_theshold; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/POSTGRESQL/V1_12_35__sm_type_min_artifacts__POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/POSTGRESQL/V1_12_35__sm_type_min_artifacts__POSTGRESQL.sql index 0d72136328..182c4bd11b 100644 --- a/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/POSTGRESQL/V1_12_35__sm_type_min_artifacts__POSTGRESQL.sql +++ b/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/POSTGRESQL/V1_12_35__sm_type_min_artifacts__POSTGRESQL.sql @@ -1,4 +1,4 @@ ALTER TABLE sp_software_module_type ADD COLUMN min_artifacts integer default 0 NOT NULL; -DROP INDEX sp_idx_distribution_set_01; +DROP INDEX sp_idx_distribution_set_01_sp_distribution_set; CREATE INDEX sp_idx_distribution_set_01 ON sp_distribution_set USING BTREE (tenant, deleted); ALTER TABLE sp_distribution_set DROP COLUMN complete; \ No newline at end of file diff --git a/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/POSTGRESQL/V1_12_37__unify__POSTGRESQL.sql b/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/POSTGRESQL/V1_12_37__unify__POSTGRESQL.sql new file mode 100644 index 0000000000..47ce926a50 --- /dev/null +++ b/hawkbit-repository/hawkbit-repository-jpa-flyway/src/main/resources/db/migration/POSTGRESQL/V1_12_37__unify__POSTGRESQL.sql @@ -0,0 +1,110 @@ +-- fix NOT NULL V1_12_15__baseline___POSTGRESQL.sql and V1_12_22__change_target_type_name_length___POSTGRESQL.sql +UPDATE sp_software_module SET name = '' WHERE name IS NULL; +ALTER TABLE sp_software_module ALTER COLUMN name SET NOT NULL; +UPDATE sp_software_module_type SET name = '' WHERE name IS NULL; +ALTER TABLE sp_software_module_type ALTER COLUMN name SET NOT NULL; + +UPDATE sp_distribution_set SET name = '' WHERE name IS NULL; +ALTER TABLE sp_distribution_set ALTER COLUMN name SET NOT NULL; +UPDATE sp_distribution_set_type SET name = '' WHERE name IS NULL; +ALTER TABLE sp_distribution_set_type ALTER COLUMN name SET NOT NULL; +UPDATE sp_distribution_set_tag SET name = '' WHERE name IS NULL; +ALTER TABLE sp_distribution_set_tag ALTER COLUMN name SET NOT NULL; + +UPDATE sp_target SET name = '' WHERE name IS NULL; +ALTER TABLE sp_target ALTER COLUMN name SET NOT NULL; +UPDATE sp_target_type SET name = '' WHERE name IS NULL; +ALTER TABLE sp_target_type ALTER COLUMN name SET NOT NULL; +UPDATE sp_target_tag SET name = '' WHERE name IS NULL; +ALTER TABLE sp_target_tag ALTER COLUMN name SET NOT NULL; +UPDATE sp_target_filter_query SET name = '' WHERE name IS NULL; +ALTER TABLE sp_target_filter_query ALTER COLUMN name SET NOT NULL; + +UPDATE sp_rollout SET name = '' WHERE name IS NULL; +ALTER TABLE sp_rollout ALTER COLUMN name SET NOT NULL; +UPDATE sp_rollout_group SET name = '' WHERE name IS NULL; +ALTER TABLE sp_rollout_group ALTER COLUMN name SET NOT NULL; + +UPDATE sp_target SET controller_id = '' WHERE controller_id IS NULL; +ALTER TABLE sp_target ALTER COLUMN controller_id SET NOT NULL; + +-- fix sp_target_conf_status_new column order (to be MySQL and H2 schemes compatible) +BEGIN; + +CREATE TABLE sp_target_conf_status_new ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY, + target BIGINT NOT NULL, + initiator VARCHAR(64), + remark VARCHAR(512), + created_at BIGINT, + created_by VARCHAR(64), + last_modified_at BIGINT, + last_modified_by VARCHAR(64), + optlock_revision BIGINT, + tenant VARCHAR(40) NOT NULL, + PRIMARY KEY (id) +); + +INSERT INTO sp_target_conf_status_new +SELECT id, target, initiator, remark, created_at, created_by, last_modified_at, last_modified_by, optlock_revision, tenant +FROM sp_target_conf_status; +-- inserting with id hasn't / may haven't incremented the sequence +DO $$ +BEGIN + PERFORM setval('sp_target_conf_status_new_id_seq', (SELECT MAX(id) FROM sp_target_conf_status_new)); +END $$; + +DROP TABLE sp_target_conf_status; +ALTER TABLE sp_target_conf_status_new RENAME TO sp_target_conf_status; + +COMMIT; + +DROP INDEX sp_idx_rollout_group_parent; +ALTER TABLE sp_target_conf_status + ADD CONSTRAINT fk_target_conf_status_target FOREIGN KEY (target) REFERENCES sp_target (id) ON DELETE CASCADE; +ALTER TABLE sp_target_type_ds_type + ADD CONSTRAINT pk_sp_target_type_ds_type PRIMARY KEY (target_type, distribution_set_type); + +-- remove unnecessary / faulty default for a tenant's scope unique key +ALTER TABLE sp_target_type ALTER COLUMN type_key DROP DEFAULT; + +-- remove unused column +ALTER TABLE sp_rollout DROP COLUMN group_theshold; + +-- -- unify index names -- +-- sp_distribution_set_tag table indexes +ALTER INDEX sp_idx_distribution_set_tag_01_sp_distributionset_tag RENAME TO sp_idx_distribution_set_tag_01; +ALTER INDEX sp_idx_distribution_set_tag_prim_sp_distributionset_tag RENAME TO sp_idx_distribution_set_tag_prim; +-- sp_distribution_set_type table indexes +ALTER INDEX sp_idx_distribution_set_type_prim_sp_distribution_set_type RENAME TO sp_idx_distribution_set_type_prim; +ALTER INDEX sp_idx_distribution_set_type_01_sp_distribution_set_type RENAME TO sp_idx_distribution_set_type_01; +-- sp_software_module_type table indexes +ALTER INDEX sp_idx_software_module_type_prim_sp_software_module_type RENAME TO sp_idx_software_module_type_prim; +ALTER INDEX sp_idx_software_module_type_01_sp_software_module_type RENAME TO sp_idx_software_module_type_01; +-- sp_target_tag table indexes +ALTER INDEX sp_idx_target_tag_prim_sp_target_tag RENAME TO sp_idx_target_tag_prim; +ALTER INDEX sp_idx_target_tag_01_sp_target_tag RENAME TO sp_idx_target_tag_01; +-- sp_distribution_set table indexes +ALTER INDEX sp_idx_distribution_set_prim_sp_distribution_set RENAME TO sp_idx_distribution_set_prim; +-- sp_tenant table indexes +ALTER INDEX sp_idx_tenant_prim_sp_tenant RENAME TO sp_idx_tenant_prim; +-- sp_rollout table indexes +ALTER INDEX uk_rollout_sp_rollout RENAME TO uk_rollout; +-- sp_target table indexes +ALTER INDEX uk_target RENAME TO uk_target_controller_id; +ALTER INDEX sp_idx_target_01_sp_target RENAME TO sp_idx_target_01; +ALTER INDEX sp_idx_target_03_sp_target RENAME TO sp_idx_target_03; +ALTER INDEX sp_idx_target_04_sp_target RENAME TO sp_idx_target_04; +ALTER INDEX sp_idx_target_prim_sp_target RENAME TO sp_idx_target_prim; +-- sp_artifact table indexes +ALTER INDEX sp_idx_artifact_prim_sp_artifact RENAME TO sp_idx_artifact_prim; +ALTER INDEX sp_idx_artifact_01_sp_artifact RENAME TO sp_idx_artifact_01; +ALTER INDEX sp_idx_artifact_02_sp_artifact RENAME TO sp_idx_artifact_02; +-- sp_action table indexes +ALTER INDEX sp_idx_action_prim_sp_action RENAME TO sp_idx_action_prim; +ALTER INDEX sp_idx_action_01_sp_action RENAME TO sp_idx_action_01; +ALTER INDEX sp_idx_action_02_sp_action RENAME TO sp_idx_action_02; +ALTER INDEX sp_idx_action_external_ref_sp_action RENAME TO sp_idx_action_external_ref; +-- sp_action_status table indexes +ALTER INDEX sp_idx_action_status_prim_sp_action_status RENAME TO sp_idx_action_status_prim; +ALTER INDEX sp_idx_action_status_02_sp_action_status RENAME TO sp_idx_action_status_02; \ No newline at end of file diff --git a/intellij_codeformatter.xml b/intellij_codeformatter.xml index 628f202ea9..301507c1df 100644 --- a/intellij_codeformatter.xml +++ b/intellij_codeformatter.xml @@ -1,429 +1,447 @@ - \ No newline at end of file