Added postgres on docker compose
This commit is contained in:
parent
411de18e9f
commit
75fc400349
|
@ -2,7 +2,7 @@ server.port=8081
|
||||||
server.tomcat.max-threads = 20
|
server.tomcat.max-threads = 20
|
||||||
server.tomcat.max-connections = 10000
|
server.tomcat.max-connections = 10000
|
||||||
logging.file=/logs/spring-boot-logging.log
|
logging.file=/logs/spring-boot-logging.log
|
||||||
spring.profiles.active=devel
|
spring.profiles.active=staging
|
||||||
eu.eudat.logic.proxy.allowed.host=https://eestore.paas2.uninett.no
|
eu.eudat.logic.proxy.allowed.host=https://eestore.paas2.uninett.no
|
||||||
|
|
||||||
####################INVITATION MAIL CONFIGURATIONS##############
|
####################INVITATION MAIL CONFIGURATIONS##############
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
ADMIN_USERNAME=admin
|
||||||
|
ADMIN_PASSWORD=CHANGEME
|
||||||
|
POSTGRES_DB=dmptool
|
||||||
|
POSTGRES_USER=dmptool
|
||||||
|
POSTGRES_PASSWORD=CHANGEME
|
|
@ -0,0 +1,7 @@
|
||||||
|
psql -d dmptool -U dmptool -f main/DataManagementPlanDB.sql;
|
||||||
|
for j in $(ls updates); do
|
||||||
|
for i in $(ls updates/$j/*.sql); do
|
||||||
|
echo $i
|
||||||
|
psql --set=ADMIN_USERNAME="$ADMIN_USERNAME" --set=ADMIN_PASSWORD="$ADMIN_PASSWORD" -d dmptool -U dmptool -f $i;
|
||||||
|
done
|
||||||
|
done
|
|
@ -34,7 +34,7 @@ DROP table if exists "UserAuth" cascade;
|
||||||
-- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
-- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||||
|
|
||||||
|
|
||||||
-- CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||||
|
|
||||||
SET search_path = public, pg_catalog;
|
SET search_path = public, pg_catalog;
|
||||||
|
|
||||||
|
@ -550,8 +550,8 @@ ALTER TABLE "UserDMP" OWNER TO dmptool;
|
||||||
|
|
||||||
|
|
||||||
REVOKE ALL ON SCHEMA public FROM PUBLIC;
|
REVOKE ALL ON SCHEMA public FROM PUBLIC;
|
||||||
REVOKE ALL ON SCHEMA public FROM postgres;
|
-- REVOKE ALL ON SCHEMA public FROM postgres;
|
||||||
GRANT ALL ON SCHEMA public TO postgres;
|
-- GRANT ALL ON SCHEMA public TO postgres;
|
||||||
GRANT ALL ON SCHEMA public TO PUBLIC;
|
GRANT ALL ON SCHEMA public TO PUBLIC;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
INSERT INTO public."UserDMP"(
|
INSERT INTO public."UserDMP"(
|
||||||
usr, dmp, role)
|
usr, dmp, role)
|
||||||
SELECT "Creator", "ID", 0
|
SELECT "Creator", "ID", 0
|
||||||
FROM public."DMP"
|
FROM public."DMP";
|
||||||
|
|
||||||
DELETE
|
DELETE
|
||||||
FROM public."UserDMP" as us1
|
FROM public."UserDMP" as us1
|
||||||
using public."UserDMP" as us2
|
using public."UserDMP" as us2
|
||||||
where us1."id" < us2."id" AND us1."dmp" = us2."dmp"
|
where us1."id" < us2."id" AND us1."dmp" = us2."dmp";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,30 +31,31 @@ WITH (
|
||||||
TABLESPACE pg_default;
|
TABLESPACE pg_default;
|
||||||
|
|
||||||
ALTER TABLE public."DMPDatasetProfile"
|
ALTER TABLE public."DMPDatasetProfile"
|
||||||
OWNER to dmtadm;
|
-- OWNER to dmtadm;
|
||||||
|
OWNER to dmptool;
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE public."UserDMP"
|
ALTER TABLE public."UserDMP"
|
||||||
OWNER to dmtadm;
|
-- OWNER to dmtadm;
|
||||||
|
OWNER to dmptool;
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO public."DMPDatasetProfile"(
|
--INSERT INTO public."DMPDatasetProfile"(
|
||||||
dmp, datasetprofile)
|
-- dmp, datasetprofile)
|
||||||
SELECT "ID", unnest(xpath('/profiles/profile/@profileId', dmpp."AssociatedDmps"::xml)::text[]::UUID[])
|
-- SELECT "ID", unnest(xpath('/profiles/profile/@profileId', dmpp."AssociatedDmps"::xml)::text[]::UUID[])
|
||||||
FROM public."DMP" as dmpp
|
-- FROM public."DMP" as dmpp;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Alter table public."DMP"
|
ALTER TABLE public."DMP"
|
||||||
add "FinalizedDat" timestamp(6) with time zone
|
ADD "FinalizedDat" timestamp(6) WITH time zone;
|
||||||
|
|
||||||
update public."DMP" SET "FinalizedDat" = "Modified"
|
UPDATE public."DMP" SET "FinalizedDat" = "Modified"
|
||||||
where "Status" = 1
|
WHERE "Status" = 1;
|
||||||
|
|
||||||
|
|
||||||
Alter table public."Dataset"
|
ALTER TABLE public."Dataset"
|
||||||
add "FinalizedDat" timestamp(6) with time zone
|
ADD "FinalizedDat" timestamp(6) WITH time zone;
|
||||||
|
|
||||||
update public."Dataset" SET "FinalizedDat" = "Modified"
|
UPDATE public."Dataset" SET "FinalizedDat" = "Modified"
|
||||||
where "Status" = 1
|
WHERE "Status" = 1;
|
|
@ -3,5 +3,5 @@ Add "isPublic" boolean NOT NULL Default False;
|
||||||
|
|
||||||
UPDATE public."DMP"
|
UPDATE public."DMP"
|
||||||
SET "isPublic" = True
|
SET "isPublic" = True
|
||||||
WHERE "Status" = 1
|
WHERE "Status" = 1;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
ALTER TABLE public."DMP"
|
ALTER TABLE public."DMP"
|
||||||
ADD "PublishedAt" timestamp(6) with time zone
|
ADD "PublishedAt" timestamp(6) WITH time zone;
|
||||||
|
|
||||||
UPDATE public."DMP"
|
UPDATE public."DMP"
|
||||||
SET "PublishedAt" = "FinalizedDat"
|
SET "PublishedAt" = "FinalizedDat"
|
||||||
where "isPublic" = True
|
where "isPublic" = True;
|
|
@ -1,2 +1,2 @@
|
||||||
ALTER TABLE public."DMP"
|
ALTER TABLE public."DMP"
|
||||||
ADD COLUMN "DOI" text
|
ADD COLUMN "DOI" text;
|
|
@ -0,0 +1,15 @@
|
||||||
|
CREATE TABLE public."Content" (
|
||||||
|
"Id" uuid NOT NULL,
|
||||||
|
"Filename" character varying NOT NULL,
|
||||||
|
"Extension" character varying NOT NULL,
|
||||||
|
"ParentType" numeric NOT NULL,
|
||||||
|
"Uri" character varying NOT NULL,
|
||||||
|
"LocationType" numeric NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public."Content" OWNER TO dmptool;
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public."Content"
|
||||||
|
ADD CONSTRAINT "Content_pkey" PRIMARY KEY ("Id");
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE public."Dataset"
|
|
||||||
DROP COLUMN "IsPublic"
|
|
|
@ -14,4 +14,5 @@ WITH (
|
||||||
TABLESPACE pg_default;
|
TABLESPACE pg_default;
|
||||||
|
|
||||||
ALTER TABLE public."LoginConfirmationEmail"
|
ALTER TABLE public."LoginConfirmationEmail"
|
||||||
OWNER to dmtadm;
|
-- OWNER to dmtadm;
|
||||||
|
OWNER to dmptool;
|
|
@ -0,0 +1,9 @@
|
||||||
|
ALTER TABLE public."Grant"
|
||||||
|
ADD COLUMN "Content" uuid;
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public."Grant"
|
||||||
|
ADD CONSTRAINT fk_grant_content FOREIGN KEY ("Content")
|
||||||
|
REFERENCES public."Content" ("Id") MATCH SIMPLE
|
||||||
|
ON UPDATE NO ACTION
|
||||||
|
ON DELETE NO ACTION;
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE public."Grant"
|
|
||||||
RENAME CONSTRAINT "fk_project_content" TO "fk_grant_content";
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
ALTER TABLE public."Grant"
|
||||||
|
ALTER COLUMN "Reference" TYPE character varying(255);
|
||||||
|
|
||||||
|
ALTER TABLE public."Grant"
|
||||||
|
ALTER COLUMN "Definition" TYPE character varying;
|
||||||
|
|
||||||
|
ALTER TABLE public."Registry"
|
||||||
|
ALTER COLUMN "Reference" TYPE character varying;
|
||||||
|
|
||||||
|
ALTER TABLE public."Service"
|
||||||
|
ALTER COLUMN "Reference" TYPE character varying;
|
||||||
|
|
||||||
|
ALTER TABLE public."Researcher"
|
||||||
|
ALTER COLUMN "Reference" TYPE character varying;
|
||||||
|
|
||||||
|
ALTER TABLE public."DataRepository"
|
||||||
|
ALTER COLUMN "Reference" TYPE character varying;
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE "Funder"
|
||||||
|
ADD COLUMN "CreationUser" uuid;
|
|
@ -1,4 +1,4 @@
|
||||||
Update "Funder" as funder
|
Update "Funder" as funder
|
||||||
set "CreationUser" = grant1."CreationUser"
|
set "CreationUser" = grant1."CreationUser"
|
||||||
from "Grant" as grant1
|
from "Grant" as grant1
|
||||||
where funder."ID" = grant1."Funder"
|
where funder."ID" = grant1."Funder" ;
|
|
@ -0,0 +1,15 @@
|
||||||
|
CREATE TABLE public."ExternalDataset" (
|
||||||
|
"Id" uuid DEFAULT public.uuid_generate_v4() NOT NULL,
|
||||||
|
"Label" character varying NOT NULL,
|
||||||
|
"Abbreviation" character varying,
|
||||||
|
"Reference" character varying NOT NULL,
|
||||||
|
"Created" timestamp(4) with time zone NOT NULL,
|
||||||
|
"Modified" timestamp(4) with time zone NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public."ExternalDataset" OWNER TO dmptool;
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public."ExternalDataset"
|
||||||
|
ADD CONSTRAINT "ExternalDataset_pkey" PRIMARY KEY ("Id");
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
ALTER TABLE "DataRepository"
|
||||||
|
ADD COLUMN "CreationUser" uuid;
|
||||||
|
|
||||||
|
ALTER TABLE "ExternalDataset"
|
||||||
|
ADD COLUMN "CreationUser" uuid;
|
||||||
|
|
||||||
|
ALTER TABLE "Registry"
|
||||||
|
ADD COLUMN "CreationUser" uuid;
|
||||||
|
|
||||||
|
ALTER TABLE "Service"
|
||||||
|
ADD COLUMN "CreationUser" uuid;
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE "Researcher"
|
||||||
|
ADD COLUMN "CreationUser" uuid;
|
|
@ -1,11 +0,0 @@
|
||||||
ALTER TABLE "DataRepository"
|
|
||||||
ADD COLUMN "CreationUser" uuid
|
|
||||||
|
|
||||||
ALTER TABLE "ExternalDataset"
|
|
||||||
ADD COLUMN "CreationUser" uuid
|
|
||||||
|
|
||||||
ALTER TABLE "Registry"
|
|
||||||
ADD COLUMN "CreationUser" uuid
|
|
||||||
|
|
||||||
ALTER TABLE "Service"
|
|
||||||
ADD COLUMN "CreationUser" uuid
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE "Funder"
|
|
||||||
ADD COLUMN "CreationUser" uuid
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE "Researcher"
|
|
||||||
ADD COLUMN "CreationUser" uuid
|
|
|
@ -1,6 +0,0 @@
|
||||||
UPDATE "Researcher"
|
|
||||||
SET "Reference" = CONCAT(LOWER(LEFT("Reference", 1)), SUBSTRING("Reference", 2))
|
|
||||||
WHERE "ID" in (
|
|
||||||
SELECT "ID" FROM "Researcher"
|
|
||||||
WHERE ASCII(LEFT("Reference", 1)) BETWEEN ASCII('A') AND ASCII('Z')
|
|
||||||
)
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
ALTER TABLE public."DMP"
|
||||||
|
ADD COLUMN "DmpProperties" text;
|
||||||
|
|
||||||
|
ALTER TABLE public."DMP"
|
||||||
|
ADD COLUMN "GroupId" uuid;
|
||||||
|
|
||||||
|
ALTER TABLE public."DMP"
|
||||||
|
ADD COLUMN "Properties" text;
|
||||||
|
|
||||||
|
ALTER TABLE public."DatasetProfile"
|
||||||
|
ADD COLUMN "GroupId" uuid;
|
||||||
|
|
||||||
|
ALTER TABLE public."DatasetProfile"
|
||||||
|
ADD COLUMN "Version" integer;
|
||||||
|
|
||||||
|
ALTER TABLE public."Grant"
|
||||||
|
ADD COLUMN "Type" numeric NOT NULL;
|
|
@ -0,0 +1,25 @@
|
||||||
|
CREATE TABLE public."Credential" (
|
||||||
|
"Id" uuid NOT NULL,
|
||||||
|
"Status" numeric NOT NULL,
|
||||||
|
"Provider" numeric NOT NULL,
|
||||||
|
"Public" character varying NOT NULL,
|
||||||
|
"Secret" character varying NOT NULL,
|
||||||
|
"CreationTime" timestamp(4) with time zone NOT NULL,
|
||||||
|
"LastUpdateTime" timestamp(4) with time zone NOT NULL,
|
||||||
|
"UserId" uuid NOT NULL,
|
||||||
|
"ExternalId" character varying NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public."Credential" OWNER TO dmptool;
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public."Credential"
|
||||||
|
ADD CONSTRAINT "Credential_pkey" PRIMARY KEY ("Id");
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public."Credential"
|
||||||
|
ADD CONSTRAINT fkey_credential_user FOREIGN KEY ("UserId") REFERENCES public."UserInfo"(id);
|
||||||
|
|
||||||
|
INSERT INTO public."UserInfo"(email, authorization_level, usertype, name, created, additionalinfo) VALUES ('fake@email.org', 1, 1, :'ADMIN_USERNAME', now(), '{}');
|
||||||
|
|
||||||
|
INSERT INTO public."Credential" VALUES (uuid_generate_v4(), 0, 5, :'ADMIN_USERNAME', :'ADMIN_PASSWORD', now(), now(), (SELECT public."UserInfo"."id" FROM public."UserInfo" WHERE name = 'admin'), 'dmp');
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
CREATE TABLE public."UserToken" (
|
||||||
|
"Token" uuid NOT NULL,
|
||||||
|
"UserId" uuid NOT NULL,
|
||||||
|
"IssuedAt" timestamp(4) with time zone NOT NULL,
|
||||||
|
"ExpiresAt" timestamp(4) with time zone NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public."UserToken" OWNER TO dmptool;
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public."UserToken"
|
||||||
|
ADD CONSTRAINT "UserToken_pkey" PRIMARY KEY ("Token");
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public."UserToken"
|
||||||
|
ADD CONSTRAINT fkey_usetoken_user FOREIGN KEY ("UserId") REFERENCES public."UserInfo"(id);
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
CREATE TABLE public."UserRole" (
|
||||||
|
"Id" uuid DEFAULT public.uuid_generate_v4() NOT NULL,
|
||||||
|
"Role" numeric DEFAULT 0 NOT NULL,
|
||||||
|
"UserId" uuid NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public."UserRole" OWNER TO dmptool;
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public."UserRole"
|
||||||
|
ADD CONSTRAINT "UserRole_pkey" PRIMARY KEY ("Id");
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public."UserRole"
|
||||||
|
ADD CONSTRAINT "UserRole_userId_fkey" FOREIGN KEY ("UserId") REFERENCES public."UserInfo"(id);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO public."UserRole"("Role", "UserId") VALUES (2, (SELECT public."UserInfo"."id" FROM public."UserInfo" WHERE name = 'admin'));
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
DROP TABLE IF EXISTS "UserAuth" CASCADE;
|
|
@ -1,8 +1,25 @@
|
||||||
version: '2.2'
|
version: "2.4"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
dmp-db:
|
||||||
|
image: postgres
|
||||||
|
container_name: opendmp-db
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "5001:5432"
|
||||||
|
expose:
|
||||||
|
- "5432"
|
||||||
|
volumes:
|
||||||
|
- dmpdata:/var/lib/postgresql/data
|
||||||
|
- ./dmp-db-scema:/docker-entrypoint-initdb.d/
|
||||||
|
- ./dmp-db-scema/main:/main
|
||||||
|
- ./dmp-db-scema/updates:/updates
|
||||||
|
env_file: ./dmp-db-scema/Docker/dmp-db.env
|
||||||
|
networks:
|
||||||
|
- opendmp-backend-network
|
||||||
|
|
||||||
dmp-backend:
|
dmp-backend:
|
||||||
build:
|
build:
|
||||||
context: ./dmp-backend
|
context: ./dmp-backend
|
||||||
container_name: opendmp-backend
|
container_name: opendmp-backend
|
||||||
env_file: ./dmp-backend/Docker/dmp-backend.env
|
env_file: ./dmp-backend/Docker/dmp-backend.env
|
||||||
|
@ -38,4 +55,7 @@ services:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
opendmp-frontend-network:
|
opendmp-frontend-network:
|
||||||
opendmp-backend-network:
|
opendmp-backend-network:
|
||||||
|
volumes:
|
||||||
|
dmpdata:
|
||||||
|
external: true
|
||||||
|
|
Loading…
Reference in New Issue