The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Add Hasura and dockerify dev env
Charles Bochetaeee5b5fca92
diff --git a/.circleci/config.yml b/.circleci/config.ymlindex 57d1d009151..99ebc88031d 100644--- a/.circleci/config.yml+++ b/.circleci/config.yml@@ -23,12 +23,13 @@ workflows:jobs:- tests- aws-ecr/build-and-push-image:+ name: build-imagefilters:branches:only: mainrequires:- tests- dockerfile: Dockerfile+ dockerfile: ./infra/prod/Dockerfileregistry-id: AWS_ACCOUNT_IDaws-access-key-id: AWS_ACCESS_KEY_IDaws-secret-access-key: AWS_SECRET_ACCESS_KEY@@ -38,7 +39,7 @@ workflows:- aws-ecs/deploy-service-update:name: deploy-canaryrequires:- - aws-ecr/build-and-push-image+ - build-imagefamily: $AWS_ECS_CONTAINER_NAME_CANARYcluster: $AWS_ECS_CLUSTERcontainer-image-name-updates: "container=$AWS_ECS_CONTAINER_NAME_CANARY,tag=${CIRCLE_SHA1}"@@ -64,4 +65,15 @@ workflows:template: basic_success_1- slack/notify:event: fail- template: basic_fail_1\ No newline at end of file+ 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: latestdiff --git a/README.md b/README.mdindex 206ad965bb7..5246345cdaa 100644--- a/README.md+++ b/README.md@@ -4,40 +4,34 @@ Welcome to Twenty!## Setup & Development-### Frontend--```-cd front && npm install-npm run start-```--Browse: `localhost:3000`--### Backend-```-cd server && npm install-npm run start:dev+docker-compose -f infra/dev/docker-compose.yml up --build --force-recreate```-Browse: `localhost:5000`+Browse:+- FE/BE: localhost:3000+- Hasura: localhost:8080## Tests+Ssh into the twenty-server container using:+- `docker ps` to get the container id+- `docker exec -it CONTAINER_ID sh`+### Frontend```+cd frontnpm run test```### Backend```+cd servernpm run test```-Browse: `localhost:5000`-## Production```diff --git a/buildspec.yml b/buildspec.ymldeleted file mode 100644index 63eb6fbf075..00000000000--- a/buildspec.yml+++ /dev/null@@ -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.jsondiff --git a/infra/dev/docker-compose.yml b/infra/dev/docker-compose.ymlnew file mode 100644index 00000000000..6fe72880d3c--- /dev/null+++ b/infra/dev/docker-compose.yml@@ -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:\ No newline at end of filediff --git a/infra/dev/postgres/Dockerfile b/infra/dev/postgres/Dockerfilenew file mode 100644index 00000000000..0a2f10315fb--- /dev/null+++ b/infra/dev/postgres/Dockerfile@@ -0,0 +1,3 @@+FROM postgres:13.7 as postgres++COPY init.sql /docker-entrypoint-initdb.d/\ No newline at end of filediff --git a/infra/dev/postgres/init.sql b/infra/dev/postgres/init.sqlnew file mode 100644index 00000000000..30a091e6262--- /dev/null+++ b/infra/dev/postgres/init.sql@@ -0,0 +1,2 @@+CREATE DATABASE twenty;+CREATE DATABASE hasura;\ No newline at end of filediff --git a/infra/dev/twenty-server/Dockerfile b/infra/dev/twenty-server/Dockerfilenew file mode 100644index 00000000000..18e6c0d315d--- /dev/null+++ b/infra/dev/twenty-server/Dockerfile@@ -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"]diff --git a/Dockerfile b/infra/prod/Dockerfilesimilarity index 100%rename from Dockerfilerename to infra/prod/Dockerfile