Skip to content

The open alternative to Salesforce, designed for AI.

[Wip] Update CI CD (#2945)

Charles Bochet2496431703a9
diff --git a/Makefile b/Makefile
index d95d3c05039..6baa4658ffa 100644
--- a/Makefile
+++ b/Makefile
@@ -10,14 +10,14 @@ docker-dev-down:
docker-dev-sh:
make -C packages/twenty-docker dev-sh
-postgres-provision-on-docker:
- make -C packages/twenty-docker dev-postgres-build
+postgres-on-docker:
+ make -C packages/twenty-postgres provision-on-docker
-postgres-provision-on-macos-arm:
+postgres-on-macos-arm:
make -C packages/twenty-postgres provision-on-macos-arm
-postgres-provision-on-macos-intel:
+postgres-on-macos-intel:
make -C packages/twenty-postgres provision-on-macos-intel
-postgres-provision-on-linux:
+postgres-on-linux:
make -C packages/twenty-postgres provision-on-linux
diff --git a/packages/twenty-docker/Makefile b/packages/twenty-docker/Makefile
index 112c3887fe5..7898044d790 100644
--- a/packages/twenty-docker/Makefile
+++ b/packages/twenty-docker/Makefile
@@ -1,11 +1,13 @@
dev-build:
- @docker compose -f dev/docker-compose.yml down
+ @docker compose -f dev/docker-compose.yml down
rm -rf ../twenty-front/node_modules
rm -rf ../twenty-server/node_modules
rm -rf ../twenty-docs/node_modules
- @docker volume rm twenty_node_modules_front > /dev/null 2>&1 || true
- @docker volume rm twenty_node_modules_server > /dev/null 2>&1 || true
- @docker volume rm twenty_node_modules_docs > /dev/null 2>&1 || true
+ @docker volume rm twenty_dev_node_modules_front > /dev/null 2>&1 || true
+ @docker volume rm twenty_dev_node_modules_server > /dev/null 2>&1 || true
+ @docker volume rm twenty_dev_node_modules_docs > /dev/null 2>&1 || true
+ @docker volume rm twenty_dev_node_modules_root > /dev/null 2>&1 || true
+ @docker volume rm twenty_dev_node_modules_yarn > /dev/null 2>&1 || true
@docker compose -f dev/docker-compose.yml build
dev-up:
@@ -22,3 +24,59 @@ dev-postgres-build:
@docker rm twenty_postgres || true
@docker volume rm twenty_db_data || true
@docker compose -f dev/docker-compose.yml up --build postgres -d
+
+prod-docs-build:
+ @cd ../.. && docker build -f ./packages/twenty-docker/prod/twenty-docs/Dockerfile --tag twenty-docs . && cd -
+
+prod-docs-run:
+ @docker run -p 3000:3000 twenty-docs
+
+prod-front-build:
+ @cd ../.. && docker build -f ./packages/twenty-docker/prod/twenty-front/Dockerfile --tag twenty-front . && cd -
+
+prod-front-run:
+ @docker run -p 3000:3000 twenty-front
+
+prod-server-build:
+ @cd ../.. && docker build -f ./packages/twenty-docker/prod/twenty-server/Dockerfile --tag twenty-server . && cd -
+
+prod-server-run:
+ @docker run -p 3000:3000 twenty-server
+
+prod-postgres-build:
+ @cd ../.. && docker build -f ./packages/twenty-docker/prod/twenty-postgres/Dockerfile --tag twenty-postgres . && cd -
+
+prod-postgres-run:
+ @docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres twenty-postgres
+
+release-front:
+ @cd ../.. && docker buildx build \
+ --push \
+ --no-cache \
+ --platform linux/amd64,linux/arm64 \
+ -f ./packages/twenty-docker/prod/twenty-front/Dockerfile -t twentycrm/twenty-front:$(version) -t twentycrm/twenty-front:latest . \
+ && cd -
+
+release-server:
+ @cd ../.. && docker buildx build \
+ --push \
+ --no-cache \
+ --platform linux/amd64,linux/arm64 \
+ -f ./packages/twenty-docker/prod/twenty-server/Dockerfile -t twentycrm/twenty-server:$(version) -t twentycrm/twenty-server:latest . \
+ && cd -
+
+release-docs:
+ @cd ../.. && docker buildx build \
+ --push \
+ --no-cache \
+ --platform linux/amd64,linux/arm64 \
+ -f ./packages/twenty-docker/prod/twenty-docs/Dockerfile -t twentycrm/twenty-docs:$(version) -t twentycrm/twenty-docs:latest . \
+ && cd -
+
+release-postgres:
+ @cd ../.. && docker buildx build \
+ --push \
+ --no-cache \
+ --platform linux/amd64,linux/arm64 \
+ -f ./packages/twenty-docker/prod/twenty-postgres/Dockerfile -t twentycrm/twenty-postgres:$(version) -t twentycrm/twenty-postgres:latest . \
+ && cd -
diff --git a/packages/twenty-docker/build/docs/Dockerfile b/packages/twenty-docker/build/docs/Dockerfile
deleted file mode 100644
index e6be1746339..00000000000
--- a/packages/twenty-docker/build/docs/Dockerfile
+++ /dev/null
@@ -1,18 +0,0 @@
-FROM node:18.16.0-alpine as docs
-
-WORKDIR /app/docs
-
-ARG SHOULD_INDEX_DOC
-
-COPY ./docs/package.json .
-COPY ./docs/yarn.lock .
-RUN yarn install
-
-COPY ./docs .
-RUN npm run build
-
-RUN yarn global add serve
-LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
-LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the documentation."
-
-CMD ["serve", "-s", "./build"]
diff --git a/packages/twenty-docker/build/front/Dockerfile b/packages/twenty-docker/build/front/Dockerfile
deleted file mode 100644
index 18e853d0bd4..00000000000
--- a/packages/twenty-docker/build/front/Dockerfile
+++ /dev/null
@@ -1,29 +0,0 @@
-FROM node:18.16.0-alpine as build
-
-ARG REACT_APP_SERVER_BASE_URL
-ARG REACT_APP_SERVER_AUTH_URL
-ARG REACT_APP_SERVER_FILES_URL
-
-COPY ./packages/ /app/packages
-
-WORKDIR /app/front
-COPY ./front .
-
-RUN yarn install
-RUN yarn build
-
-COPY ./infra/build/front/serve.json ./build
-
-FROM node:18.16.0-alpine as front
-
-WORKDIR /app/front
-
-COPY --from=build /app/front/build ./build
-COPY ./front/scripts/inject-runtime-env.sh /app/front/scripts/inject-runtime-env.sh
-
-RUN yarn global add serve
-
-LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
-LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the frontend."
-
-CMD ["/bin/sh", "-c", "/app/front/scripts/inject-runtime-env.sh && serve build"]
diff --git a/packages/twenty-docker/build/postgres/init.sql b/packages/twenty-docker/build/postgres/init.sql
deleted file mode 100644
index 5123e987ca9..00000000000
--- a/packages/twenty-docker/build/postgres/init.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-SELECT 'CREATE DATABASE "default"'
-WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'default')\gexec
-
-SELECT 'CREATE DATABASE "test"'
-WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'test')\gexec
-
-SELECT 'CREATE USER twenty PASSWORD ''twenty'''
-WHERE NOT EXISTS (SELECT FROM pg_user WHERE usename = 'twenty')\gexec
-
-SELECT 'ALTER ROLE twenty superuser'\gexec
diff --git a/packages/twenty-docker/build/server/Dockerfile b/packages/twenty-docker/build/server/Dockerfile
deleted file mode 100644
index 955b79d5be7..00000000000
--- a/packages/twenty-docker/build/server/Dockerfile
+++ /dev/null
@@ -1,15 +0,0 @@
-FROM node:18.16.0-alpine as build
-
-WORKDIR /app/server
-COPY ./server/package.json ./
-COPY ./server/yarn.lock ./
-COPY ./server/patches ./patches
-RUN yarn install
-
-COPY ./server .
-RUN yarn build
-
-LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
-LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the backend, ensuring it deploys faster and runs the same way regardless of the deployment environment."
-
-CMD ["node", "dist/src/main"]
diff --git a/packages/twenty-docker/dev/docker-compose.yml b/packages/twenty-docker/dev/docker-compose.yml
index 16049cde0be..2b0d648e760 100644
--- a/packages/twenty-docker/dev/docker-compose.yml
+++ b/packages/twenty-docker/dev/docker-compose.yml
@@ -18,25 +18,14 @@ services:
- twenty_dev_node_modules_server:/app/packages/twenty-server/node_modules
depends_on:
- postgres
- twenty-docs:
- build:
- context: ../../..
- dockerfile: ./packages/twenty-docker/dev/twenty-docs/Dockerfile
- ports:
- - "5001:5001"
- volumes:
- - ../../../packages/twenty-docs:/app/packages/twenty-docs
- - twenty_docs_node_modules_root:/app/node_modules
- - twenty_docs_node_modules_yarn:/app/.yarn
- - twenty_docs_node_modules_docs:/app/packages/twenty-docs/node_modules
postgres:
container_name: twenty_postgres
- build: ./postgres
+ image: twentycrm/twenty-postgres:latest
volumes:
- twenty_db_data:/var/lib/postgresql/data
environment:
- - POSTGRES_USER=twenty
- - POSTGRES_PASSWORD=twenty
+ - POSTGRES_USER=postgres
+ - POSTGRES_PASSWORD=postgres
- POSTGRES_DB=default
ports:
- "5432:5432"
@@ -47,6 +36,4 @@ volumes:
twenty_dev_node_modules_yarn:
twenty_dev_node_modules_front:
twenty_dev_node_modules_server:
- twenty_docs_node_modules_root:
- twenty_docs_node_modules_yarn:
- twenty_docs_node_modules_docs:
+ twenty_dev_node_modules_docs:
diff --git a/packages/twenty-docker/dev/postgres/Dockerfile b/packages/twenty-docker/dev/postgres/Dockerfile
deleted file mode 100644
index 335dff02832..00000000000
--- a/packages/twenty-docker/dev/postgres/Dockerfile
+++ /dev/null
@@ -1,35 +0,0 @@
-ARG PG_MAIN_VERSION=15.5
-
-FROM postgres:${PG_MAIN_VERSION}-bullseye as postgres
-
-ARG PG_MAIN_VERSION=15
-ARG PG_GRAPHQL_VERSION=1.4.2
-ARG WRAPPERS_VERSION=0.2.0
-ARG TARGETARCH
-
-RUN set -eux; \
- ARCH="$(dpkg --print-architecture)"; \
- case "${ARCH}" in \
- aarch64|arm64) \
- TARGETARCH='arm64'; \
- ;; \
- amd64|x86_64) \
- TARGETARCH='amd64'; \
- ;; \
- *) \
- echo "Unsupported arch: ${ARCH}"; \
- exit 1; \
- ;; \
- esac;
-
-RUN apt update && apt install curl -y
-
-# Install precompiled pg_graphql extensions
-RUN curl -L "https://github.com/supabase/pg_graphql/releases/download/v${PG_GRAPHQL_VERSION}/pg_graphql-v${PG_GRAPHQL_VERSION}-pg${PG_MAIN_VERSION}-${TARGETARCH}-linux-gnu.deb" -o pg_graphql.deb
-RUN dpkg --install pg_graphql.deb
-
-# Install precompiled supabase wrappers extensions
-RUN curl -L "https://github.com/supabase/wrappers/releases/download/v${WRAPPERS_VERSION}/wrappers-v${WRAPPERS_VERSION}-pg${PG_MAIN_VERSION}-${TARGETARCH}-linux-gnu.deb" -o wrappers.deb
-RUN dpkg --install wrappers.deb
-
-COPY init.sql /docker-entrypoint-initdb.d/
diff --git a/packages/twenty-docker/dev/postgres/init.sql b/packages/twenty-docker/dev/postgres/init.sql
deleted file mode 100644
index 5123e987ca9..00000000000
--- a/packages/twenty-docker/dev/postgres/init.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-SELECT 'CREATE DATABASE "default"'
-WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'default')\gexec
-
-SELECT 'CREATE DATABASE "test"'
-WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'test')\gexec
-
-SELECT 'CREATE USER twenty PASSWORD ''twenty'''
-WHERE NOT EXISTS (SELECT FROM pg_user WHERE usename = 'twenty')\gexec
-
-SELECT 'ALTER ROLE twenty superuser'\gexec
diff --git a/packages/twenty-docker/dev/twenty-dev/Dockerfile b/packages/twenty-docker/dev/twenty-dev/Dockerfile
index 8f115f140f7..db4fd5af541 100644
--- a/packages/twenty-docker/dev/twenty-dev/Dockerfile
+++ b/packages/twenty-docker/dev/twenty-dev/Dockerfile
@@ -1,16 +1,14 @@
FROM node:18.16-bullseye as twenty-dev
WORKDIR /app
-COPY ../../../../package.json .
-COPY ../../../../yarn.lock .
-COPY ../../../../.yarnrc.yml .
-COPY ../../../../.yarn/releases /app/.yarn/releases
-COPY ../../../packages/twenty-front/package.json /app/packages/twenty-front/package.json
-COPY ../../../packages/twenty-server/package.json /app/packages/twenty-server/package.json
-COPY ../../../packages/twenty-server/patches /app/packages/twenty-server/patches
-COPY ../../../packages/eslint-plugin-twenty/package.json /app/packages/eslint-plugin-twenty/package.json
-
-RUN yarn
+COPY ./package.json .
+COPY ./yarn.lock .
+COPY ./.yarnrc.yml .
+COPY ./.yarn/releases /app/.yarn/releases
+COPY ./packages/twenty-front/package.json /app/packages/twenty-front/package.json
+COPY ./packages/twenty-server/package.json /app/packages/twenty-server/package.json
+COPY ./packages/twenty-server/patches /app/packages/twenty-server/patches
+COPY ./packages/eslint-plugin-twenty/package.json /app/packages/eslint-plugin-twenty/package.json
RUN npx playwright install-deps
diff --git a/packages/twenty-docker/dev/twenty-docs/Dockerfile b/packages/twenty-docker/dev/twenty-docs/Dockerfile
deleted file mode 100644
index 62ad5357aae..00000000000
--- a/packages/twenty-docker/dev/twenty-docs/Dockerfile
+++ /dev/null
@@ -1,15 +0,0 @@
-FROM node:18.16-bullseye as twenty-docs
-
-WORKDIR /app
-
-COPY ../../../../package.json .
-COPY ../../../../yarn.lock .
-COPY ../../../../.yarnrc.yml .
-COPY ../../../../.yarn/releases /app/.yarn/releases
-COPY ../../../packages/twenty-docs/package.json /app/packages/twenty-docs/package.json
-
-RUN yarn
-
-WORKDIR /app/packages/twenty-docs
-
-CMD ["tail", "-f", "/dev/null"]
diff --git a/packages/twenty-docker/prod/front/Dockerfile b/packages/twenty-docker/prod/front/Dockerfile
deleted file mode 100644
index 3ec5bb0821a..00000000000
--- a/packages/twenty-docker/prod/front/Dockerfile
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM --platform=linux/amd64 twentycrm/twenty-front as front
-
-CMD ["/bin/sh", "-c", "/app/front/scripts/inject-runtime-env.sh && serve build"]
diff --git a/packages/twenty-docker/prod/postgres/Dockerfile b/packages/twenty-docker/prod/postgres/Dockerfile
deleted file mode 100644
index 5f2865444ac..00000000000
--- a/packages/twenty-docker/prod/postgres/Dockerfile
+++ /dev/null
@@ -1,30 +0,0 @@
-ARG PG_MAIN_VERSION=14
-
-FROM postgres:${PG_MAIN_VERSION} as postgres
-
-ARG PG_MAIN_VERSION
-ARG PG_GRAPHQL_VERSION=1.3.0
-ARG TARGETARCH
-
-RUN set -eux; \
- ARCH="$(dpkg --print-architecture)"; \
- case "${ARCH}" in \
- aarch64|arm64) \
- TARGETARCH='arm64'; \
- ;; \
- amd64|x86_64) \
- TARGETARCH='amd64'; \
- ;; \
- *) \
- echo "Unsupported arch: ${ARCH}"; \
- exit 1; \
- ;; \
- esac;
-
-RUN apt update && apt install -y curl
-
-# Install precompiled pg_graphql extensions
-RUN curl -L "https://github.com/supabase/pg_graphql/releases/download/v${PG_GRAPHQL_VERSION}/pg_graphql-v${PG_GRAPHQL_VERSION}-pg${PG_MAIN_VERSION}-${TARGETARCH}-linux-gnu.deb" -o pg_graphql.deb
-RUN dpkg --install pg_graphql.deb
-
-COPY ./infra/prod/postgres/init.sql /docker-entrypoint-initdb.d/
\ No newline at end of file
diff --git a/packages/twenty-docker/prod/postgres/init.sql b/packages/twenty-docker/prod/postgres/init.sql
deleted file mode 100644
index 5123e987ca9..00000000000
--- a/packages/twenty-docker/prod/postgres/init.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-SELECT 'CREATE DATABASE "default"'
-WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'default')\gexec
-
-SELECT 'CREATE DATABASE "test"'
-WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'test')\gexec
-
-SELECT 'CREATE USER twenty PASSWORD ''twenty'''
-WHERE NOT EXISTS (SELECT FROM pg_user WHERE usename = 'twenty')\gexec
-
-SELECT 'ALTER ROLE twenty superuser'\gexec
diff --git a/packages/twenty-docker/prod/server/Dockerfile b/packages/twenty-docker/prod/server/Dockerfile
deleted file mode 100644
index aedf00c1cd7..00000000000
--- a/packages/twenty-docker/prod/server/Dockerfile
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM --platform=linux/amd64 twentycrm/twenty-server as server
-
-CMD ["node", "dist/src/main"]
diff --git a/packages/twenty-docker/prod/twenty-docs/Dockerfile b/packages/twenty-docker/prod/twenty-docs/Dockerfile
new file mode 100644
index 00000000000..91064c0d937
--- /dev/null
+++ b/packages/twenty-docker/prod/twenty-docs/Dockerfile
@@ -0,0 +1,30 @@
+FROM node:18.16.0-alpine as twenty-docs-build
+
+WORKDIR /app
+
+ARG SHOULD_INDEX_DOC
+
+COPY ./package.json .
+COPY ./yarn.lock .
+COPY ./.yarnrc.yml .
+COPY ./.yarn/releases /app/.yarn/releases
+COPY ./packages/twenty-docs/package.json /app/packages/twenty-docs/package.json
+RUN yarn
+
+COPY ./packages/twenty-docs /app/packages/twenty-docs
+RUN yarn nx build twenty-docs
+
+CMD ["tail", "-f", "/dev/null"]
+
+FROM node:18.16.0-alpine as twenty-docs
+
+WORKDIR /app/packages/twenty-docs
+
+COPY --from=twenty-docs-build /app/packages/twenty-docs/build ./build
+
+RUN yarn global add serve
+
+LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
+LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the documentation."
+
+CMD ["serve", "-s", "./build"]
diff --git a/packages/twenty-docker/prod/twenty-front/Dockerfile b/packages/twenty-docker/prod/twenty-front/Dockerfile
new file mode 100644
index 00000000000..f7c26a6ac65
--- /dev/null
+++ b/packages/twenty-docker/prod/twenty-front/Dockerfile
@@ -0,0 +1,32 @@
+FROM node:18.16.0-alpine as twenty-front-build
+
+ARG REACT_APP_SERVER_BASE_URL
+ARG REACT_APP_SERVER_AUTH_URL
+ARG REACT_APP_SERVER_FILES_URL
+
+WORKDIR /app
+
+COPY ./package.json .
+COPY ./yarn.lock .
+COPY ./.yarnrc.yml .
+COPY ./.yarn/releases /app/.yarn/releases
+COPY ./packages/eslint-plugin-twenty /app/packages/eslint-plugin-twenty
+COPY ./packages/twenty-front /app/packages/twenty-front
+
+RUN yarn
+RUN yarn nx build twenty-front
+
+COPY ./packages/twenty-docker/prod/twenty-front/serve.json ./build
+
+FROM node:18.16.0-alpine as twenty-front
+
+WORKDIR /app/packages/twenty-front
+
+COPY --from=twenty-front-build /app/packages/twenty-front/build ./build
+COPY ./packages/twenty-front/scripts/inject-runtime-env.sh /app/packages/twenty-front/scripts/inject-runtime-env.sh
+RUN yarn global add serve
+
+LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
+LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the frontend."
+
+CMD ["/bin/sh", "-c", "./scripts/inject-runtime-env.sh && serve build"]
\ No newline at end of file
diff --git a/packages/twenty-docker/build/front/serve.json b/packages/twenty-docker/prod/twenty-front/serve.json
similarity index 100%
rename from packages/twenty-docker/build/front/serve.json
rename to packages/twenty-docker/prod/twenty-front/serve.json
diff --git a/packages/twenty-docker/build/postgres/Dockerfile b/packages/twenty-docker/prod/twenty-postgres/Dockerfile
similarity index 88%
rename from packages/twenty-docker/build/postgres/Dockerfile
rename to packages/twenty-docker/prod/twenty-postgres/Dockerfile
index 06881223dd2..3198d967653 100644
--- a/packages/twenty-docker/build/postgres/Dockerfile
+++ b/packages/twenty-docker/prod/twenty-postgres/Dockerfile
@@ -38,8 +38,8 @@ RUN dpkg --install wrappers.deb
RUN cp /usr/share/postgresql/${PG_MAIN_VERSION}/extension/wrappers* /opt/bitnami/postgresql/share/extension/
RUN cp /usr/lib/postgresql/${PG_MAIN_VERSION}/lib/wrappers* /opt/bitnami/postgresql/lib/
-COPY ./infra/build/postgres/init.sql /docker-entrypoint-initdb.d/
+COPY ./packages/twenty-docker/prod/twenty-postgres/init.sql /docker-entrypoint-initdb.d/
USER 1001
-ENTRYPOINT [ "/opt/bitnami/scripts/postgresql/entrypoint.sh" ]
-CMD [ "/opt/bitnami/scripts/postgresql/run.sh" ]
+ENTRYPOINT ["/opt/bitnami/scripts/postgresql/entrypoint.sh"]
+CMD ["/opt/bitnami/scripts/postgresql/run.sh"]
diff --git a/packages/twenty-docker/prod/twenty-postgres/init.sql b/packages/twenty-docker/prod/twenty-postgres/init.sql
new file mode 100644
index 00000000000..16a4788af62
--- /dev/null
+++ b/packages/twenty-docker/prod/twenty-postgres/init.sql
@@ -0,0 +1,4 @@
+CREATE DATABASE "default";
+CREATE DATABASE "test";
+CREATE USER twenty PASSWORD 'twenty';
+ALTER ROLE twenty superuser;
diff --git a/packages/twenty-docker/prod/twenty-server/Dockerfile b/packages/twenty-docker/prod/twenty-server/Dockerfile
new file mode 100644
index 00000000000..e0f27df3604
--- /dev/null
+++ b/packages/twenty-docker/prod/twenty-server/Dockerfile
@@ -0,0 +1,21 @@
+FROM node:18.16.0-alpine as twenty-server
+
+WORKDIR /app
+
+COPY ./package.json .
+COPY ./yarn.lock .
+COPY ./.yarnrc.yml .
+COPY ./.yarn/releases /app/.yarn/releases
+COPY ./packages/eslint-plugin-twenty /app/packages/eslint-plugin-twenty
+COPY ./packages/twenty-server /app/packages/twenty-server
+RUN yarn
+
+RUN yarn
+RUN yarn nx build twenty-server
+
+WORKDIR /app/packages/twenty-server
+
+LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
+LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the backend, ensuring it deploys faster and runs the same way regardless of the deployment environment."
+
+CMD ["node", "dist/src/main"]
diff --git a/packages/twenty-docs/docs/contributor/local-setup/docker-setup.mdx b/packages/twenty-docs/docs/contributor/local-setup/docker-setup.mdx
index 2ab5bb340d2..b1379332f25 100644
--- a/packages/twenty-docs/docs/contributor/local-setup/docker-setup.mdx
+++ b/packages/twenty-docs/docs/contributor/local-setup/docker-setup.mdx
@@ -92,6 +92,7 @@ make docker-dev-up
Setup database, run migrations, and seed:
```bash
make docker-dev-sh
+yarn
yarn nx database:init twenty-server
```
@@ -104,6 +105,7 @@ make docker-dev-sh
yarn nx start:dev twenty-server
```
+and in a separate terminal:
```bash
make docker-dev-sh
yarn nx start twenty-front
diff --git a/packages/twenty-docs/docs/contributor/local-setup/yarn-setup.mdx b/packages/twenty-docs/docs/contributor/local-setup/yarn-setup.mdx
index d6d14fdfb01..9365aa575f5 100644
--- a/packages/twenty-docs/docs/contributor/local-setup/yarn-setup.mdx
+++ b/packages/twenty-docs/docs/contributor/local-setup/yarn-setup.mdx
@@ -23,7 +23,7 @@ In this document, you'll learn how to install the project using yarn. You should
Before you can install and use Twenty, make sure you install the following on your computer:
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- [Node v18](https://nodejs.org/en/download)
-- [yarn v4](https://yarnpkg.com/getting-started/install).
+- [yarn v4](https://yarnpkg.com/getting-started/install)
- [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md)
:::info Note
@@ -115,17 +115,15 @@ You need to provision this database with a `twenty` user (password: `twenty`), a
<Tabs>
<TabItem value="linux" label="Linux" default>
<b>Option 1:</b> To provision your database locally:
-<br /><br />
-
+<br />
```bash
-make postgres-provision-on-linux
+make postgres-on-linux
```
<b>Option 2:</b> If you have docker installed:
-<br /><br />
-
+<br />
```bash
-make postgres-provision-on-docker
+make postgres--on-docker
```
This will create a Docker container, exposing a PostgresSQL instance at [http://localhost:5432](http://localhost:5432).
You can access this using `twenty` postgres user (password: `twenty`)
@@ -133,18 +131,16 @@ You can access this using `twenty` postgres user (password: `twenty`)
<TabItem value="mac-os" label="Mac OS" default>
<b>Option 1:</b> To provision your database locally:
-<br /><br />
-
+<br />
```bash
-make postgres-provision-on-macos-intel #for intel architecture
-make postgres-provision-on-macos-arm #for M1/M2/M3 architecture
+make postgres-on-macos-intel #for intel architecture
+make postgres-on-macos-arm #for M1/M2/M3 architecture
```
<b>Option 2:</b> If you have docker installed:
-<br /><br />
-
+<br />
```bash
-make postgres-provision-on-docker
+make postgres-on-docker
```
This will create a Docker container, exposing a PostgresSQL instance at [http://localhost:5432](http://localhost:5432).
You can access this using `twenty` postgres user (password: `twenty`)
@@ -154,7 +150,7 @@ You can access this using `twenty` postgres user (password: `twenty`)
It's better to provision your database locally:
```bash
-make provision-postgres-linux
+make postgres-on-linux
```
This will create a Docker container, exposing a PostgresSQL instance at [http://localhost:5432](http://localhost:5432).
You can access this using `twenty` postgres user (password: `twenty`)
diff --git a/packages/twenty-front/package.json b/packages/twenty-front/package.json
index e4913d56d84..9479243546e 100644
--- a/packages/twenty-front/package.json
+++ b/packages/twenty-front/package.json
@@ -7,7 +7,7 @@
"start": "vite --host",
"start:clean": "yarn start --force",
"build": "tsc && vite build && yarn build:inject-runtime-env",
- "build:inject-runtime-env": "./scripts/inject-runtime-env.sh",
+ "build:inject-runtime-env": "sh ./scripts/inject-runtime-env.sh",
"preview": "vite preview",
"eslint-plugin:setup": "cd ../packages/eslint-plugin-twenty/ && yarn && yarn build && cd ../../front/ && yarn upgrade eslint-plugin-twenty",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
diff --git a/packages/twenty-front/scripts/inject-runtime-env.sh b/packages/twenty-front/scripts/inject-runtime-env.sh
index d4281004b71..d561874a205 100755
--- a/packages/twenty-front/scripts/inject-runtime-env.sh
+++ b/packages/twenty-front/scripts/inject-runtime-env.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
echo "Generating env-config.js file from runtime environment variables..."
BASE_FILENAME="build/env-config.js"
diff --git a/packages/twenty-postgres/Makefile b/packages/twenty-postgres/Makefile
index 5c48f8838eb..9e56adb19a0 100644
--- a/packages/twenty-postgres/Makefile
+++ b/packages/twenty-postgres/Makefile
@@ -1,14 +1,12 @@
+provision-on-docker:
+ @docker compose -f docker/docker-compose.yml up
+
provision-on-macos-arm:
- sh ./provision/provision-postgres-macos-arm.sh
+ sh ./macos/arm/provision-postgres-macos-arm.sh
provision-on-macos-intel:
- sh ./provision/provision-postgres-macos-intel.sh
+ sh ./macos/intel/provision-postgres-macos-intel.sh
provision-on-linux:
- sh ./provision/provision-postgres-linux.sh
-
-build-pg_graphql-macos-arm:
- sh ./build/pg_graphql/build-pg_graphql-macos-arm.sh
+ sh ./linux/provision-postgres-linux.sh
-build-pg_graphql-macos-intel:
- sh ./build/pg_graphql/build-pg_graphql-macos-intel.sh
diff --git a/packages/twenty-postgres/build/pg_graphql/build-pg_graphql-macos-arm.sh b/packages/twenty-postgres/build/pg_graphql/build-pg_graphql-macos-arm.sh
deleted file mode 100755
index 1aa7a392352..00000000000
--- a/packages/twenty-postgres/build/pg_graphql/build-pg_graphql-macos-arm.sh
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/bash
-
-# Colors
-RED=31
-GREEN=32
-BLUE=34
-
-# Function to display colored output
-function echo_header {
- COLOR=$1
- MESSAGE=$2
- echo -e "\e[${COLOR}m\n=======================================================\e[0m"
- echo -e "\e[${COLOR}m${MESSAGE}\e[0m"
- echo -e "\e[${COLOR}m=======================================================\e[0m"
-}
-
-# Function to handle errors
-function handle_error {
- echo_header $RED "Error: $1"
- exit 1
-}
-
-cat << "EOF"
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-@@@@@@@#*+=================@@@@@%*+=========++*%@@@@@@@
-@@@@#- .+@@%=. .+@@@@@
-@@@- .*@@%- .#@@@
-@@= .=+++++++++++*#@@@= -++++++++++- %@@
-@@. %@@@@@@@@@@@@@@@+ =%@@@@@@@@@@@@= +@@
-@@. .@@@@@@@@@@@@@@+. -%@@@@@@@@@@@@@@+ +@@
-@@. .@@@@@@@@@@@@*. -#@@#:=@@@@@@@@@@@= +@@
-@@ @@@@@@@@@@#: :#@@#: -@@@@@@@@@@@= +@@
-@@#====#@@@@@@@@#- .*@@@= -@@@@@@@@@@@= +@@
-@@@@@@@@@@@@@@%- .*@@@@# -@@@@@@@@@@@= +@@
-@@@@@@@@@@@@%= +@@@@@@# -@@@@@@@@@@@= +@@
-@@@@@@@@@@@+ =@@@@@@@@# -@@@@@@@@@@@= +@@
-@@@@@@@@@+. -%@@@@@@@@@# -@@@@@@@@@@@= +@@
-@@@@@@@*. -%@@@@@@@@@@@# -@@@@@@@@@@@= +@@
-@@@@@#: :#@@@@@@@@@@@@@# -@@@@@@@@@@@+ +@@
-@@@#: :#@@@@@@@@@@@@@@@# :@@@@@@@@@@@= +@@
-@@= :+*+++++++++++*%@@@. :+++++++++- %@@
-@@ :@@@%. .#@@@
-@@- :@@@@@+: .+@@@@@
-@@@#+===================+%@@@@@@@%*++=======++*%@@@@@@@
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-EOF
-
-echo_header $BLUE " DATABASE SETUP"
-
-PG_MAIN_VERSION=15
-PG_GRAPHQL_VERSION=1.4.2
-CARGO_PGRX_VERSION=0.10.2
-
-current_directory=$(pwd)
-
-# Install PostgresSQL
-echo_header $GREEN "Step [1/4]: Installing PostgreSQL..."
-
-brew reinstall postgresql@$PG_MAIN_VERSION
-
-# Install pg_graphql extensions
-echo_header $GREEN "Step [2/4]: Installing GraphQL for PostgreSQL..."
-
-# Uninstall existing Rust installation if found
-existing_rust_path=$(which rustc)
-if [ -n "$existing_rust_path" ]; then
- echo "Uninstalling existing Rust installation..."
- rm -rf "$existing_rust_path"
-fi
-
-# To force a reinstall of cargo-pgrx, pass --force to the command below
-curl https://sh.rustup.rs -sSf | sh
-source "$HOME/.cargo/env"
-cargo install --locked cargo-pgrx@$CARGO_PGRX_VERSION --force
-cargo pgrx init --pg$PG_MAIN_VERSION download
-
-# Create a temporary directory
-temp_dir=$(mktemp -d)
-cd "$temp_dir"
-pwd
-
-curl -LJO https://github.com/supabase/pg_graphql/archive/refs/tags/v$PG_GRAPHQL_VERSION.zip || handle_error "Failed to download pg_graphql package."
-
-unzip pg_graphql-$PG_GRAPHQL_VERSION.zip
-
-[[ ":$PATH:" != *":/opt/homebrew/opt/postgresql@$PG_MAIN_VERSION/bin:"* ]] && PATH="/opt/homebrew/opt/postgresql@$PG_MAIN_VERSION/bin:${PATH}"
-
-cd "pg_graphql-$PG_GRAPHQL_VERSION"
-cargo pgrx install --release --pg-config /opt/homebrew/opt/postgresql@$PG_MAIN_VERSION/bin/pg_config
-
-# # Clean up the temporary directory
-echo "Cleaning up..."
-cd "$current_directory"
-
-echo "Build complete in $temp_dir."
diff --git a/packages/twenty-postgres/build/pg_graphql/build-pg_graphql-macos-intel.sh b/packages/twenty-postgres/build/pg_graphql/build-pg_graphql-macos-intel.sh
deleted file mode 100755
index 97ed59f2d73..00000000000
--- a/packages/twenty-postgres/build/pg_graphql/build-pg_graphql-macos-intel.sh
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/bash
-
-# Colors
-RED=31
-GREEN=32
-BLUE=34
-
-# Function to display colored output
-function echo_header {
- COLOR=$1
- MESSAGE=$2
- echo -e "\e[${COLOR}m\n=======================================================\e[0m"
- echo -e "\e[${COLOR}m${MESSAGE}\e[0m"
- echo -e "\e[${COLOR}m=======================================================\e[0m"
-}
-
-# Function to handle errors
-function handle_error {
- echo_header $RED "Error: $1"
- exit 1
-}
-
-cat << "EOF"
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-@@@@@@@#*+=================@@@@@%*+=========++*%@@@@@@@
-@@@@#- .+@@%=. .+@@@@@
-@@@- .*@@%- .#@@@
-@@= .=+++++++++++*#@@@= -++++++++++- %@@
-@@. %@@@@@@@@@@@@@@@+ =%@@@@@@@@@@@@= +@@
-@@. .@@@@@@@@@@@@@@+. -%@@@@@@@@@@@@@@+ +@@
-@@. .@@@@@@@@@@@@*. -#@@#:=@@@@@@@@@@@= +@@
-@@ @@@@@@@@@@#: :#@@#: -@@@@@@@@@@@= +@@
-@@#====#@@@@@@@@#- .*@@@= -@@@@@@@@@@@= +@@
-@@@@@@@@@@@@@@%- .*@@@@# -@@@@@@@@@@@= +@@
-@@@@@@@@@@@@%= +@@@@@@# -@@@@@@@@@@@= +@@
-@@@@@@@@@@@+ =@@@@@@@@# -@@@@@@@@@@@= +@@
-@@@@@@@@@+. -%@@@@@@@@@# -@@@@@@@@@@@= +@@
-@@@@@@@*. -%@@@@@@@@@@@# -@@@@@@@@@@@= +@@
-@@@@@#: :#@@@@@@@@@@@@@# -@@@@@@@@@@@+ +@@
-@@@#: :#@@@@@@@@@@@@@@@# :@@@@@@@@@@@= +@@
-@@= :+*+++++++++++*%@@@. :+++++++++- %@@
-@@ :@@@%. .#@@@
-@@- :@@@@@+: .+@@@@@
-@@@#+===================+%@@@@@@@%*++=======++*%@@@@@@@
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-EOF
-
-echo_header $BLUE " DATABASE SETUP"
-
-PG_MAIN_VERSION=15
-PG_GRAPHQL_VERSION=1.4.2
-CARGO_PGRX_VERSION=0.9.8
-
-current_directory=$(pwd)
-
-# Install PostgresSQL
-echo_header $GREEN "Step [1/4]: Installing PostgreSQL..."
-
-brew reinstall postgresql@$PG_MAIN_VERSION
-
-# Install pg_graphql extensions
-echo_header $GREEN "Step [2/4]: Installing GraphQL for PostgreSQL..."
-
-# Uninstall existing Rust installation if found
-existing_rust_path=$(which rustc)
-if [ -n "$existing_rust_path" ]; then
- echo "Uninstalling existing Rust installation..."
- rm -rf "$existing_rust_path"
-fi
-
-# To force a reinstall of cargo-pgrx, pass --force to the command below
-curl https://sh.rustup.rs -sSf | sh
-source "$HOME/.cargo/env"
-cargo install --locked cargo-pgrx@$CARGO_PGRX_VERSION --force
-cargo pgrx init --pg$PG_MAIN_VERSION download
-
-# Create a temporary directory
-temp_dir=$(mktemp -d)
-cd "$temp_dir"
-pwd
-
-curl -LJO https://github.com/supabase/pg_graphql/archive/refs/tags/v$PG_GRAPHQL_VERSION.zip || handle_error "Failed to download pg_graphql package."
-
-unzip pg_graphql-$PG_GRAPHQL_VERSION.zip
-
-[[ ":$PATH:" != *":/usr/local/opt/postgresql@$PG_MAIN_VERSION/bin:"* ]] && PATH="/usr/local/opt/postgresql@$PG_MAIN_VERSION/bin:${PATH}"
-
-cd "pg_graphql-$PG_GRAPHQL_VERSION"
-cargo pgrx install --release --pg-config /usr/local/opt/postgresql@$PG_MAIN_VERSION/bin/pg_config
-
-# # Clean up the temporary directory
-echo "Cleaning up..."
-cd "$current_directory"
-
-echo "Build complete."
\ No newline at end of file
diff --git a/packages/twenty-postgres/docker/docker-compose.yml b/packages/twenty-postgres/docker/docker-compose.yml
new file mode 100644
index 00000000000..8db2c32d4e0
--- /dev/null
+++ b/packages/twenty-postgres/docker/docker-compose.yml
@@ -0,0 +1,17 @@
+version: "3.9"
+services:
+ postgres:
+ container_name: twenty_postgres
+ image: twentycrm/twenty-postgres:latest
+ volumes:
+ - twenty_db_data:/var/lib/postgresql/data
+ environment:
+ - POSTGRES_USER=postgres
+ - POSTGRES_PASSWORD=postgres
+ - POSTGRES_DB=default
+ ports:
+ - "5432:5432"
+volumes:
+ twenty_db_data:
+ name: twenty_db_data
+
diff --git a/packages/twenty-postgres/init.sql b/packages/twenty-postgres/init.sql
new file mode 100644
index 00000000000..16a4788af62
--- /dev/null
+++ b/packages/twenty-postgres/init.sql
@@ -0,0 +1,4 @@
+CREATE DATABASE "default";
+CREATE DATABASE "test";
+CREATE USER twenty PASSWORD 'twenty';
+ALTER ROLE twenty superuser;
diff --git a/packages/twenty-postgres/provision/provision-postgres-linux.sh b/packages/twenty-postgres/linux/provision-postgres-linux.sh
similarity index 100%
rename from packages/twenty-postgres/provision/provision-postgres-linux.sh
rename to packages/twenty-postgres/linux/provision-postgres-linux.sh
diff --git a/packages/twenty-postgres/build/pg_graphql/bin/pg_graphql--1.4.2.sql b/packages/twenty-postgres/macos/arm/15/pg_graphql/1.4.2/pg_graphql--1.4.2.sql
similarity index 100%
rename from packages/twenty-postgres/build/pg_graphql/bin/pg_graphql--1.4.2.sql
rename to packages/twenty-postgres/macos/arm/15/pg_graphql/1.4.2/pg_graphql--1.4.2.sql
diff --git a/packages/twenty-postgres/build/pg_graphql/bin/pg_graphql.control b/packages/twenty-postgres/macos/arm/15/pg_graphql/1.4.2/pg_graphql.control
similarity index 100%
rename from packages/twenty-postgres/build/pg_graphql/bin/pg_graphql.control
rename to packages/twenty-postgres/macos/arm/15/pg_graphql/1.4.2/pg_graphql.control
diff --git a/packages/twenty-postgres/build/pg_graphql/bin/pg_graphql.so b/packages/twenty-postgres/macos/arm/15/pg_graphql/1.4.2/pg_graphql.so
similarity index 100%
rename from packages/twenty-postgres/build/pg_graphql/bin/pg_graphql.so
rename to packages/twenty-postgres/macos/arm/15/pg_graphql/1.4.2/pg_graphql.so
diff --git a/packages/twenty-postgres/provision/provision-postgres-macos-arm.sh b/packages/twenty-postgres/macos/arm/build-postgres-macos-arm.sh
similarity index 100%
rename from packages/twenty-postgres/provision/provision-postgres-macos-arm.sh
rename to packages/twenty-postgres/macos/arm/build-postgres-macos-arm.sh
diff --git a/packages/twenty-postgres/macos/arm/provision-postgres-macos-arm.sh b/packages/twenty-postgres/macos/arm/provision-postgres-macos-arm.sh
new file mode 100755
index 00000000000..ea82926be12
--- /dev/null
+++ b/packages/twenty-postgres/macos/arm/provision-postgres-macos-arm.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+PG_MAIN_VERSION=15
+PG_GRAPHQL_VERSION=1.4.2
+
+current_directory=$(pwd)
+
+echo "Step [1/4]: Installing PostgreSQL..."
+brew reinstall postgresql@$PG_MAIN_VERSION
+
+echo "Step [2/4]: Installing GraphQL for PostgreSQL..."
+cp ./macos/arm/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql--${PG_GRAPHQL_VERSION}.sql \
+ /opt/homebrew/opt/postgresql@${PG_MAIN_VERSION}/share/postgresql@${PG_MAIN_VERSION}/extension
+cp ./macos/arm/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql.control \
+ /opt/homebrew/opt/postgresql@${PG_MAIN_VERSION}/share/postgresql@${PG_MAIN_VERSION}/extension
+cp ./macos/arm/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql.so \
+ /opt/homebrew/opt/postgresql@${PG_MAIN_VERSION}/lib/postgresql
+
+export PATH="/opt/homebrew/opt/postgresql@${PG_MAIN_VERSION}/bin:$PATH"
+
+echo "Step [3/4]: Starting PostgreSQL service..."
+brew services restart postgresql@15
+
+echo "Step [4/4]: Setting up database..."
+cp ./init.sql /tmp/init.sql
+sleep 5
+psql -f /tmp/init.sql -d postgres
diff --git a/packages/twenty-postgres/macos/intel/15/pg_graphql/1.3.0/pg_graphql--1.3.0.sql b/packages/twenty-postgres/macos/intel/15/pg_graphql/1.3.0/pg_graphql--1.3.0.sql
new file mode 100644
index 00000000000..7bafc8f7df5
--- /dev/null
+++ b/packages/twenty-postgres/macos/intel/15/pg_graphql/1.3.0/pg_graphql--1.3.0.sql
@@ -0,0 +1,116 @@
+/*
+This file is auto generated by pgrx.
+
+The ordering of items is not stable, it is driven by a dependency graph.
+*/
+
+-- src/lib.rs:26
+-- pg_graphql::_internal_resolve
+CREATE FUNCTION graphql."_internal_resolve"(
+ "query" TEXT, /* &str */
+ "variables" jsonb DEFAULT '{}', /* core::option::Option<pgrx::datum::json::JsonB> */
+ "operationName" TEXT DEFAULT null, /* core::option::Option<alloc::string::String> */
+ "extensions" jsonb DEFAULT null /* core::option::Option<pgrx::datum::json::JsonB> */
+) RETURNS jsonb /* pgrx::datum::json::JsonB */
+
+LANGUAGE c /* Rust */
+AS 'MODULE_PATHNAME', 'resolve_wrapper';
+
+-- src/lib.rs:19
+-- Is updated every time the schema changes
+create sequence if not exists graphql.seq_schema_version as int cycle;
+
+create or replace function graphql.increment_schema_version()
+ returns event_trigger
+ security definer
+ language plpgsql
+as $$
+begin
+ perform nextval('graphql.seq_schema_version');
+end;
+$$;
+
+create or replace function graphql.get_schema_version()
+ returns int
+ security definer
+ language sql
+as $$
+ select last_value from graphql.seq_schema_version;
+$$;
+
+-- On DDL event, increment the schema version number
+create event trigger graphql_watch_ddl
+ on ddl_command_end
+ execute procedure graphql.increment_schema_version();
+
+create event trigger graphql_watch_drop
+ on sql_drop
+ execute procedure graphql.increment_schema_version();
+
+
+-- src/lib.rs:20
+create function graphql.comment_directive(comment_ text)
+ returns jsonb
+ language sql
+ immutable
+as $$
+ /*
+ comment on column public.account.name is '@graphql.name: myField'
+ */
+ select
+ coalesce(
+ (
+ regexp_match(
+ comment_,
+ '@graphql\((.+?)\)'
+ )
+ )[1]::jsonb,
+ jsonb_build_object()
+ )
+$$;
+
+
+-- src/lib.rs:22
+-- requires:
+-- resolve
+
+create or replace function graphql.resolve(
+ "query" text,
+ "variables" jsonb default '{}',
+ "operationName" text default null,
+ "extensions" jsonb default null
+)
+ returns jsonb
+ language plpgsql
+as $$
+declare
+ res jsonb;
+ message_text text;
+begin
+ begin
+ select graphql._internal_resolve("query" := "query",
+ "variables" := "variables",
+ "operationName" := "operationName",
+ "extensions" := "extensions") into res;
+ return res;
+ exception
+ when others then
+ get stacked diagnostics message_text = message_text;
+ return
+ jsonb_build_object('data', null,
+ 'errors', jsonb_build_array(jsonb_build_object('message', message_text)));
+ end;
+end;
+$$;
+
+
+-- src/lib.rs:21
+create or replace function graphql.exception(message text)
+ returns text
+ language plpgsql
+as $$
+begin
+ raise exception using errcode='22000', message=message;
+end;
+$$;
+
diff --git a/packages/twenty-postgres/macos/intel/15/pg_graphql/1.3.0/pg_graphql.control b/packages/twenty-postgres/macos/intel/15/pg_graphql/1.3.0/pg_graphql.control
new file mode 100644
index 00000000000..f5edd6fc5b5
--- /dev/null
+++ b/packages/twenty-postgres/macos/intel/15/pg_graphql/1.3.0/pg_graphql.control
@@ -0,0 +1,6 @@
+comment = 'pg_graphql: GraphQL support'
+default_version = '1.3.0'
+module_pathname = '$libdir/pg_graphql'
+relocatable = false
+superuser = true
+schema = 'graphql'
diff --git a/packages/twenty-postgres/macos/intel/15/pg_graphql/1.3.0/pg_graphql.so b/packages/twenty-postgres/macos/intel/15/pg_graphql/1.3.0/pg_graphql.so
new file mode 100644
index 00000000000..319475bff74
Binary files /dev/null and b/packages/twenty-postgres/macos/intel/15/pg_graphql/1.3.0/pg_graphql.so differ
diff --git a/packages/twenty-postgres/provision/provision-postgres-macos-intel.sh b/packages/twenty-postgres/macos/intel/build-postgres-macos-intel.sh
similarity index 100%
rename from packages/twenty-postgres/provision/provision-postgres-macos-intel.sh
rename to packages/twenty-postgres/macos/intel/build-postgres-macos-intel.sh
diff --git a/packages/twenty-postgres/macos/intel/provision-postgres-macos-intel.sh b/packages/twenty-postgres/macos/intel/provision-postgres-macos-intel.sh
new file mode 100755
index 00000000000..6f80be5b8e7
--- /dev/null
+++ b/packages/twenty-postgres/macos/intel/provision-postgres-macos-intel.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+PG_MAIN_VERSION=15
+PG_GRAPHQL_VERSION=1.4.2
+
+current_directory=$(pwd)
+
+echo "Step [1/4]: Installing PostgreSQL..."
+brew reinstall postgresql@$PG_MAIN_VERSION
+
+echo "Step [2/4]: Installing GraphQL for PostgreSQL..."
+cp ./macos/arm/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql--${PG_GRAPHQL_VERSION}.sql \
+ /usr/local/opt/postgresql@${PG_MAIN_VERSION}/share/postgresql@${PG_MAIN_VERSION}/extension
+cp ./macos/arm/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql.control \
+ /usr/local/opt/postgresql@${PG_MAIN_VERSION}/share/postgresql@${PG_MAIN_VERSION}/extension
+cp ./macos/arm/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql.so \
+ /usr/local/opt/postgresql@${PG_MAIN_VERSION}/lib/postgresql
+
+export PATH="/usr/local/opt/postgresql@${PG_MAIN_VERSION}/bin:$PATH"
+
+echo "Step [3/4]: Starting PostgreSQL service..."
+brew services restart postgresql@15
+
+echo "Step [4/4]: Setting up database..."
+cp ./init.sql /tmp/init.sql
+sleep 5
+psql -f /tmp/init.sql -d postgres
diff --git a/packages/twenty-utils/release/build-front.sh b/packages/twenty-utils/release/build-front.sh
deleted file mode 100755
index c05ebe1554b..00000000000
--- a/packages/twenty-utils/release/build-front.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-
-docker buildx build \
---push \
---no-cache \
---platform linux/amd64,linux/arm64 \
--f ./infra/build/front/Dockerfile -t twentycrm/twenty-front:0.1.5 -t twentycrm/twenty-front:latest .
diff --git a/packages/twenty-utils/release/build-postgres.sh b/packages/twenty-utils/release/build-postgres.sh
deleted file mode 100755
index 57159e631ac..00000000000
--- a/packages/twenty-utils/release/build-postgres.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-
-docker buildx build \
---push \
---no-cache \
---platform linux/amd64,linux/arm64 \
--f ./infra/build/postgres/Dockerfile -t twentycrm/twenty-postgres:0.2.0 -t twentycrm/twenty-postgres:latest .
diff --git a/packages/twenty-utils/release/build-server.sh b/packages/twenty-utils/release/build-server.sh
deleted file mode 100755
index c98252fda30..00000000000
--- a/packages/twenty-utils/release/build-server.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-
-docker buildx build \
---push \
---no-cache \
---platform linux/amd64,linux/arm64 \
--f ./infra/build/server/Dockerfile -t twentycrm/twenty-server:0.1.5 -t twentycrm/twenty-server:latest .
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index 07ac07ded0d..86047ebd0da 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -18957,8 +18957,8 @@ __metadata:
"eslint-plugin-twenty@file:../eslint-plugin-twenty::locator=twenty-front%40workspace%3Apackages%2Ftwenty-front":
version: 1.0.3
- resolution: "eslint-plugin-twenty@file:../eslint-plugin-twenty#../eslint-plugin-twenty::hash=8c2438&locator=twenty-front%40workspace%3Apackages%2Ftwenty-front"
- checksum: f8fcae09e4d1434abf95a36a716f54772b42c84a3638fbcf53df745045bf336cf32016c02880ad3bc738fe1e1a4d68d7fe98917ec4fce7d4bf1a37ae39530ec2
+ resolution: "eslint-plugin-twenty@file:../eslint-plugin-twenty#../eslint-plugin-twenty::hash=755c0c&locator=twenty-front%40workspace%3Apackages%2Ftwenty-front"
+ checksum: 3687c4e0fc2b8bc991e9b5a3e9bffdf120cce6ca3f04a6abba5bd831ea178eb18eec20288c75a460d54b766e5d1b678ba5c1d528f721e33dc18fe0bffed15b68
languageName: node
linkType: hard