Skip to content

Commit

Permalink
Merge branch 'main' into fix#29
Browse files Browse the repository at this point in the history
  • Loading branch information
olisaagbafor committed Dec 11, 2024
2 parents c2d1848 + 66585cd commit 7bfc1ea
Show file tree
Hide file tree
Showing 17 changed files with 527 additions and 21 deletions.
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Use Alpine Linux as the base image
FROM alpine:3.18
# Use a lightweight Linux base image
FROM debian:bullseye-slim

# Set environment variables for non-interactive installations
ENV DEBIAN_FRONTEND=noninteractive

# Install necessary dependencies
RUN apk add --no-cache \
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
bash \
ca-certificates \
&& update-ca-certificates
&& rm -rf /var/lib/apt/lists/*

# Download and install Hasura CLI
RUN curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash

# Set the working directory inside the container
WORKDIR /app

# Set the default command to show Hasura CLI help
CMD ["hasura", "help"]
CMD ["hasura", "console"]
32 changes: 21 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
services:
postgres:
image: postgis/postgis:15-3.3
platform: linux/amd64
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgrespassword
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s

graphql-engine:
image: hasura/graphql-engine:v2.42.0
Expand All @@ -21,22 +26,18 @@ services:
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
## uncomment next line to run console offline (i.e load console assets from server instead of CDN)
# HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets
## uncomment next line to set an admin secret
HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
HASURA_GRAPHQL_METADATA_DEFAULTS: '{"backend_configs":{"dataconnector":{"athena":{"uri":"http://data-connector-agent:8081/api/v1/athena"},"mariadb":{"uri":"http://data-connector-agent:8081/api/v1/mariadb"},"mysql8":{"uri":"http://data-connector-agent:8081/api/v1/mysql"},"oracle":{"uri":"http://data-connector-agent:8081/api/v1/oracle"},"snowflake":{"uri":"http://data-connector-agent:8081/api/v1/snowflake"}}}}'
HASURA_GRAPHQL_JWT_SECRET: '{"type":"RS256","jwk_url": "https://www.googleapis.com/service_accounts/v1/jwk/[email protected]","audience": "safetrust-dev", "claims_map": {"x-hasura-allowed-roles": ["user","anonymous","tenant","landlord"],"x-hasura-default-role": "user","x-hasura-user-id": {"path": "$.sub"}},"issuer": "https://securetoken.google.com/safetrust-dev"}'
depends_on:
postgres:
condition: service_healthy
data-connector-agent:
condition: service_healthy

data-connector-agent:
image: hasura/graphql-data-connector:v2.42.0
platform: linux/amd64
restart: always
ports:
- 8081:8081
- "8081:8081"
environment:
QUARKUS_LOG_LEVEL: ERROR
QUARKUS_OPENTELEMETRY_ENABLED: "false"
Expand All @@ -51,11 +52,20 @@ services:
build:
context: .
dockerfile: Dockerfile
entrypoint: ["/bin/bash"]
tty: true
volumes:
- ./hasura-project:/hasura-project # Mount your Hasura project directory
- .:/app # Mount your Hasura project directory
environment:
HASURA_GRAPHQL_ENDPOINT: http://graphql-engine:8080
PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
working_dir: /app
command: hasura console --address 0.0.0.0 --console-port 9695
ports:
- "9695:9695"
depends_on:
graphql-engine:
condition: service_healthy


volumes:
db_data:
db_data:
26 changes: 26 additions & 0 deletions metadata/databases/safetrust/tables/escrow_api_calls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
table:
name: escrow_api_calls
schema: public
columns:
- name: id
type: uuid
- name: escrow_transaction_id
type: uuid
- name: endpoint
type: text
- name: method
type: text
- name: request_body
type: jsonb
- name: http_status_code
type: integer
- name: response_body
type: jsonb
- name: error_details
type: jsonb
- name: created_at
type: timestamptz
object_relationships:
- name: escrow_transaction
using:
foreign_key_constraint_on: escrow_transaction_id
60 changes: 60 additions & 0 deletions metadata/databases/safetrust/tables/escrow_transactions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
table:
name: escrow_transactions
schema: public
columns:
- name: id
type: uuid
- name: bid_request_id
type: uuid
- name: engagement_id
type: text
- name: contract_id
type: text
- name: signer_address
type: text
- name: transaction_type
type: escrow_transaction_type
- name: status
type: escrow_status
- name: http_status_code
type: integer
- name: http_response_body
type: jsonb
- name: http_error_details
type: jsonb
- name: amount
type: numeric
- name: initial_deposit_percentage
type: integer
- name: cancellation_reason
type: text
- name: cancelled_by
type: text
- name: refund_status
type: escrow_status
- name: metadata
type: jsonb
- name: created_at
type: timestamptz
- name: updated_at
type: timestamptz
- name: completed_at
type: timestamptz
object_relationships:
- name: bid_request
using:
foreign_key_constraint_on: bid_request_id
- name: cancelled_by_user
using:
foreign_key_constraint_on: cancelled_by
array_relationships:
- name: xdr_transactions
using:
foreign_key_constraint_on:
column: escrow_transaction_id
table: escrow_xdr_transactions
- name: api_calls
using:
foreign_key_constraint_on:
column: escrow_transaction_id
table: escrow_api_calls
28 changes: 28 additions & 0 deletions metadata/databases/safetrust/tables/escrow_xdr_transactions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
table:
name: escrow_xdr_transactions
schema: public
columns:
- name: id
type: uuid
- name: escrow_transaction_id
type: uuid
- name: xdr_type
type: escrow_transaction_type
- name: unsigned_xdr
type: text
- name: signed_xdr
type: text
- name: status
type: xdr_status
- name: signing_address
type: text
- name: error_message
type: text
- name: created_at
type: timestamptz
- name: updated_at
type: timestamptz
object_relationships:
- name: escrow_transaction
using:
foreign_key_constraint_on: escrow_transaction_id
25 changes: 25 additions & 0 deletions metadata/databases/safetrust/tables/public_bid_tables.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
- table:
schema: public
name: bid_requests
configuration:
custom_root_fields: {}
custom_column_names: {}
array_relationships:
- name: status_histories
using:
foreign_key_constraint_on:
column: bid_request_id
table:
schema: public
name: bid_status_histories

- table:
schema: public
name: bid_status_histories
configuration:
custom_root_fields: {}
custom_column_names: {}
object_relationships:
- name: bid_request
using:
foreign_key_constraint_on: bid_request_id
6 changes: 5 additions & 1 deletion metadata/databases/safetrust/tables/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
- "!include public_spatial_ref_sys.yaml"
- "!include public_user_wallets.yaml"
- "!include public_users.yaml"
- "!include escrow_api_calls.yaml"
- "!include escrow_transactions.yaml"
- "!include escrow_xdr_transactions.yaml"
- "!include public_apartments.yaml"
- "!include public_apartment_images.yaml"
- "!include public_apartment_images.yaml"
- "!include public_bid_tables.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- Drop indexes
DROP INDEX IF EXISTS idx_escrow_transactions_bid;
DROP INDEX IF EXISTS idx_escrow_transactions_contract;
DROP INDEX IF EXISTS idx_escrow_transactions_status;
DROP INDEX IF EXISTS idx_escrow_transactions_type_status;
DROP INDEX IF EXISTS idx_escrow_xdr_transaction;
DROP INDEX IF EXISTS idx_escrow_api_calls_transaction;
DROP INDEX IF EXISTS idx_escrow_api_calls_status;

-- Drop tables
DROP TABLE IF EXISTS escrow_api_calls;
DROP TABLE IF EXISTS escrow_xdr_transactions;
DROP TABLE IF EXISTS escrow_transactions;

-- Drop types
DROP TYPE IF EXISTS escrow_transaction_type;
DROP TYPE IF EXISTS escrow_status;
DROP TYPE IF EXISTS xdr_status;
Loading

0 comments on commit 7bfc1ea

Please sign in to comment.