Skip to content
Snippets Groups Projects
Commit 93c5cb3a authored by Deepa Kumari's avatar Deepa Kumari
Browse files

add readme updates

parent e6abbeac
No related branches found
No related tags found
1 merge request!452Introduce Partition-Core-Plus
Pipeline #214473 failed
......@@ -2,6 +2,12 @@
The Partition service is responsible for creating and retrieving partition specific properties on behalf of other services whether they are secret values or not. It is a Maven multi-module project with each cloud implementation placed in its submodule.
## RI Implementation
It is containing an Open-Source version with os-osm Driver containing the postgres db for consumption. As of now the code is not having any authentication for core-plus as it is not having the infra for authentication.
So, currently it's only enough to run and consume the service locally, for development and understanding purpose.
One could either spin up a postgres docker container locally, and use along with local partition service code. Or else, fetch the container image for postgres service and Partition service both and then use them. More details [here](./README.md#running-locally---partition-core-plus)
## Running Locally - AWS
Instructions for running the AWS implementation locally can be found [here](./provider/partition-aws/README.md)
......@@ -16,6 +22,9 @@ Instructions for running the Google Cloud implementation locally can be found [h
## Running Locally - IBM
## Running Locally - Partition Core Plus
Instructions for running the Partion Core Plus can be found [here](./partition-core-plus/README.md)
## Running Integration Tests
Instructions for running the integration tests can be found [here](./testing/README.md)
......
variables:
SERVICE_PORT: 8080
POSTGRES_DATASOURCE_URL_OSDU: jdbc:postgresql://172.17.0.2:5432/postgres
POSTGRES_DB_USERNAME_OSDU: postgres
POSTGRES_DB_PASSWORD_OSDU: $GC_OSM_POSTGRES_PASSWORD
POSTGRES_DB: postgres
POSTGRES_HOST: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: $GC_OSM_POSTGRES_PASSWORD
TEST_OPENID_PROVIDER_CLIENT_ID: integration-tester
TEST_OPENID_PROVIDER_CLIENT_SECRET: $GC_OPENID_PROVIDER_CLIENT_SECRET
TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_ID: no-access-tester
TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_SECRET: $GC_NO_ACCESS_OPENID_PROVIDER_CLIENT_SECRET
TEST_OPENID_PROVIDER_URL: https://keycloak.ref.gcp.gnrg-osdu.projects.epam.com/realms/osdu
core-plus-containerize:
stage: containerize
needs: ["compile-and-unit-test"]
......
## Running the Partition Core Plus locally
1. Run the basic postgres docker container with default values:
`docker run --name basic-postgres --rm -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=4y7sV96vA9wv46VR -e PGDATA=/var/lib/postgresql/data/pgdata -v /tmp:/var/lib/postgresql/data -p 5432:5432 -it postgres:14.1-alpine`
It will pull the image if not present locally, and will run it with local mounted tmp folder. It retains the tables created, you can choose a folder of your choice.
`After the container is running and waiting for connections, below should be seen on console:
2023-09-28 11:31:46.372 UTC [1] LOG: listening on IPv6 address "::", port 5432
2023-09-28 11:31:46.382 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-09-28 11:31:46.384 UTC [21] LOG: database system was shut down at 2023-09-28 11:31:42 UTC
2023-09-28 11:31:46.386 UTC [1] LOG: database system is ready to accept connections`
2. Table creations: After postgres container is running, one can log in to this container, and create the tables required by the partition service like below:
* Connect to the postgres container in shell `docker exec -it basic-postgres /bin/sh`
* After that, login to postgres cli: `psql --username postgres`
* To list existing tables, u can run `\l` command(it is letter l, and not number 1).
* Create the below table required for running the partition service, you can change these names and then change the env vars as well injected into the Partition Service docker container in the next step.
```CREATE USER usr_partition_pg WITH PASSWORD 'partition_pg';
GRANT usr_partition_pg TO postgres;
CREATE DATABASE partition_db OWNER usr_partition_pg;
\c "partition_db";
CREATE SCHEMA IF NOT EXISTS partition AUTHORIZATION usr_partition_pg;
CREATE TABLE IF NOT EXISTS partition."PartitionProperty"(
id text COLLATE pg_catalog."default" NOT NULL,
pk bigint NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
data jsonb NOT NULL,
CONSTRAINT PartitionProperty UNIQUE (id)
);
ALTER TABLE partition."PartitionProperty" OWNER to usr_partition_pg;
CREATE INDEX IF NOT EXISTS PartitionProperty_datagin ON partition."PartitionProperty" USING GIN (data);
```
3. After the required tables are created, launch the partition service image locally with below command:
`docker run --name partiton_service --env ./env-partition-core-plus.txt -p 8080:8080 community.opengroup.org:5555/osdu/platform/system/partition/partition-core-plus-dk-az-community-ref-impl:3a341a939fe74889c3b99a5271e2977d84925c74`
* For this command to work, create a file with below data in the same folder from where you're executing the above command (variables are in sync with what was created in point number 2):
`PARTITION_POSTGRES_URL=jdbc:postgresql://172.17.0.1:5432/partition_db
PARTITION_POSTGRESQL_USERNAME=usr_partition_pg
PARTITION_POSTGRESQL_PASSWORD=partition_pg
dataPartitionId=test-partition`
* Now, you can hit the Partition service from Postman to work on partition service locally.
......@@ -55,6 +55,25 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>get</id>
<phase>package</phase>
<goals>
<goal>get</goal>
</goals>
<configuration>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-osm.postgres</artifactId>
<version>0.24.0-rc6</version>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
......
......@@ -36,7 +36,7 @@ partition-property-kind=PartitionProperty
partition-namespace=partition
osmDriver=postgres
osm.postgres.url=${PARTITION_POSTGRES_URL:jdbc:postgresql://127.0.0.1:5432/partition_db}
osm.postgres.url=${PARTITION_POSTGRES_URL}
#Username and password to connect to the above url which contains the db name
#Has to be in sync with the user created using the bootstrapping scripts
osm.postgres.username=${PARTITION_POSTGRESQL_USERNAME:usr_partition_pg}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment