Fix docker install (#2925)

* Fix docker install

* Move back twenty-eslint-plugin to eslint-plugin-twenty

* fix: add bundled yarn

* Improve makeifle structure

* Update commands and doc

* Add pg_graphql binaries

* Fix

---------

Co-authored-by: Jérémy Magrin <jeremy.magrin@gmail.com>
This commit is contained in:
Charles Bochet 2023-12-11 13:36:24 +01:00 committed by GitHub
parent 44ef218fa5
commit 8d53c63801
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 1328 additions and 116 deletions

View File

@ -25,12 +25,12 @@ jobs:
path: front/node_modules
key: front-node_modules-${{hashFiles('front/yarn.lock')}}
restore-keys: front-node_modules-
- name: Cache twenty-eslint-plugin node modules
- name: Cache eslint-plugin-twenty node modules
uses: actions/cache@v3
with:
path: packages/twenty-eslint-plugin/node_modules
key: twenty-eslint-plugin-node_modules-${{hashFiles('packages/twenty-eslint-plugin/yarn.lock')}}
restore-keys: twenty-eslint-plugin-node_modules-
path: packages/eslint-plugin-twenty/node_modules
key: eslint-plugin-twenty-node_modules-${{hashFiles('packages/eslint-plugin-twenty/yarn.lock')}}
restore-keys: eslint-plugin-twenty-node_modules-
- name: Front / Install Dependencies
run: cd front && yarn
front-pages-sb-test:
@ -58,12 +58,12 @@ jobs:
path: front/node_modules
key: front-node_modules-${{hashFiles('front/yarn.lock')}}
restore-keys: front-node_modules-
- name: Cache twenty-eslint-plugin node modules
- name: Cache eslint-plugin-twenty node modules
uses: actions/cache@v3
with:
path: packages/twenty-eslint-plugin/node_modules
key: twenty-eslint-plugin-node_modules-${{hashFiles('packages/twenty-eslint-plugin/yarn.lock')}}
restore-keys: twenty-eslint-plugin-node_modules-
path: packages/eslint-plugin-twenty/node_modules
key: eslint-plugin-twenty-node_modules-${{hashFiles('packages/eslint-plugin-twenty/yarn.lock')}}
restore-keys: eslint-plugin-twenty-node_modules-
- name: Install dependencies
run: yarn
- name: Install Playwright
@ -100,12 +100,12 @@ jobs:
path: front/node_modules
key: front-node_modules-${{hashFiles('front/yarn.lock')}}
restore-keys: front-node_modules-
- name: Cache twenty-eslint-plugin node modules
- name: Cache eslint-plugin-twenty node modules
uses: actions/cache@v3
with:
path: packages/twenty-eslint-plugin/node_modules
key: twenty-eslint-plugin-node_modules-${{hashFiles('packages/twenty-eslint-plugin/yarn.lock')}}
restore-keys: twenty-eslint-plugin-node_modules-
path: packages/eslint-plugin-twenty/node_modules
key: eslint-plugin-twenty-node_modules-${{hashFiles('packages/eslint-plugin-twenty/yarn.lock')}}
restore-keys: eslint-plugin-twenty-node_modules-
- name: Install Playwright
run: cd front && npx playwright install
- name: Build Storybook
@ -136,12 +136,12 @@ jobs:
path: front/node_modules
key: front-node_modules-${{hashFiles('front/yarn.lock')}}
restore-keys: front-node_modules-
- name: Cache twenty-eslint-plugin node modules
- name: Cache eslint-plugin-twenty node modules
uses: actions/cache@v3
with:
path: packages/twenty-eslint-plugin/node_modules
key: twenty-eslint-plugin-node_modules-${{hashFiles('packages/twenty-eslint-plugin/yarn.lock')}}
restore-keys: twenty-eslint-plugin-node_modules-
path: packages/eslint-plugin-twenty/node_modules
key: eslint-plugin-twenty-node_modules-${{hashFiles('packages/eslint-plugin-twenty/yarn.lock')}}
restore-keys: eslint-plugin-twenty-node_modules-
- name: Front / Install Dependencies
run: cd front && yarn
- name: Front / Run linter
@ -167,11 +167,11 @@ jobs:
path: front/node_modules
key: front-node_modules-${{hashFiles('front/yarn.lock')}}
restore-keys: front-node_modules-
- name: Cache twenty-eslint-plugin node modules
- name: Cache eslint-plugin-twenty node modules
uses: actions/cache@v3
with:
path: packages/twenty-eslint-plugin/node_modules
key: twenty-eslint-plugin-node_modules-${{hashFiles('packages/twenty-eslint-plugin/yarn.lock')}}
restore-keys: twenty-eslint-plugin-node_modules-
path: packages/eslint-plugin-twenty/node_modules
key: eslint-plugin-twenty-node_modules-${{hashFiles('packages/eslint-plugin-twenty/yarn.lock')}}
restore-keys: eslint-plugin-twenty-node_modules-
- name: Front / Run jest
run: cd front && yarn test

893
.yarn/releases/yarn-4.0.2.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,5 @@
enableInlineHunks: true
nodeLinker: node-modules
enableInlineHunks: true
yarnPath: .yarn/releases/yarn-4.0.2.cjs

23
Makefile Normal file
View File

@ -0,0 +1,23 @@
docker-dev-build:
make -C packages/twenty-docker dev-build
docker-dev-up:
make -C packages/twenty-docker dev-up
docker-dev-down:
make -C packages/twenty-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-provision-on-macos-arm:
make -C packages/twenty-postgres provision-on-macos-arm
postgres-provision-on-macos-intel:
make -C packages/twenty-postgres provision-on-macos-intel
postgres-provision-on-linux:
make -C packages/twenty-postgres provision-on-linux

View File

@ -10,7 +10,7 @@
"license": "AGPL-3.0",
"workspaces": {
"packages": [
"packages/twenty-eslint-plugin",
"packages/eslint-plugin-twenty",
"packages/twenty-front",
"packages/twenty-docs",
"packages/twenty-server"

View File

@ -1,5 +1,5 @@
{
"name": "twenty-eslint-plugin",
"name": "eslint-plugin-twenty",
"version": "1.0.3",
"description": "",
"main": "dist/index.js",

View File

@ -17,16 +17,7 @@ dev-down:
dev-sh:
@docker compose -f dev/docker-compose.yml exec twenty-dev sh
dev-front-start:
@docker compose -f dev/docker-compose.yml exec twenty-dev sh -c "cd /app/packages/twenty-front && yarn run start"
dev-server-start:
@docker compose -f dev/docker-compose.yml exec twenty-dev sh -c "yarn nx run twenty-server:start:dev"
dev-server-database-init:
@docker compose -f dev/docker-compose.yml exec twenty-dev sh -c "yarn nx run twenty-server:database:init"
dev-build-postgres:
dev-postgres-build:
@docker stop twenty_postgres || true
@docker rm twenty_postgres || true
@docker volume rm twenty_db_data || true

View File

@ -11,7 +11,7 @@ services:
volumes:
- ../../../packages/twenty-front:/app/packages/twenty-front
- ../../../packages/twenty-server:/app/packages/twenty-server
- ../../../packages/twenty-eslint-plugin:/app/packages/twenty-eslint-plugin
- ../../../packages/eslint-plugin-twenty:/app/packages/eslint-plugin-twenty
- twenty_dev_node_modules_root:/app/node_modules
- twenty_dev_node_modules_yarn:/app/.yarn
- twenty_dev_node_modules_front:/app/packages/twenty-front/node_modules

View File

@ -4,12 +4,12 @@ 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-eslint-plugin/package.json /app/packages/twenty-eslint-plugin/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 corepack enable
RUN yarn set version 4.0.2
RUN yarn
RUN npx playwright install-deps

View File

@ -5,9 +5,9 @@ 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 set version 4.0.2
RUN yarn
WORKDIR /app/packages/twenty-docs

View File

@ -66,7 +66,7 @@ The default values should work out of the box, except for the postgres URL, whic
Open `./packages/twenty-server/.env` and change to the following:
```bash
PG_DATABASE_URL=postgres://twenty:twenty@postgres:5432/default?connection_limit=1
PG_DATABASE_URL=postgres://twenty:twenty@postgres:5432/default
```
@ -77,7 +77,7 @@ This installation method will also provision a PostgreSQL container.
```bash
make -C packages/twenty-docker dev-build
make docker-dev-build
```
## Step 4: Migrate & seed
@ -86,12 +86,13 @@ Before running the project, you need to initialize the database by running the m
Start the containers:
```bash
make -C packages/twenty-docker dev-up
make docker-dev-up
```
Setup database, run migrations, and seed:
```bash
make -C packages/twenty-docker dev-server-database-init
make docker-dev-sh
yarn nx database:init twenty-server
```
## Step 5: Start Twenty
@ -99,11 +100,13 @@ make -C packages/twenty-docker dev-server-database-init
Run the project with the following commands from the `root` folder:
```bash
make -C packages/twenty-docker dev-server-start
make docker-dev-sh
yarn nx start:dev twenty-server
```
```bash
make -C packages/twenty-docker dev-front-start
make docker-dev-sh
yarn nx start twenty-front
```
You should now have:
@ -113,18 +116,6 @@ You should now have:
Sign in using a seeded demo account `tim@apple.dev` (password: `Applecar2025`) to start using Twenty.
### Optional
If you don't want to use the `make` command and work directly from the container, you can also ssh directly into the container:
```bash
make -C packages/twenty-docker dev-sh
```
Then run commands through yarn and nx:
```bash
yarn nx run twenty-server:database:init
```
### Troubleshooting

View File

@ -37,7 +37,7 @@ twenty
└───twenty-front // contains the frontend code for the application
└───twenty-server // contains the backend code for the application
└───twenty-docker // contains docker configurations for development and production build
└───many other packages your are invited to discover such as twenty-docs, twenty-ui, twenty-eslint-plugin, twenty-zapier...
└───many other packages your are invited to discover such as twenty-docs, twenty-ui, eslint-plugin-twenty, twenty-zapier...
```
## IDE Setup

View File

@ -118,14 +118,14 @@ You need to provision this database with a `twenty` user (password: `twenty`), a
<br /><br />
```bash
make provision-postgres-linux
make postgres-provision-on-linux
```
<b>Option 2:</b> If you have docker installed:
<br /><br />
```bash
make provision-postgres-docker
make postgres-provision-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`)
@ -136,15 +136,15 @@ You can access this using `twenty` postgres user (password: `twenty`)
<br /><br />
```bash
make provision-postgres-macos-intel #for intel architecture
make provision-postgres-macos-arm #for M1/M2/M3 architecture
make postgres-provision-on-macos-intel #for intel architecture
make postgres-provision-on-macos-arm #for M1/M2/M3 architecture
```
<b>Option 2:</b> If you have docker installed:
<br /><br />
```bash
make provision-postgres-docker
make postgres-provision-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`)
@ -183,9 +183,7 @@ Use `nvm` to install the correct `node` version. The `.nvmrc` ensures all contri
To build Twenty server and seed some data into your database, run the following commands:
```bash
nvm install #recommended
nvm use #recommended
corepack enable #to enable yarn if you haven't done it yet
yarn set version stable #to set the yarn version to yarn version 4
nvm use #recommended
yarn
```
@ -194,14 +192,13 @@ yarn
Setup your database with the following command:
```bash
yarn nx run twenty-server:database:init
yarn nx database:init twenty-server
```
Start the server and the frontend:
```bash
yarn nx run twenty-server:database:init
yarn nx run twenty-server:start:dev
yarn nx run twenty-front:dev
yarn nx start:dev twenty-server
yarn nx start twenty-front
```
Twenty's server will be up and running at [http://localhost:3000/graphql](http://localhost:3000/graphql).

View File

@ -9,7 +9,7 @@
"build": "tsc && vite build && yarn build:inject-runtime-env",
"build:inject-runtime-env": "./scripts/inject-runtime-env.sh",
"preview": "vite preview",
"eslint-plugin:setup": "cd ../packages/twenty-eslint-plugin/ && yarn && yarn build && cd ../../front/ && yarn upgrade twenty-eslint-plugin",
"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",
"fmt:fix": "prettier --cache --write \"src/**/*.ts\" \"src/**/*.tsx\"",
"fmt": "prettier --check \"src/**/*.ts\" \"src/**/*.tsx\"",
@ -140,6 +140,7 @@
"eslint-plugin-react-refresh": "^0.4.4",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-twenty": "file:../eslint-plugin-twenty",
"eslint-plugin-unused-imports": "^3.0.0",
"http-server": "^14.1.1",
"jest": "29.7.0",
@ -150,7 +151,6 @@
"storybook": "^7.6.3",
"storybook-addon-cookie": "^3.1.0",
"storybook-addon-pseudo-states": "^2.1.2",
"twenty-eslint-plugin": "file:../twenty-eslint-plugin",
"typescript": "^5.2.2",
"vite": "^5.0.0",
"vite-plugin-svgr": "^4.2.0"

View File

@ -1,8 +1,14 @@
provision-postgres-macos-arm:
sh ./scripts/setup-postgres-macos-arm.sh
provision-on-macos-arm:
sh ./provision/setup-postgres-macos-arm.sh
provision-postgres-macos-intel:
sh ./scripts/setup-postgres-macos-intel.sh
provision-on-macos-intel:
sh ./provision/setup-postgres-macos-intel.sh
provision-postgres-linux:
sh ./scripts/setup-postgres-linux.sh
provision-on-linux:
sh ./provision/setup-postgres-linux.sh
build-pg_graphql-macos-arm:
sh ./build/pg_graphql/build-pg_graphql-macos-arm.sh
build-pg_graphql-macos-intel:
sh ./build/pg_graphql/build-pg_graphql-macos-intel.sh

View File

@ -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: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: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:21
create or replace function graphql.exception(message text)
returns text
language plpgsql
as $$
begin
raise exception using errcode='22000', message=message;
end;
$$;
-- 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();

View File

@ -0,0 +1,6 @@
comment = 'pg_graphql: GraphQL support'
default_version = '1.4.2'
module_pathname = '$libdir/pg_graphql'
relocatable = false
superuser = true
schema = 'graphql'

Binary file not shown.

View File

@ -0,0 +1,95 @@
#!/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."

View File

@ -0,0 +1,95 @@
#!/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."

View File

@ -1,7 +1,7 @@
# Use this for local setup
PG_DATABASE_URL=postgres://twenty:twenty@localhost:5432/default
# Use this for docker setup
# PG_DATABASE_URL=postgres://twenty:twenty@postgres:5432/default?connection_limit=1
# PG_DATABASE_URL=postgres://twenty:twenty@postgres:5432/default
FRONT_BASE_URL=http://localhost:3001
ACCESS_TOKEN_SECRET=replace_me_with_a_random_string_access

View File

@ -1,4 +0,0 @@
{
"javascript.preferences.importModuleSpecifier": "non-relative",
"typescript.preferences.importModuleSpecifier": "non-relative"
}

View File

@ -18955,6 +18955,39 @@ __metadata:
languageName: node
linkType: hard
"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
languageName: node
linkType: hard
"eslint-plugin-twenty@workspace:packages/eslint-plugin-twenty":
version: 0.0.0-use.local
resolution: "eslint-plugin-twenty@workspace:packages/eslint-plugin-twenty"
dependencies:
"@types/jest": "npm:^29.5.4"
"@typescript-eslint/eslint-plugin": "npm:^6.7.0"
"@typescript-eslint/parser": "npm:^6.7.0"
"@typescript-eslint/rule-tester": "npm:^6.7.0"
"@typescript-eslint/utils": "npm:^6.7.0"
eslint: "npm:^8.49.0"
eslint-config-prettier: "npm:^9.0.0"
eslint-config-standard-with-typescript: "npm:^39.0.0"
eslint-plugin-import: "npm:^2.28.1"
eslint-plugin-prefer-arrow: "npm:^1.2.3"
eslint-plugin-prettier: "npm:^5.0.0"
eslint-plugin-simple-import-sort: "npm:^10.0.0"
eslint-plugin-unused-imports: "npm:^3.0.0"
jest: "npm:^28.1.3"
postcss: "npm:^8.4.29"
prettier: "npm:^3.0.3"
ts-jest: "npm:^29.1.1"
ts-node: "npm:^10.9.1"
typescript: "npm:^5.2.2"
languageName: unknown
linkType: soft
"eslint-plugin-unused-imports@npm:^3.0.0":
version: 3.0.0
resolution: "eslint-plugin-unused-imports@npm:3.0.0"
@ -33915,39 +33948,6 @@ __metadata:
languageName: unknown
linkType: soft
"twenty-eslint-plugin@file:../twenty-eslint-plugin::locator=twenty-front%40workspace%3Apackages%2Ftwenty-front":
version: 1.0.3
resolution: "twenty-eslint-plugin@file:../twenty-eslint-plugin#../twenty-eslint-plugin::hash=028e48&locator=twenty-front%40workspace%3Apackages%2Ftwenty-front"
checksum: 4a97c00ebdc4c6c474acdf1994441c89936f82490122ec5d2018a87543b230fa3a64853e5a9aff37ab0cc33a029a6c5e4375a9f79faf9d9da976e484c7b4540d
languageName: node
linkType: hard
"twenty-eslint-plugin@workspace:packages/twenty-eslint-plugin":
version: 0.0.0-use.local
resolution: "twenty-eslint-plugin@workspace:packages/twenty-eslint-plugin"
dependencies:
"@types/jest": "npm:^29.5.4"
"@typescript-eslint/eslint-plugin": "npm:^6.7.0"
"@typescript-eslint/parser": "npm:^6.7.0"
"@typescript-eslint/rule-tester": "npm:^6.7.0"
"@typescript-eslint/utils": "npm:^6.7.0"
eslint: "npm:^8.49.0"
eslint-config-prettier: "npm:^9.0.0"
eslint-config-standard-with-typescript: "npm:^39.0.0"
eslint-plugin-import: "npm:^2.28.1"
eslint-plugin-prefer-arrow: "npm:^1.2.3"
eslint-plugin-prettier: "npm:^5.0.0"
eslint-plugin-simple-import-sort: "npm:^10.0.0"
eslint-plugin-unused-imports: "npm:^3.0.0"
jest: "npm:^28.1.3"
postcss: "npm:^8.4.29"
prettier: "npm:^3.0.3"
ts-jest: "npm:^29.1.1"
ts-node: "npm:^10.9.1"
typescript: "npm:^5.2.2"
languageName: unknown
linkType: soft
"twenty-front@workspace:packages/twenty-front":
version: 0.0.0-use.local
resolution: "twenty-front@workspace:packages/twenty-front"
@ -34021,6 +34021,7 @@ __metadata:
eslint-plugin-react-refresh: "npm:^0.4.4"
eslint-plugin-simple-import-sort: "npm:^10.0.0"
eslint-plugin-storybook: "npm:^0.6.15"
eslint-plugin-twenty: "file:../eslint-plugin-twenty"
eslint-plugin-unused-imports: "npm:^3.0.0"
framer-motion: "npm:^10.12.17"
graphql: "npm:^16.6.0"
@ -34062,7 +34063,6 @@ __metadata:
storybook-addon-cookie: "npm:^3.1.0"
storybook-addon-pseudo-states: "npm:^2.1.2"
ts-key-enum: "npm:^2.0.12"
twenty-eslint-plugin: "file:../twenty-eslint-plugin"
type-fest: "npm:^4.1.0"
typescript: "npm:^5.2.2"
uuid: "npm:^9.0.0"