The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Setup Hasura-auth locally
Anders Borch39ffb0f90bcd
diff --git a/hasura/metadata/databases/databases.yaml b/hasura/metadata/databases/databases.yamlindex 52ba870ebd4..264a9908fb6 100644--- a/hasura/metadata/databases/databases.yaml+++ b/hasura/metadata/databases/databases.yaml@@ -1,4 +1,4 @@-- name: twenty+- name: defaultkind: postgresconfiguration:connection_info:@@ -6,4 +6,4 @@from_env: HASURA_GRAPHQL_PG_DATABASE_URLisolation_level: read-committeduse_prepared_statements: false- tables: "!include twenty/tables/tables.yaml"+ tables: "!include default/tables/tables.yaml"diff --git a/hasura/metadata/databases/twenty/tables/public_workspaces.yaml b/hasura/metadata/databases/default/tables/public_workspaces.yamlsimilarity index 100%rename from hasura/metadata/databases/twenty/tables/public_workspaces.yamlrename to hasura/metadata/databases/default/tables/public_workspaces.yamldiff --git a/hasura/metadata/databases/twenty/tables/tables.yaml b/hasura/metadata/databases/default/tables/tables.yamlsimilarity index 100%rename from hasura/metadata/databases/twenty/tables/tables.yamlrename to hasura/metadata/databases/default/tables/tables.yamldiff --git a/hasura/migrations/twenty/1681407878182_create_table_public_workspaces/down.sql b/hasura/migrations/default/1681407878182_create_table_public_workspaces/down.sqlsimilarity index 100%rename from hasura/migrations/twenty/1681407878182_create_table_public_workspaces/down.sqlrename to hasura/migrations/default/1681407878182_create_table_public_workspaces/down.sqldiff --git a/hasura/migrations/twenty/1681407878182_create_table_public_workspaces/up.sql b/hasura/migrations/default/1681407878182_create_table_public_workspaces/up.sqlsimilarity index 100%rename from hasura/migrations/twenty/1681407878182_create_table_public_workspaces/up.sqlrename to hasura/migrations/default/1681407878182_create_table_public_workspaces/up.sqldiff --git a/infra/dev/docker-compose.yml b/infra/dev/docker-compose.ymlindex 70ac454787e..0277867682e 100644--- a/infra/dev/docker-compose.yml+++ b/infra/dev/docker-compose.yml@@ -20,6 +20,7 @@ services:- "9693:9693"volumes:- ../../hasura:/hasura+ - /hasura/entrypointsdepends_on:- "postgres"restart: always@@ -29,6 +30,23 @@ services:HASURA_GRAPHQL_ENABLE_CONSOLE: "false"HASURA_GRAPHQL_DEV_MODE: "true"HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log+ HASURA_GRAPHQL_ADMIN_SECRET: secret+ HASURA_GRAPHQL_JWT_SECRET: '{"type":"HS256", "key": "jwt-very-long-hard-to-guess-secret"}'+ hasura-auth:+ image: nhost/hasura-auth:0.19.1+ ports:+ - "4000:4000"+ environment:+ HASURA_GRAPHQL_JWT_SECRET: '{"type":"HS256", "key": "jwt-very-long-hard-to-guess-secret"}'+ HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/twenty+ HASURA_GRAPHQL_GRAPHQL_URL: http://twenty-hasura:8080/v1/graphql+ HASURA_GRAPHQL_ADMIN_SECRET: secret+ npm_package_version: '0'+ AUTH_SMTP_HOST: mailhog+ AUTH_SMTP_PORT: 1025+ depends_on:+ - "twenty-hasura"+ - "postgres"twenty-server:build:context: ../..diff --git a/infra/dev/hasura/Dockerfile b/infra/dev/hasura/Dockerfileindex bc86e41b71d..d7523df672f 100644--- a/infra/dev/hasura/Dockerfile+++ b/infra/dev/hasura/Dockerfile@@ -8,4 +8,8 @@ RUN curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | basWORKDIR /hasura-CMD ["sh", "-c", "graphql-engine serve"]+RUN mkdir entrypoints+COPY ./entrypoint.sh ./entrypoints/entrypoint.sh++ENTRYPOINT ["entrypoints/entrypoint.sh"]+diff --git a/infra/dev/hasura/entrypoint.sh b/infra/dev/hasura/entrypoint.shnew file mode 100755index 00000000000..3b4503acd79--- /dev/null+++ b/infra/dev/hasura/entrypoint.sh@@ -0,0 +1,11 @@+#!/bin/bash++graphql-engine serve &++while ! curl -s http://localhost:8080/healthz > /dev/null ; do+ sleep 1+done++hasura deploy++wait\ No newline at end of filediff --git a/infra/dev/postgres/Dockerfile b/infra/dev/postgres/Dockerfileindex 0a2f10315fb..75ddc042df8 100644--- a/infra/dev/postgres/Dockerfile+++ b/infra/dev/postgres/Dockerfile@@ -1,3 +1,5 @@FROM postgres:13.7 as postgres-COPY init.sql /docker-entrypoint-initdb.d/\ No newline at end of file+RUN apt update && apt install -y curl++COPY init.sql /docker-entrypoint-initdb.d/diff --git a/infra/dev/postgres/init.sql b/infra/dev/postgres/init.sqlindex 30a091e6262..b53c8220af0 100644--- a/infra/dev/postgres/init.sql+++ b/infra/dev/postgres/init.sql@@ -1,2 +1,17 @@CREATE DATABASE twenty;-CREATE DATABASE hasura;\ No newline at end of file+CREATE DATABASE hasura;++-- From: https://raw.githubusercontent.com/nhost/hasura-auth/main/docker/initdb.d/0001-create-schema.sql+\c twenty;+-- auth schema+CREATE SCHEMA IF NOT EXISTS auth;+-- https://github.com/hasura/graphql-engine/issues/3657+CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public;+CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public;+CREATE OR REPLACE FUNCTION public.set_current_timestamp_updated_at() RETURNS trigger LANGUAGE plpgsql AS $$+declare _new record;+begin _new := new;+_new."updated_at" = now();+return _new;+end;+$$;\ No newline at end of file