Skip to content

Commit

Permalink
Finish release/23.10
Browse files Browse the repository at this point in the history
Release/23.10
  • Loading branch information
dragos-dobre authored Dec 26, 2023
2 parents 9ddda66 + cc84b60 commit 7fb5ada
Show file tree
Hide file tree
Showing 9 changed files with 185 additions and 50 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/docker-build-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Docker Build Check

on:
pull_request:
branches:
- main
- develop

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Build Docker image
run: docker build .

- name: Check Docker image build status
run: |
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Docker image build failed."
exit 1
else
echo "Docker image build successful."
exit 0
fi
25 changes: 25 additions & 0 deletions .github/workflows/docker-dev-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: publish develop image
on:
push:
branches:
- develop

jobs:
publish-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the pgsql EMPTY Docker image
run: |
docker build . --tag ghcr.io/openimis/openimis-pgsql:develop-base --target base
docker push ghcr.io/openimis/openimis-pgsql:develop-base
- name: Build the pgsql DEMO Docker image
run: |
docker build . --tag ghcr.io/openimis/openimis-pgsql:develop
docker push ghcr.io/openimis/openimis-pgsql:develop
6 changes: 5 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the pgsql Docker image
- name: Build the pgsql EMPTY Docker image
run: |
docker build . --target base --tag ghcr.io/openimis/openimis-pgsql:${{ github.event.inputs.tag }}-base
docker push ghcr.io/openimis/openimis-pgsql:${{ github.event.inputs.tag }}-base
- name: Build the pgsql DEMO Docker image
run: |
docker build . --tag ghcr.io/openimis/openimis-pgsql:${{ github.event.inputs.tag }}
docker push ghcr.io/openimis/openimis-pgsql:${{ github.event.inputs.tag }}
13 changes: 11 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
FROM postgres:13-alpine
FROM postgres:13-alpine AS base

# Script to detect whether the database has finished initializing
COPY ["true_isready.sh", "/usr/local/bin/"]
COPY ["database scripts/00_dump.sql", "database scripts/0[2345]_*.sql", "database scripts/demo_db.sql", "/docker-entrypoint-initdb.d/"]
COPY ["database scripts/00_dump.sql", "database scripts/0[2345]_*.sql", "database scripts/json_schema_extension.sql", "/docker-entrypoint-initdb.d/"]

# Install https://github.com/gavinwahl/postgres-json-schema/
# extension that allows validation of jsonb fields against jsonschema
COPY ["install_postgres_json_schema_extension.sh", "install_postgres_json_schema_extension.sh"]
RUN chmod u+x install_postgres_json_schema_extension.sh
RUN ./install_postgres_json_schema_extension.sh

FROM base AS demo
COPY ["database scripts/demo_db.sql", "/docker-entrypoint-initdb.d/"]
11 changes: 7 additions & 4 deletions database scripts/00_dump.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3439,6 +3439,8 @@ CREATE TABLE "public"."tblLanguages" (
"CountryCode" character varying(10) NULL
);

INSERT INTO "public"."tblLanguages" ("LanguageCode", "LanguageName", "SortOrder") VALUES (N'en', N'English', NULL);


-- ALTER TABLE "public"."tblLanguages" OWNER TO "postgres";

Expand Down Expand Up @@ -3844,7 +3846,7 @@ ALTER SEQUENCE "public"."tblPayer_PayerID_seq" OWNED BY "public"."tblPayer"."Pay
--

