mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-23 20:13:21 +03:00
Merge pull request #13 from twentyhq/charles-bochet-dockerify-and-add-hasura
Add Hasura and dockerify dev env
This commit is contained in:
commit
9b749c6de3
@ -23,12 +23,13 @@ workflows:
|
|||||||
jobs:
|
jobs:
|
||||||
- tests
|
- tests
|
||||||
- aws-ecr/build-and-push-image:
|
- aws-ecr/build-and-push-image:
|
||||||
|
name: build-image
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
only: main
|
only: main
|
||||||
requires:
|
requires:
|
||||||
- tests
|
- tests
|
||||||
dockerfile: Dockerfile
|
dockerfile: ./infra/prod/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
|
||||||
@ -38,7 +39,7 @@ workflows:
|
|||||||
- aws-ecs/deploy-service-update:
|
- aws-ecs/deploy-service-update:
|
||||||
name: deploy-canary
|
name: deploy-canary
|
||||||
requires:
|
requires:
|
||||||
- aws-ecr/build-and-push-image
|
- build-image
|
||||||
family: $AWS_ECS_CONTAINER_NAME_CANARY
|
family: $AWS_ECS_CONTAINER_NAME_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_CANARY,tag=${CIRCLE_SHA1}"
|
||||||
@ -65,3 +66,14 @@ workflows:
|
|||||||
- slack/notify:
|
- slack/notify:
|
||||||
event: fail
|
event: fail
|
||||||
template: basic_fail_1
|
template: basic_fail_1
|
||||||
|
- aws-ecr/build-and-push-image:
|
||||||
|
name: build-image-latest
|
||||||
|
requires:
|
||||||
|
- deploy-prod
|
||||||
|
dockerfile: ./infra/prod/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
|
||||||
|
tag: latest
|
||||||
|
26
README.md
26
README.md
@ -4,40 +4,34 @@ Welcome to Twenty!
|
|||||||
|
|
||||||
## Setup & Development
|
## Setup & Development
|
||||||
|
|
||||||
### Frontend
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cd front && npm install
|
docker-compose -f infra/dev/docker-compose.yml up --build --force-recreate
|
||||||
npm run start
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Browse: `localhost:3000`
|
Browse:
|
||||||
|
- FE/BE: localhost:3000
|
||||||
### Backend
|
- Hasura: localhost:8080
|
||||||
|
|
||||||
```
|
|
||||||
cd server && npm install
|
|
||||||
npm run start:dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Browse: `localhost:5000`
|
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
|
Ssh into the twenty-server container using:
|
||||||
|
- `docker ps` to get the container id
|
||||||
|
- `docker exec -it CONTAINER_ID sh`
|
||||||
|
|
||||||
### Frontend
|
### Frontend
|
||||||
|
|
||||||
```
|
```
|
||||||
|
cd front
|
||||||
npm run test
|
npm run test
|
||||||
```
|
```
|
||||||
|
|
||||||
### Backend
|
### Backend
|
||||||
|
|
||||||
```
|
```
|
||||||
|
cd server
|
||||||
npm run test
|
npm run test
|
||||||
```
|
```
|
||||||
|
|
||||||
Browse: `localhost:5000`
|
|
||||||
|
|
||||||
## Production
|
## Production
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
version: 0.2
|
|
||||||
|
|
||||||
phases:
|
|
||||||
pre_build:
|
|
||||||
commands:
|
|
||||||
- echo Logging in to Amazon ECR...
|
|
||||||
- aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 255840220362.dkr.ecr.eu-west-3.amazonaws.com
|
|
||||||
build:
|
|
||||||
commands:
|
|
||||||
- echo Build started on `date`
|
|
||||||
- docker build -t twenty-pilot .
|
|
||||||
- docker tag twenty-pilot 255840220362.dkr.ecr.eu-west-3.amazonaws.com/twenty-pilot:latest
|
|
||||||
- cd $CODEBUILD_SRC_DIR
|
|
||||||
post_build:
|
|
||||||
commands:
|
|
||||||
- echo Build completed on `date`
|
|
||||||
- echo Pushing the Docker images...
|
|
||||||
- docker push 255840220362.dkr.ecr.eu-west-3.amazonaws.com/twenty-pilot:latest
|
|
||||||
- echo Writing image definitions file...
|
|
||||||
- printf '{"AWSEBDockerrunVersion":"1","Image":{"Name":"%s","Update":"true"},"Ports":[{"ContainerPort":3000,"HostPort":80}]}' 255840220362.dkr.ecr.eu-west-3.amazonaws.com/twenty-pilot:latest > Dockerrun.aws.json
|
|
||||||
- cat Dockerrun.aws.json
|
|
||||||
|
|
||||||
artifacts:
|
|
||||||
files: Dockerrun.aws.json
|
|
33
infra/dev/docker-compose.yml
Normal file
33
infra/dev/docker-compose.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
version: "3.9"
|
||||||
|
services:
|
||||||
|
twenty-server:
|
||||||
|
build:
|
||||||
|
context: ../..
|
||||||
|
dockerfile: ./infra/dev/twenty-server/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
twenty-api:
|
||||||
|
image: hasura/graphql-engine:latest
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
depends_on:
|
||||||
|
- "postgres"
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/hasura
|
||||||
|
PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/twenty
|
||||||
|
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
|
||||||
|
HASURA_GRAPHQL_DEV_MODE: "true"
|
||||||
|
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
|
||||||
|
postgres:
|
||||||
|
build: ./postgres
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: postgrespassword
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
db_data:
|
3
infra/dev/postgres/Dockerfile
Normal file
3
infra/dev/postgres/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM postgres:13.7 as postgres
|
||||||
|
|
||||||
|
COPY init.sql /docker-entrypoint-initdb.d/
|
2
infra/dev/postgres/init.sql
Normal file
2
infra/dev/postgres/init.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
CREATE DATABASE twenty;
|
||||||
|
CREATE DATABASE hasura;
|
14
infra/dev/twenty-server/Dockerfile
Normal file
14
infra/dev/twenty-server/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
FROM node:18-alpine as app
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY ../.. .
|
||||||
|
|
||||||
|
WORKDIR /app/front
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
WORKDIR /app/server
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
CMD ["npm", "run", "start:prod"]
|
Loading…
Reference in New Issue
Block a user