Simplify infrastructure to one container

This commit is contained in:
Charles Bochet
2023-03-06 16:15:46 +01:00
parent 2ddb191556
commit c2833cad53
61 changed files with 2211 additions and 1992 deletions

View File

@ -1,8 +1 @@
HASURA_GRAPHQL_JWT_SECRET=REPLACE_ME
HASURA_GRAPHQL_ADMIN_SECRET=hasura_secret
REACT_APP_AUTH0_DOMAIN=twenty-dev.eu.auth0.com
REACT_APP_AUTH0_CLIENT_ID=REPLACE_ME
REACT_APP_AUTH0_CALLBACK_URL=/auth/callback
REACT_APP_AUTH0_AUDIENCE=hasura-dev
REACT_APP_API_URL=http://localhost:8080/v1/graphql
REACT_APP_API_URL=http://localhost:3000

View File

@ -2,38 +2,16 @@ up: ##
@docker-compose up -d
logs: ##
@docker-compose logs $(container) -f
@docker-compose logs twenty -f
api-sh: ##
@docker-compose exec twenty-api bash
api-console: ##
@docker-compose exec twenty-api bash -c "cd /api; \
socat TCP-LISTEN:8080,fork TCP:twenty-api:8080 & \
socat TCP-LISTEN:9695,fork,reuseaddr,bind=twenty-api TCP:127.0.0.1:9695 & \
socat TCP-LISTEN:9693,fork,reuseaddr,bind=twenty-api TCP:127.0.0.1:9693 & \
hasura console --log-level DEBUG --address "127.0.0.1" --no-browser || exit 1"
api-make-seed: ##
@docker-compose exec twenty-api bash -c "cd /api; \
hasura seeds create seed --from-table $(table)"
api-make-migrations: ##
@docker-compose exec twenty-api bash -c "cd /api; \
hasura migrate create $(name)"
api-make-metadata: ##
@docker-compose exec twenty-api bash -c "cd /api; \
hasura metadata export"
front-sh: ##
@docker-compose exec twenty-front sh
sh: ##
@docker-compose exec twenty sh
front-test: ##
@docker-compose exec twenty-front sh -c "npm run test"
@docker-compose exec twenty sh -c "npm run test"
front-coverage: ##
@docker-compose exec twenty-front sh -c "npm run coverage"
@docker-compose exec twenty sh -c "npm run coverage"
front-storybook: ##
@docker-compose exec twenty-front sh -c "npm run storybook"
@docker-compose exec twenty sh -c "npm run storybook"

View File

@ -1,45 +1,19 @@
version: "3.9"
services:
twenty-front:
twenty:
build:
context: ../..
dockerfile: ./infra/dev/twenty-front/Dockerfile
dockerfile: ./infra/dev/twenty/Dockerfile
ports:
- "3000:3000"
- "3001:3001"
- "6006:6006"
volumes:
- ../../front:/app/front
- ../../server:/app/server
- ../../infra:/app/infra
depends_on:
- postgres
twenty-server:
build:
context: ../..
dockerfile: ./infra/dev/twenty-server/Dockerfile
ports:
- "3000:3000"
depends_on:
- postgres
twenty-api:
build: ./twenty-api
ports:
- "8080:8080"
- "9695:9695"
- "9693:9693"
volumes:
- ../../api:/api
depends_on:
- "postgres"
restart: always
environment:
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/hasura
HASURA_GRAPHQL_PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/twenty
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: "public"
HASURA_GRAPHQL_ADMIN_SECRET: ${HASURA_GRAPHQL_ADMIN_SECRET}
HASURA_GRAPHQL_JWT_SECRET: ${HASURA_GRAPHQL_JWT_SECRET}
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
postgres:
build: ./postgres
volumes:

View File

@ -1,2 +1 @@
CREATE DATABASE twenty;
CREATE DATABASE hasura;
CREATE DATABASE twenty;

View File

@ -1,9 +0,0 @@
FROM hasura/graphql-engine:latest as api
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y socat
RUN apt-get install -y vim
RUN curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
CMD ["sh", "-c", "graphql-engine serve"]

View File

@ -1,10 +0,0 @@
FROM node:18-alpine as app
WORKDIR /app
COPY ../.. .
WORKDIR /app/server
RUN npm install
RUN npm run build
CMD ["npm", "run", "start:prod"]

View File

@ -5,6 +5,10 @@ COPY ../.. .
WORKDIR /app/front
RUN npm install
RUN npm run build
WORKDIR /app/server
RUN npm install
WORKDIR /app
CMD ["npm", "run", "start"]