Merge pull request #14 from twentyhq/charles-bochet-add-hasura

Add Hasura
This commit is contained in:
Charles Bochet
2023-01-04 13:13:15 +01:00
committed by GitHub
5 changed files with 70 additions and 17 deletions

View File

@@ -6,8 +6,13 @@ orbs:
slack: circleci/slack@4.12.0 slack: circleci/slack@4.12.0
node: circleci/node@5.0.3 node: circleci/node@5.0.3
parameters:
build-api:
type: boolean
default: false
jobs: jobs:
tests: tests-server:
executor: node/default executor: node/default
steps: steps:
- checkout - checkout
@@ -19,17 +24,17 @@ jobs:
name: tests name: tests
workflows: workflows:
build-and-deploy: build-and-deploy-server:
jobs: jobs:
- tests - tests-server
- aws-ecr/build-and-push-image: - aws-ecr/build-and-push-image:
name: build-image name: build-image-server
filters: filters:
branches: branches:
only: main only: main
requires: requires:
- tests - tests-server
dockerfile: ./infra/prod/Dockerfile dockerfile: ./infra/prod/twenty-server/Dockerfile
registry-id: AWS_ACCOUNT_ID registry-id: AWS_ACCOUNT_ID
aws-access-key-id: AWS_ACCESS_KEY_ID aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY aws-secret-access-key: AWS_SECRET_ACCESS_KEY
@@ -37,28 +42,28 @@ workflows:
repo: $AWS_ECR_REPO repo: $AWS_ECR_REPO
tag: $CIRCLE_SHA1 tag: $CIRCLE_SHA1
- aws-ecs/deploy-service-update: - aws-ecs/deploy-service-update:
name: deploy-canary name: deploy-server-canary
requires: requires:
- build-image - build-image-server
family: $AWS_ECS_CONTAINER_NAME_CANARY family: $AWS_ECS_CONTAINER_NAME_SERVER_CANARY
cluster: $AWS_ECS_CLUSTER cluster: $AWS_ECS_CLUSTER
container-image-name-updates: "container=$AWS_ECS_CONTAINER_NAME_CANARY,tag=${CIRCLE_SHA1}" container-image-name-updates: "container=$AWS_ECS_CONTAINER_NAME_SERVER_CANARY,tag=${CIRCLE_SHA1}"
- slack/on-hold: - slack/on-hold:
name: slack-notification name: slack-notification
context: slack-secrets context: slack-secrets
requires: requires:
- deploy-canary - deploy-server-canary
- hold: - hold:
type: approval type: approval
requires: requires:
- slack-notification - slack-notification
- aws-ecs/deploy-service-update: - aws-ecs/deploy-service-update:
name: deploy-prod name: deploy-server-default
requires: requires:
- hold - hold
family: $AWS_ECS_CONTAINER_NAME_DEFAULT family: $AWS_ECS_CONTAINER_NAME_SERVER_DEFAULT
cluster: $AWS_ECS_CLUSTER cluster: $AWS_ECS_CLUSTER
container-image-name-updates: "container=$AWS_ECS_CONTAINER_NAME_DEFAULT,tag=${CIRCLE_SHA1}" container-image-name-updates: "container=$AWS_ECS_CONTAINER_NAME_SERVER_DEFAULT,tag=${CIRCLE_SHA1}"
post-steps: post-steps:
- slack/notify: - slack/notify:
event: pass event: pass
@@ -69,11 +74,53 @@ workflows:
- aws-ecr/build-and-push-image: - aws-ecr/build-and-push-image:
name: build-image-latest name: build-image-latest
requires: requires:
- deploy-prod - deploy-server-default
dockerfile: ./infra/prod/Dockerfile dockerfile: ./infra/prod/twenty-server/Dockerfile
registry-id: AWS_ACCOUNT_ID registry-id: AWS_ACCOUNT_ID
aws-access-key-id: AWS_ACCESS_KEY_ID aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY aws-secret-access-key: AWS_SECRET_ACCESS_KEY
region: $AWS_REGION region: $AWS_REGION
repo: $AWS_ECR_REPO repo: $AWS_ECR_REPO
tag: latest tag: latest
build-and-deploy-api:
when: << pipeline.parameters.build-api >>
jobs:
- aws-ecr/build-and-push-image:
name: build-image-api
dockerfile: ./infra/prod/twenty-api/Dockerfile
registry-id: AWS_ACCOUNT_ID
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
repo: $AWS_ECR_REPO_API
tag: $CIRCLE_SHA1
- aws-ecs/deploy-service-update:
name: deploy-api-canary
requires:
- build-image-api
family: $AWS_ECS_CONTAINER_NAME_API_CANARY
cluster: $AWS_ECS_CLUSTER
container-image-name-updates: "container=$AWS_ECS_CONTAINER_NAME_API_CANARY,tag=${CIRCLE_SHA1}"
- hold:
type: approval
requires:
- deploy-api-canary
- aws-ecs/deploy-service-update:
name: deploy-api-default
requires:
- hold
family: $AWS_ECS_CONTAINER_NAME_API_DEFAULT
cluster: $AWS_ECS_CLUSTER
container-image-name-updates: "container=$AWS_ECS_CONTAINER_NAME_API_DEFAULT,tag=${CIRCLE_SHA1}"
- aws-ecr/build-and-push-image:
name: build-image-api-latest
requires:
- deploy-api-default
dockerfile: ./infra/prod/twenty-api/Dockerfile
registry-id: AWS_ACCOUNT_ID
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
repo: $AWS_ECR_REPO_API
tag: latest

View File

@@ -9,7 +9,7 @@ services:
depends_on: depends_on:
- postgres - postgres
twenty-api: twenty-api:
image: hasura/graphql-engine:latest build: ./twenty-api
ports: ports:
- "8080:8080" - "8080:8080"
depends_on: depends_on:

View File

@@ -0,0 +1,3 @@
FROM hasura/graphql-engine:latest as api
CMD ["sh", "-c", "graphql-engine serve"]

View File

@@ -0,0 +1,3 @@
FROM hasura/graphql-engine:latest as api
CMD ["sh", "-c", "graphql-engine serve"]