Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #510 from 9renpoto/next
Browse files Browse the repository at this point in the history
feat: hasura
  • Loading branch information
9renpoto committed Nov 17, 2020
2 parents a9d5366 + 5eda92c commit 26fa793
Show file tree
Hide file tree
Showing 20 changed files with 90 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .envrc.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export POSTGRES_PASSWORD=password
export DATABASE_HOST="127.0.0.1"
export DATABASE_PORT="15432"
export POSTGRES_USER="postgres"
export POSTGRES_DB="postgres"
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ jobs:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
- name: Coveralls
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.github_token }}
- uses: codecov/codecov-action@v1.0.15
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions apps/core/src/config/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export const config: ConnectionOptions = {
username: process.env.POSTGRES_USER,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DB,
port:
typeof process.env.DATABASE_PORT === 'undefined'
? 5432
: Number(process.env.DATABASE_PORT),
entities: [join(__dirname, '../**/*.entity.[t|j]s')],
extra: process.env.NODE_ENV === 'production' && {
socketPath: process.env.DATABASE_HOST,
Expand Down
6 changes: 6 additions & 0 deletions apps/hasura/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
endpoint: http://localhost:8080
metadata_directory: metadata
actions:
kind: synchronous
handler_webhook_baseurl: http://localhost:3000
Empty file.
6 changes: 6 additions & 0 deletions apps/hasura/metadata/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions: []
custom_types:
enums: []
input_objects: []
objects: []
scalars: []
1 change: 1 addition & 0 deletions apps/hasura/metadata/allow_list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions apps/hasura/metadata/cron_triggers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions apps/hasura/metadata/functions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions apps/hasura/metadata/query_collections.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions apps/hasura/metadata/remote_schemas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions apps/hasura/metadata/tables.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions apps/hasura/metadata/version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: 2
Empty file.
6 changes: 6 additions & 0 deletions apps/hasura/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@9renpoto/hasura",
"version": "1.0.0",
"license": "MIT",
"private": true
}
2 changes: 2 additions & 0 deletions db/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set client_encoding = 'UTF8';
create database hasura;
22 changes: 19 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
version: '3'

version: '3.6'
services:
db:
image: postgres:10-alpine
image: postgres:12-alpine
volumes:
- ./db:/docker-entrypoint-initdb.d
environment:
POSTGRES_PASSWORD: password
ports:
- '15432:5432'
graphql-engine:
image: hasura/graphql-engine:v1.3.2
ports:
- '8080:8080'
depends_on:
- 'db'
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:password@db:5432/hasura
## enable the console served by server
HASURA_GRAPHQL_ENABLE_CONSOLE: 'true' # set to "false" to disable console
## enable debugging mode. It is recommended to disable this in production
HASURA_GRAPHQL_DEV_MODE: 'true'
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
## uncomment next line to set an admin secret
# HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@
"lint:pkg": "lerna run lint --parallel",
"lint:prettier": "prettier --check './{packages,apps}/**/*.{js,jsx,ts,tsx}'",
"release": "lerna exec --no-bail -- 'can-npm-publish && npm publish --registry=\"https://registry.npmjs.org/\"'",
"hasura": "yarn workspace @9renpoto/hasura hasura",
"test": "lerna run test -- -w 1"
},
"devDependencies": {
"@9renpoto/eslint-config-typescript": "7.2.0",
"@9renpoto/textlint-config-ja": "7.2.0",
"@9renpoto/tsconfig": "^7.2.0",
"@types/faker": "5.1.4",
"@types/jest": "26.0.15",
"eslint": "7.13.0",
"faker": "5.1.0",
"hasura-cli": "^1.3.2",
"husky": "4.3.0",
"jest": "26.6.3",
"lcov-result-merger": "3.1.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/variables/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "lib/index.js",
"scripts": {
"build": "tsc -p .",
"clean": "rimraf lib"
"clean": "rimraf lib",
"prebuild": "npm run clean"
},
"files": [
"lib"
Expand Down
29 changes: 28 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
textlint-rule-preset-ja-spacing "^2.0.1"
textlint-rule-preset-jtf-style "^2.3.4"

"@9renpoto/tsconfig@^7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@9renpoto/tsconfig/-/tsconfig-7.2.0.tgz#1bcc8c684f7eef409eba56b5c1cbb4cfdd99b60e"
integrity sha512-dJXmVY+0GY9FTKhPpYIowRib+FSQuUD109T/tXb0Av17dK/g4a3whc/GU32804ySKLPjhOCLsXVcaea9ysVLTA==

"@angular-devkit/core@11.0.1":
version "11.0.1"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-11.0.1.tgz#7125b07ac7d66a8fdaaf612a3b757817d23b8107"
Expand Down Expand Up @@ -3536,6 +3541,13 @@ axios@0.21.0:
dependencies:
follow-redirects "^1.10.0"

axios@^0.19.0:
version "0.19.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27"
integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==
dependencies:
follow-redirects "1.5.10"

babel-jest@^26.6.3:
version "26.6.3"
resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-26.6.3.tgz#d87d25cb0037577a0c89f82e5755c5d293c01056"
Expand Down Expand Up @@ -4682,7 +4694,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
dependencies:
ms "2.0.0"

debug@3.1.0:
debug@3.1.0, debug@=3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
Expand Down Expand Up @@ -5762,6 +5774,13 @@ flush-write-stream@^1.0.0, flush-write-stream@^1.0.2:
inherits "^2.0.3"
readable-stream "^2.3.6"

follow-redirects@1.5.10:
version "1.5.10"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
dependencies:
debug "=3.1.0"

follow-redirects@^1.10.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.0.tgz#b42e8d93a2a7eea5ed88633676d6597bc8e384db"
Expand Down Expand Up @@ -6391,6 +6410,14 @@ hastscript@^5.0.0:
property-information "^5.0.0"
space-separated-tokens "^1.0.0"

hasura-cli@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/hasura-cli/-/hasura-cli-1.3.2.tgz#e38ae1167976cd588718ce66c1330a7f694a17c7"
integrity sha512-x+f/fpjJyI47b0KWvOKQqTNMKLAVXaFEN63EPz4kAjqTSQD/hinmWDW4YSDBWnCUtaQHTyIS5hsLzxw9yWFA5g==
dependencies:
axios "^0.19.0"
chalk "^2.4.2"

highlight.js@^9.6.0:
version "9.18.3"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.18.3.tgz#a1a0a2028d5e3149e2380f8a865ee8516703d634"
Expand Down

0 comments on commit 26fa793

Please sign in to comment.