Setup Hasura-auth locally
This commit is contained in:
committed by
Charles Bochet
parent
43e71c6c93
commit
39ffb0f90b
@ -20,6 +20,7 @@ services:
|
||||
- "9693:9693"
|
||||
volumes:
|
||||
- ../../hasura:/hasura
|
||||
- /hasura/entrypoints
|
||||
depends_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: ../..
|
||||
|
||||
@ -8,4 +8,8 @@ RUN curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bas
|
||||
|
||||
WORKDIR /hasura
|
||||
|
||||
CMD ["sh", "-c", "graphql-engine serve"]
|
||||
RUN mkdir entrypoints
|
||||
COPY ./entrypoint.sh ./entrypoints/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["entrypoints/entrypoint.sh"]
|
||||
|
||||
|
||||
11
infra/dev/hasura/entrypoint.sh
Executable file
11
infra/dev/hasura/entrypoint.sh
Executable file
@ -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
|
||||
@ -1,3 +1,5 @@
|
||||
FROM postgres:13.7 as postgres
|
||||
|
||||
COPY init.sql /docker-entrypoint-initdb.d/
|
||||
RUN apt update && apt install -y curl
|
||||
|
||||
COPY init.sql /docker-entrypoint-initdb.d/
|
||||
|
||||
@ -1,2 +1,17 @@
|
||||
CREATE DATABASE twenty;
|
||||
CREATE DATABASE hasura;
|
||||
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;
|
||||
$$;
|
||||
Reference in New Issue
Block a user