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

K8s #54

Merged
merged 30 commits into from
Dec 12, 2020
Merged

K8s #54

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1b1cf1b
Preemptively update the README
ben-walker Dec 11, 2020
8b1a030
Setup eslint deps
ben-walker Dec 11, 2020
ff79f2f
Update to node 15.4
ben-walker Dec 11, 2020
3197bc9
Configure ignore files
ben-walker Dec 11, 2020
d2a2a4a
Use prettier plugin
ben-walker Dec 11, 2020
80ea788
Reformat Actions
ben-walker Dec 11, 2020
be709ba
Specify react version
ben-walker Dec 11, 2020
0b514d2
Add postinstall script
ben-walker Dec 11, 2020
af8272e
Also lint tsx
ben-walker Dec 11, 2020
5ebaab9
Add initial devspace yaml
ben-walker Dec 11, 2020
cda8edd
'Fix' eslint erors
ben-walker Dec 11, 2020
f65bec4
ESLint fix after generating types
ben-walker Dec 11, 2020
1ee22f1
Don't dockerignore generated code
ben-walker Dec 11, 2020
6df7c78
Don't eslintignore generated code
ben-walker Dec 11, 2020
f518e7a
Don't gitignore generated code
ben-walker Dec 11, 2020
629165c
Track generated graphql types
ben-walker Dec 11, 2020
c499660
Reorg scripts
ben-walker Dec 11, 2020
823f73c
Remove postinstall
ben-walker Dec 11, 2020
2e206a4
Remove graphql schema path arg
ben-walker Dec 11, 2020
f811391
Remove schema path passing
ben-walker Dec 11, 2020
7c68b40
Add generate script docs
ben-walker Dec 11, 2020
c44a523
Update ts
ben-walker Dec 11, 2020
0016a08
Add auto-generated warning in header
ben-walker Dec 11, 2020
d2f750f
Don't lint generated code
ben-walker Dec 11, 2020
b3dd2b3
Add NEXT_PUBLIC_GRAPHQL_URL var
ben-walker Dec 11, 2020
d8ba831
Get prod deploy ready to use devspace
ben-walker Dec 11, 2020
e479d6b
Add reverse forward to graph service
ben-walker Dec 11, 2020
8960cc6
Add dep on graph
ben-walker Dec 12, 2020
eae9486
Update dependencies
ben-walker Dec 12, 2020
d778e63
Remove need to supply graphql api url
ben-walker Dec 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ lerna-debug.log*

# Testing
/coverage

# Devspace config
devspace.yaml
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
/.next
/out
/build

# Generated Code
generated
11 changes: 8 additions & 3 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
parser: "@typescript-eslint/parser"

parserOptions:
ecmaVersion: 2020
project: tsconfig.json
sourceType: module

plugins:
- simple-import-sort
- "@typescript-eslint/eslint-plugin"

extends:
- plugin:@typescript-eslint/eslint-recommended
- eslint:recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
- plugin:prettier/recommended
- plugin:react/recommended
- plugin:react-hooks/recommended
- plugin:jsx-a11y/recommended
- prettier
- prettier/@typescript-eslint

settings:
react:
version: detect

rules:
react/react-in-jsx-scope: "off"
react/prop-types: "off"
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/check-container-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@ jobs:
- uses: docker/build-push-action@v2
with:
push: false
build-args: |
GRAPHQL_SCHEMA_PATH=https://raw.githubusercontent.com/pokernook/graph/main/schema.graphql
26 changes: 13 additions & 13 deletions .github/workflows/deploy-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2-beta
with:
node-version: 15.x

- name: Install DevSpace
run: npm install -g devspace

- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
Expand All @@ -19,18 +26,11 @@ jobs:
- name: Log in to DigitalOcean CR
run: doctl registry login --expiry-seconds 600

- name: Prepare Container
id: prepare
run: |
URI=registry.digitalocean.com/pokernook/web
TAG="${URI}:sha-${GITHUB_SHA::8}"
echo ::set-output name=tag::${TAG}
- name: Build and Push Container
run: devspace build --profile production

