Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(starter): update to latest #51

Merged
merged 3 commits into from Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -49,7 +49,7 @@ jobs:
if [ "$CIRCLE_BRANCH" = "master" ]; then
echo "On master branch, pushing to Production"
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master
DEBUG=* WARTHOG_ENV=development:prod-like yarn dotenv:generate && yarn warthog db:migrate
DEBUG=* WARTHOG_ENV=production yarn run config && yarn warthog db:migrate
else
echo "On branch $CIRCLE_BRANCH - skipping deploy"
fi
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
12
12.18
8 changes: 8 additions & 0 deletions .vscode/launch.json
Expand Up @@ -14,6 +14,14 @@
"WARTHOG_MOCK_DATABASE": "true"
}
},
{
"name": "Node (index)",
"type": "node",
"request": "launch",
"args": ["dist/src/index.js"],
"cwd": "${workspaceRoot}",
"protocol": "inspector"
},
{
"type": "node",
"request": "launch",
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Expand Up @@ -12,5 +12,8 @@
"search.exclude": {
"dist/": true,
"node_modules/": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
1 change: 1 addition & 0 deletions Procfile
@@ -1 +1,2 @@
web: yarn start:prod

22 changes: 4 additions & 18 deletions docs/database.md
@@ -1,24 +1,10 @@
# Deploying to Heroku
# Creating DB in Heroku

This assumes you've already built an app and have some DB migrations ready to be run on the remote DB.
This assumes you've already created an app in heroku.

## Install the CLI
## Create Database in Heroku

```bash
brew tap heroku/brew && brew install heroku
```

## Login to CLI

```bash
heroku login
```

## Create App in Heroku

```bash
heroku create warthog-starter
heroku git:remote -a warthog-starter
heroku addons:create heroku-postgresql:hobby-dev
```

Expand Down Expand Up @@ -55,7 +41,7 @@ heroku config:set WARTHOG_DB_PASSWORD=12345678901234567890abcdefghijklmnopqrstuv
## Build app and migrate database

```bash
yarn build && WARTHOG_ENV=development:prod-like yarn dotenv:generate && yarn warthog db:migrate
yarn build && WARTHOG_ENV=development:prod-like yarn run config && yarn warthog db:migrate
```

## Run the server and issue a query
Expand Down
22 changes: 22 additions & 0 deletions docs/heroku.md
@@ -0,0 +1,22 @@
# Deploying to Heroku

To get started in Heroku, do the following:

## Install the CLI

```bash
brew tap heroku/brew && brew install heroku
```

## Login to CLI

```bash
heroku login
```

## Create your App

```bash
heroku create warthog-starter
heroku git:remote -a warthog-starter
```
39 changes: 39 additions & 0 deletions docs/jobs.md
@@ -0,0 +1,39 @@
# Deploying to Heroku

To get started in Heroku, do the following:

## First Login

```bash
heroku login
```

## App the add-on

```bash
heroku addons:create heroku-redis:hobby-dev
```

## Check status of add-on

```bash
heroku addons | grep heroku-redis
```

## Get Redis conneciton info

Heroku will create the `REDIS_URL` config value that you can use to connect

```bash
heroku config:get REDIS_URL
```

## Get info about redis addon

```bash
heroku addons --json | jq -c '.[] | select(.addon_service.cli_plugin_name == "heroku-redis")'
```

## References

[heroku-redis](https://elements.heroku.com/addons/heroku-redis)
24 changes: 7 additions & 17 deletions env.yml
@@ -1,17 +1,15 @@
# See: https://github.com/typeorm/typeorm/blob/master/docs/using-ormconfig.md#using-ormconfigjs
# Setting some ENV vars for typeorm and reading them in ormconfig.js
local: &local
DEBUG: '*'
local_app: &local_app
NODE_ENV: development
PGUSER: postgres
WARTHOG_AUTO_OPEN_PLAYGROUND: false
WARTHOG_AUTO_GENERATE_FILES: false

local_app: &local_app
WARTHOG_APP_HOST: localhost
WARTHOG_APP_PORT: 4100

build_env: &build_env
WARTHOG_BUILD_ENV: true
WARTHOG_DB_ENTITIES: dist/src/**/*.model.js
WARTHOG_DB_SUBSCRIBERS: dist/src/**/*.model.js
WARTHOG_RESOLVERS_PATH: dist/src/**/*.resolver.js
Expand All @@ -27,46 +25,38 @@ local_db: &local_db
WARTHOG_DB_PORT: 5432
WARTHOG_DB_SYNCHRONIZE: true
WARTHOG_DB_USERNAME: postgres
# PGSSLMODE: no-verify

prod_db: &prod_db
PGSSLMODE: require
WARTHOG_DB_DATABASE: ${env:WARTHOG_STARTER_DB_DATABASE}
WARTHOG_DB_HOST: ${env:WARTHOG_STARTER_DB_HOST}
WARTHOG_DB_LOGGING: none
WARTHOG_DB_PASSWORD: ${env:WARTHOG_STARTER_DB_PASSWORD}
WARTHOG_DB_PORT: ${env:WARTHOG_STARTER_DB_PORT}
WARTHOG_DB_SYNCHRONIZE: false
WARTHOG_DB_USERNAME: ${env:WARTHOG_STARTER_DB_USERNAME}
PGSSLMODE: require
NODE_TLS_REJECT_UNAUTHORIZED: 0

test:
WARTHOG_DB_DATABASE: warthog-starter-test
<<: *local
<<: *local_app
<<: *local_db

development:
<<: *local
local:
<<: *local_app
<<: *local_db

development:build:
<<: *local
<<: *local_app
<<: *build_env
<<: *local_db

development:prod-like:
local:production:
WARTHOG_APP_PROTOCOL: http
<<: *local
<<: *local_app
<<: *build_env
<<: *prod_db

production:
NODE_ENV: production
WARTHOG_APP_HOST: localhost
WARTHOG_APP_PORT: 443 # $ { env:PORT } # Heroku will set this for us
WARTHOG_APP_PORT: 443
WARTHOG_INTROSPECTION: true
WARTHOG_PLAYGROUND: true
<<: *prod_db
Expand Down
22 changes: 13 additions & 9 deletions generated/binding.ts
Expand Up @@ -21,7 +21,8 @@ export interface Query {
segment: <T = Segment>(args: { where: SegmentWhereUniqueInput }, info?: GraphQLResolveInfo | string, options?: Options) => Promise<T> ,
userSegments: <T = Array<UserSegment>>(args: { offset?: Int | null, limit?: Int | null, where?: UserSegmentWhereInput | null, orderBy?: UserSegmentOrderByInput | null }, info?: GraphQLResolveInfo | string, options?: Options) => Promise<T> ,
userSegment: <T = UserSegment>(args: { where: UserSegmentWhereUniqueInput }, info?: GraphQLResolveInfo | string, options?: Options) => Promise<T> ,
user: <T = User>(args: { where: UserWhereUniqueInput }, info?: GraphQLResolveInfo | string, options?: Options) => Promise<T>
user: <T = User>(args: { where: UserWhereUniqueInput }, info?: GraphQLResolveInfo | string, options?: Options) => Promise<T> ,
users: <T = Array<User>>(args: { offset?: Int | null, limit?: Int | null, where?: UserWhereInput | null, orderBy?: UserOrderByInput | null }, info?: GraphQLResolveInfo | string, options?: Options) => Promise<T>
}

export interface Mutation {
Expand Down Expand Up @@ -182,6 +183,15 @@ export type SegmentOrderByInput = 'createdAt_ASC' |
'environmentId_ASC' |
'environmentId_DESC'

export type UserOrderByInput = 'createdAt_ASC' |
'createdAt_DESC' |
'updatedAt_ASC' |
'updatedAt_DESC' |
'deletedAt_ASC' |
'deletedAt_DESC' |
'key_ASC' |
'key_DESC'

export type UserSegmentOrderByInput = 'createdAt_ASC' |
'createdAt_DESC' |
'updatedAt_ASC' |
Expand Down Expand Up @@ -901,11 +911,10 @@ export interface FeatureFlagUser extends BaseGraphQLObject {
}

export interface PageInfo {
limit: Float
offset: Float
totalCount: Float
hasNextPage: Boolean
hasPreviousPage: Boolean
startCursor?: String | null
endCursor?: String | null
}

export interface Project extends BaseGraphQLObject {
Expand Down Expand Up @@ -1000,11 +1009,6 @@ The javascript `Date` as string. Type represents date and time as the ISO Date s
*/
export type DateTime = Date | string

/*
The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).
*/
export type Float = number

/*
The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.
*/
Expand Down