CREATE TABLE "public"."tblPayment" (
"PaymentID" bigint NOT NULL,
"PaymentID" bigserial NOT NULL,
"PaymentUUID" "uuid" NOT NULL,
"ExpectedAmount" numeric(18,2),
"ReceivedAmount" numeric(18,2),
Expand Down Expand Up @@ -3883,7 +3885,7 @@ CREATE TABLE "public"."tblPayment" (
--

CREATE TABLE "public"."tblPaymentDetails" (
"PaymentDetailsID" bigint NOT NULL,
"PaymentDetailsID" bigserial NOT NULL,
"PaymentID" bigint NOT NULL,
"ProductCode" character varying(8),
"InsuranceNumber" character varying(12),
Expand Down Expand Up @@ -3987,7 +3989,7 @@ CREATE TABLE "public"."tblPolicy" (
--

CREATE TABLE "public"."tblPolicyRenewalDetails" (
"RenewalDetailID" integer NOT NULL,
"RenewalDetailID" SERIAL NOT NULL,
"RenewalID" integer NOT NULL,
"InsureeID" integer NOT NULL,
"ValidityFrom" timestamp with time zone NOT NULL,
Expand All @@ -4005,7 +4007,7 @@ CREATE TABLE "public"."tblPolicyRenewalDetails" (
--

CREATE TABLE "public"."tblPolicyRenewals" (
"RenewalID" integer NOT NULL,
"RenewalID" SERIAL NOT NULL,
"RenewalPromptDate" "date" NOT NULL,
"RenewalDate" "date" NOT NULL,
"NewOfficerID" integer,
Expand Down Expand Up @@ -4755,6 +4757,7 @@ CREATE TABLE "public"."tblUsers" (
"password" "bytea"
);

INSERT INTO "public"."tblUsers" ("UserID", "LanguageID", "LastName", "OtherNames", "Phone", "LoginName", "RoleID", "HFID", "ValidityFrom", "ValidityTo", "LegacyID", "AuditUserID", "password", "DummyPwd", "EmailId", "StoredPassword", "PrivateKey", "PasswordValidity", "IsAssociated", "UserUUID") VALUES (1, N'en', N'Admin', N'Admin', N'', N'Admin', 1023, NULL, CAST(N'2018-03-19T08:54:48.923' AS timestamptz), NULL, NULL, 2, 'x001699E55A06FA79F4CA0D06EF15096C02000000DF691E2CE66AA7ABDF65B3E6210C1C04CAAE1A3B1FEE5E266B5FAF4F7D4E95109C92E3205F0145CC'::bytea, NULL, N'[email protected]', N'59E66831C680C19E8736751D5480A7C3291BD8775DF47C19C4D0361FBC1C3438', N'C1C224B03CD9BC7B6A86D77F5DACE40191766C485CD55DC48CAF9AC873335D6F', NULL, NULL, N'281953c0-1c1a-4cf8-b93c-8e8b33c617c2');

-- ALTER TABLE "public"."tblUsers" OWNER TO "postgres";

Expand Down
4 changes: 1 addition & 3 deletions database scripts/demo_db.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

set search_path to public;

-- tblLanguages
INSERT INTO "tblLanguages" ("LanguageCode", "LanguageName", "SortOrder") VALUES (N'en', N'English', NULL);
-- tblLanguages (en added in empty db)
INSERT INTO "tblLanguages" ("LanguageCode", "LanguageName", "SortOrder") VALUES (N'fr', N'Français', NULL);

-- tblGender
Expand Down Expand Up @@ -1842,7 +1841,6 @@ INSERT INTO "tblExtracts" ("ExtractID", "ExtractDirection", "ExtractType", "Extr
INSERT INTO "tblExtracts" ("ExtractID", "ExtractDirection", "ExtractType", "ExtractSequence", "ExtractDate", "ExtractFileName", "ExtractFolder", "LocationId", "HFID", "AppVersionBackend", "ValidityFrom", "ValidityTo", "LegacyID", "AuditUserID", "RowID", "ExtractUUID") VALUES (7, 0, 1, 3, CAST(N'2019-01-28T08:36:39.410' AS timestamptz), N'ImisData.db3', N'', 17, 0, CAST(1.2 AS Decimal(3, 1)), CAST(N'2019-01-28T08:36:39.410' AS timestamptz), NULL, NULL, 1, 0, N'7ed9f259-c742-41e7-af22-b5d2bc2d4cf5'::uuid);

-- tblUsers
INSERT INTO "tblUsers" ("UserID", "LanguageID", "LastName", "OtherNames", "Phone", "LoginName", "RoleID", "HFID", "ValidityFrom", "ValidityTo", "LegacyID", "AuditUserID", "password", "DummyPwd", "EmailId", "StoredPassword", "PrivateKey", "PasswordValidity", "IsAssociated", "UserUUID") VALUES (1, N'en', N'Admin', N'Admin', N'', N'Admin', 1023, NULL, CAST(N'2018-03-19T08:54:48.923' AS timestamptz), NULL, NULL, 2, 'x001699E55A06FA79F4CA0D06EF15096C02000000DF691E2CE66AA7ABDF65B3E6210C1C04CAAE1A3B1FEE5E266B5FAF4F7D4E95109C92E3205F0145CC'::bytea, NULL, N'[email protected]', N'59E66831C680C19E8736751D5480A7C3291BD8775DF47C19C4D0361FBC1C3438', N'C1C224B03CD9BC7B6A86D77F5DACE40191766C485CD55DC48CAF9AC873335D6F', NULL, NULL, N'281953c0-1c1a-4cf8-b93c-8e8b33c617c2');
INSERT INTO "tblUsers" ("UserID", "LanguageID", "LastName", "OtherNames", "Phone", "LoginName", "RoleID", "HFID", "ValidityFrom", "ValidityTo", "LegacyID", "AuditUserID", "password", "DummyPwd", "EmailId", "StoredPassword", "PrivateKey", "PasswordValidity", "IsAssociated", "UserUUID") VALUES (2, N'en', N'Srivastava', N'Siddharth', N'', N'siddharth', 1023, 0, CAST(N'2019-05-10T05:13:34.897' AS timestamptz), CAST(N'2019-05-10T05:13:34.897' AS timestamptz), NULL, 1, 'x001699E55A06FA79F4CA0D06EF15096C020000002C9B22886522612FD8687D520E820178EC956FE690415250829FC35042E4C253EDB00622B818C321578B877F24B6BED5'::bytea, NULL, N'[email protected]', N'568BD443C04F9B2BB7EB8089213B868E2865623F140BC25A77239169B24C7C1B', N'7BF4FB3F97CD903A9AF16BA419A1A3947FFA293371E2BCB1B868EE6E4BAF3AEC', NULL, NULL, N'326b5d5c-5630-4b10-bda3-b7334034ad61');
INSERT INTO "tblUsers" ("UserID", "LanguageID", "LastName", "OtherNames", "Phone", "LoginName", "RoleID", "HFID", "ValidityFrom", "ValidityTo", "LegacyID", "AuditUserID", "password", "DummyPwd", "EmailId", "StoredPassword", "PrivateKey", "PasswordValidity", "IsAssociated", "UserUUID") VALUES (3, N'en', N'Admin', N'Admin', N'', N'Admin', 1023, 0, CAST(N'2017-12-16T14:26:37.710' AS timestamptz), CAST(N'2018-03-19T08:54:48.907' AS timestamptz), 1, 0, 'x001699E55A06FA79F4CA0D06EF15096C01000000AABB2D46EA963BEEBEC2B6A7C0195BEAD56D875BF16D75F92DD047EAE987E4CC'::bytea, NULL, NULL, NULL, NULL, NULL, NULL, N'5bcc1389-a47b-464c-a32a-7a60d9fd1cad');
INSERT INTO "tblUsers" ("UserID", "LanguageID", "LastName", "OtherNames", "Phone", "LoginName", "RoleID", "HFID", "ValidityFrom", "ValidityTo", "LegacyID", "AuditUserID", "password", "DummyPwd", "EmailId", "StoredPassword", "PrivateKey", "PasswordValidity", "IsAssociated", "UserUUID") VALUES (4, N'en', N'sri', N'sid', N'', N'sidsri', 1, 0, CAST(N'2019-05-10T05:13:38.223' AS timestamptz), CAST(N'2019-05-10T05:13:38.223' AS timestamptz), NULL, 1, 'x001699E55A06FA79F4CA0D06EF15096C02000000D7925623C394F680CF9A1BD06ED155960019C8567100E8A869147E30E6353296FACCD73063C0D08B'::bytea, NULL, N'[email protected]', N'6BA12D6E86F3B6FFBEBECD7E25D156B04B474F707B25B09A822F688B99426F5B', N'D9193C4A617CEE0AAEA870AAEC59FBE9B90A59A16319142CC55FF6FE2A0D6C57', NULL, NULL, N'e3d5ed51-fdf6-4755-a6a2-9d8012abac51');
Expand Down
1 change: 1 addition & 0 deletions database scripts/json_schema_extension.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE EXTENSION "postgres-json-schema";
20 changes: 20 additions & 0 deletions install_postgres_json_schema_extension.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
apk add --update make
apk add --update git

# Clone the repository
git clone https://github.com/gavinwahl/postgres-json-schema/

apk add libpq-dev
# Move into the directory
cd postgres-json-schema

# Build the extension
make & make install


apk add postgresql-client

/bin/mkdir -p '/usr/local/share/postgresql/extension'

chmod 666 /usr/local/share/postgresql/extension/postgres-json-schema.control
Loading

0 comments on commit 7fb5ada

Please sign in to comment.