- uses: docker/setup-buildx-action@v1
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 pokernook-k8s

- uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.prepare.outputs.tag }}
build-args: |
GRAPHQL_SCHEMA_PATH=https://raw.githubusercontent.com/pokernook/graph/main/schema.graphql
- name: Deploy to Kubernetes
run: devspace deploy --skip-build --profile production --wait --timeout 120
29 changes: 0 additions & 29 deletions .github/workflows/lint-and-format.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint

on:
push:

jobs:
eslint:
name: ESLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2-beta
with:
node-version: 15.x

- name: Run ESLint Script
run: |
npm ci
npm run lint
2 changes: 2 additions & 0 deletions .github/workflows/semantic-analysis.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Semantic Analysis

on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"

Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
# Dependencies
node_modules

# Generated Code
generated

# Logs
logs
*.log
Expand All @@ -33,3 +30,6 @@ lerna-debug.log*

# Vercel
.vercel

# DevSpace cache and log folder
.devspace/
4 changes: 0 additions & 4 deletions .prettierignore

This file was deleted.

4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROM node:15.3.0-alpine
ARG GRAPHQL_SCHEMA_PATH
ENV GRAPHQL_SCHEMA_PATH=${GRAPHQL_SCHEMA_PATH}
FROM node:15.4.0-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# PokerNook Next.js App
# PokerNook Web App

## Development Setup

### Recommended Tools

- Node.js 15.x
- Docker Desktop
- Docker Desktop (or an alternative container runtime and local Kubernetes cluster)
- VS Code
- DevSpace CLI

Clone the repo, then run:

```bash
npm install # Install project dependencies

devspace dev # Run the app in a Kubernetes cluster
```

### NPM Scripts Overview
Expand All @@ -21,6 +24,8 @@ npm run dev # Create a hot-reloading Next.js server

npm run build # Build application for deployment

npm run generate # Generate GraphQL types

npm run sb # Storybook
```

Expand Down
7 changes: 7 additions & 0 deletions codegen.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
schema: ${GRAPHQL_SCHEMA_PATH}
overwrite: true
documents: src/**/*.graphql

generates:
src/generated/graphql.ts:
plugins:
- add:
content: |
/**
* This file was generated by GraphQL Code Generator
* Do not make changes to this file directly
*/
- typescript
- typescript-operations
- typescript-urql
68 changes: 68 additions & 0 deletions devspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
version: v1beta9

images:
web:
image: registry.digitalocean.com/pokernook/web
tags:
- sha-${DEVSPACE_GIT_COMMIT}-${DEVSPACE_RANDOM}
cmd: ["npm", "run", "dev"]
preferSyncOverRebuild: true
build:
docker:
useBuildKit: true

deployments:
- name: pokernook-web
helm:
componentChart: true
values:
containers:
- image: registry.digitalocean.com/pokernook/web
env:
- name: NEXT_PUBLIC_GRAPHQL_URL
value: http://pokernook-graph:4000
- name: GRAPHQL_SCHEMA_PATH
value: http://pokernook-graph:4000
service:
ports:
- port: 3000

dependencies:
- source:
git: https://github.com/pokernook/graph
branch: main

profiles:
- name: production
patches:
- op: remove
path: images.web.cmd
- op: remove
path: dependencies
- op: remove
path: deployments.name=pokernook-web.helm.values.containers[0].env.name=GRAPHQL_SCHEMA_PATH

dev:
ports:
- imageName: web
forward:
- port: 3000
open:
- url: http://localhost:3000
sync:
- imageName: web
excludePaths:
- .git/
uploadExcludePaths:
- /.next/
- node_modules
- generated
- "**/*.graphql"
- logs
- "**/*.log"
- npm-debug.log*
- yarn-debug.log*
- yarn-error.log*
- lerna-debug.log*
- /coverage
- devspace.yaml
Loading