mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-22 19:41:53 +03:00
Setup first hasura schema
This commit is contained in:
parent
b9d1d80f64
commit
0445c03b51
28
README.md
28
README.md
@ -6,6 +6,7 @@ Welcome to Twenty documentation!
|
||||
|
||||
Twenty development stack is composed of 3 different layers
|
||||
- front: our frontend React app
|
||||
- hasura: our graphql engine exposing our database and server
|
||||
- server: our backend that contain endpoint, crm logic, scripts, jobs...
|
||||
- storages: postgres
|
||||
|
||||
@ -29,7 +30,7 @@ cd infra/dev
|
||||
```
|
||||
|
||||
```
|
||||
docker-compose up --build --force-recreate
|
||||
make build
|
||||
```
|
||||
|
||||
Once this is completed you should have:
|
||||
@ -46,23 +47,16 @@ If you are using VSCode, please use the `Dev Containers` extension to open the p
|
||||
|
||||
If you are using Docker install, make sure to ssh in the docker container during development to execute commands. You can also use `Makefile` to help you
|
||||
|
||||
## Development
|
||||
## Development workflow
|
||||
|
||||
### Tests
|
||||
### Front tests
|
||||
|
||||
#### Unit tests:
|
||||
Run tests: `make front-test`
|
||||
Run coverage: `make front-coverage`
|
||||
Run storybook: `make front-storybook`
|
||||
|
||||
```
|
||||
make front-test
|
||||
# coverage
|
||||
make front-coverage
|
||||
```
|
||||
### Hasura development
|
||||
|
||||
#### Storybook:
|
||||
```
|
||||
make front-storybook
|
||||
```
|
||||
|
||||
## Developping on server
|
||||
|
||||
Section TBD
|
||||
Open hasura console: `make hasura-console`
|
||||
Do your changes in hasura console on http://localhost:9695
|
||||
Commit your changes in git
|
||||
|
6
hasura/config.yaml
Normal file
6
hasura/config.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
version: 3
|
||||
endpoint: http://localhost:8080
|
||||
metadata_directory: metadata
|
||||
actions:
|
||||
kind: synchronous
|
||||
handler_webhook_baseurl: http://localhost:3000
|
0
hasura/metadata/actions.graphql
Normal file
0
hasura/metadata/actions.graphql
Normal file
6
hasura/metadata/actions.yaml
Normal file
6
hasura/metadata/actions.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
actions: []
|
||||
custom_types:
|
||||
enums: []
|
||||
input_objects: []
|
||||
objects: []
|
||||
scalars: []
|
1
hasura/metadata/allow_list.yaml
Normal file
1
hasura/metadata/allow_list.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
1
hasura/metadata/api_limits.yaml
Normal file
1
hasura/metadata/api_limits.yaml
Normal file
@ -0,0 +1 @@
|
||||
{}
|
1
hasura/metadata/backend_configs.yaml
Normal file
1
hasura/metadata/backend_configs.yaml
Normal file
@ -0,0 +1 @@
|
||||
{}
|
1
hasura/metadata/cron_triggers.yaml
Normal file
1
hasura/metadata/cron_triggers.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
9
hasura/metadata/databases/databases.yaml
Normal file
9
hasura/metadata/databases/databases.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
- name: twenty
|
||||
kind: postgres
|
||||
configuration:
|
||||
connection_info:
|
||||
database_url:
|
||||
from_env: HASURA_GRAPHQL_PG_DATABASE_URL
|
||||
isolation_level: read-committed
|
||||
use_prepared_statements: false
|
||||
tables: "!include twenty/tables/tables.yaml"
|
@ -0,0 +1,3 @@
|
||||
table:
|
||||
name: workspaces
|
||||
schema: public
|
1
hasura/metadata/databases/twenty/tables/tables.yaml
Normal file
1
hasura/metadata/databases/twenty/tables/tables.yaml
Normal file
@ -0,0 +1 @@
|
||||
- "!include public_workspaces.yaml"
|
1
hasura/metadata/graphql_schema_introspection.yaml
Normal file
1
hasura/metadata/graphql_schema_introspection.yaml
Normal file
@ -0,0 +1 @@
|
||||
disabled_for_roles: []
|
1
hasura/metadata/inherited_roles.yaml
Normal file
1
hasura/metadata/inherited_roles.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
1
hasura/metadata/metrics_config.yaml
Normal file
1
hasura/metadata/metrics_config.yaml
Normal file
@ -0,0 +1 @@
|
||||
{}
|
1
hasura/metadata/network.yaml
Normal file
1
hasura/metadata/network.yaml
Normal file
@ -0,0 +1 @@
|
||||
{}
|
1
hasura/metadata/opentelemetry.yaml
Normal file
1
hasura/metadata/opentelemetry.yaml
Normal file
@ -0,0 +1 @@
|
||||
{}
|
1
hasura/metadata/query_collections.yaml
Normal file
1
hasura/metadata/query_collections.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
1
hasura/metadata/remote_schemas.yaml
Normal file
1
hasura/metadata/remote_schemas.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
1
hasura/metadata/rest_endpoints.yaml
Normal file
1
hasura/metadata/rest_endpoints.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
1
hasura/metadata/version.yaml
Normal file
1
hasura/metadata/version.yaml
Normal file
@ -0,0 +1 @@
|
||||
version: 3
|
@ -0,0 +1 @@
|
||||
DROP TABLE "public"."workspaces";
|
@ -0,0 +1 @@
|
||||
CREATE TABLE "public"."workspaces" ("id" serial NOT NULL, "name" Text NOT NULL, "display_name" text NOT NULL, PRIMARY KEY ("id") , UNIQUE ("id"), UNIQUE ("name"));
|
@ -1,17 +1,39 @@
|
||||
build: ##
|
||||
@docker-compose up --build --force-recreate
|
||||
|
||||
up: ##
|
||||
@docker-compose up -d
|
||||
|
||||
logs: ##
|
||||
@docker-compose logs twenty -f
|
||||
down: ##
|
||||
@docker-compose down
|
||||
|
||||
sh: ##
|
||||
@docker-compose exec twenty sh
|
||||
## Front
|
||||
|
||||
front-logs: ##
|
||||
@docker-compose logs twenty-front -f
|
||||
|
||||
front-sh: ##
|
||||
@docker-compose exec twenty-front sh
|
||||
|
||||
front-test: ##
|
||||
@docker-compose exec twenty sh -c "cd front && npm run test"
|
||||
@docker-compose exec twenty-front sh -c "npm run test"
|
||||
|
||||
front-coverage: ##
|
||||
@docker-compose exec twenty sh -c "cd front && npm run coverage"
|
||||
@docker-compose exec twenty-front sh -c "npm run coverage"
|
||||
|
||||
front-storybook: ##
|
||||
@docker-compose exec twenty sh -c "cd front && npm run storybook"
|
||||
@docker-compose exec twenty-front sh -c "npm run storybook"
|
||||
|
||||
## Hasura
|
||||
|
||||
hasura-logs: ##
|
||||
@docker-compose logs twenty-hasura -f
|
||||
|
||||
hasura-sh: ##
|
||||
@docker-compose exec twenty-hasura sh
|
||||
|
||||
hasura-console: ##
|
||||
@docker-compose exec twenty-hasura bash -c " \
|
||||
socat TCP-LISTEN:9695,fork,reuseaddr,bind=twenty-hasura TCP:127.0.0.1:9695 & \
|
||||
socat TCP-LISTEN:9693,fork,reuseaddr,bind=twenty-hasura TCP:127.0.0.1:9693 & \
|
||||
hasura console --log-level DEBUG --address "127.0.0.1" --no-browser || exit 1"
|
@ -26,7 +26,7 @@ services:
|
||||
environment:
|
||||
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/hasura
|
||||
HASURA_GRAPHQL_PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/twenty
|
||||
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
|
||||
HASURA_GRAPHQL_ENABLE_CONSOLE: "false"
|
||||
HASURA_GRAPHQL_DEV_MODE: "true"
|
||||
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
|
||||
twenty-server:
|
||||
|
@ -6,4 +6,6 @@ RUN apt-get install -y socat
|
||||
RUN apt-get install -y vim
|
||||
RUN curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
|
||||
|
||||
WORKDIR /hasura
|
||||
|
||||
CMD ["sh", "-c", "graphql-engine serve"]
|
||||
|
9
infra/prod/hasura/Dockerfile
Normal file
9
infra/prod/hasura/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM hasura/graphql-engine:latest as api
|
||||
|
||||
RUN apt-get update
|
||||
RUN curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
|
||||
|
||||
WORKDIR /app/hasura
|
||||
COPY ./hasura .
|
||||
|
||||
CMD ["sh", "-c", "graphql-engine serve"]
|
Loading…
Reference in New Issue
Block a user