From a9d395be66429a98cc0d77475ed1bc9ec03e3ce5 Mon Sep 17 00:00:00 2001 From: Lucifer4255 Date: Thu, 28 Nov 2024 15:54:51 +0000 Subject: [PATCH 1/2] Updated website docs and /twenty-server/.env --- packages/twenty-server/.env.example | 2 +- .../twenty-website/src/content/developers/local-setup.mdx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/twenty-server/.env.example b/packages/twenty-server/.env.example index 034db517715f..5384eb365bf8 100644 --- a/packages/twenty-server/.env.example +++ b/packages/twenty-server/.env.example @@ -1,5 +1,5 @@ # Use this for local setup -PG_DATABASE_URL=postgres://postgres:twenty@localhost:5432/default +PG_DATABASE_URL=postgres://postgres:postgres@localhost:5432/default REDIS_URL=redis://localhost:6379 FRONT_BASE_URL=http://localhost:3001 diff --git a/packages/twenty-website/src/content/developers/local-setup.mdx b/packages/twenty-website/src/content/developers/local-setup.mdx index ad6c2e8eba64..f31f7edeac84 100644 --- a/packages/twenty-website/src/content/developers/local-setup.mdx +++ b/packages/twenty-website/src/content/developers/local-setup.mdx @@ -109,7 +109,7 @@ You should run all commands in the following steps from the root of the project. Option 1 (preferred): To provision your database locally: Use the following link to install Postgresql on your Linux machine: [Postgresql Installation](https://www.postgresql.org/download/linux/) ```bash - psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" -c "CREATE USER twenty PASSWORD 'twenty';" -c "ALTER ROLE twenty superuser;" + psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" ``` Note: You might need to add `sudo -u postgres` to the command before `psql` to avoid permission errors. @@ -124,7 +124,7 @@ You should run all commands in the following steps from the root of the project. ```bash brew install postgresql@16 export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH" - psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" -c "CREATE USER twenty PASSWORD 'twenty';" -c "ALTER ROLE twenty superuser;" + psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" ``` Option 2: If you have docker installed: @@ -138,7 +138,7 @@ You should run all commands in the following steps from the root of the project. Option 1: To provision your Postgresql locally: Use the following link to install Postgresql on your Linux virtual machine: [Postgresql Installation](https://www.postgresql.org/download/linux/) ```bash - psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" -c "CREATE USER twenty PASSWORD 'twenty';" -c "ALTER ROLE twenty superuser;" + psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" ``` Note: You might need to add `sudo -u postgres` to the command before `psql` to avoid permission errors. From b11f91761f61ac314a0ef815cfbce32753e1fd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Malfait?= Date: Fri, 29 Nov 2024 11:05:45 +0100 Subject: [PATCH 2/2] Replace everywhere --- .github/workflows/ci-server.yaml | 8 ++++---- .github/workflows/ci-website.yaml | 8 ++++---- Makefile | 6 +++--- packages/twenty-docker/docker-compose.yml | 6 +++--- packages/twenty-docker/k8s/manifests/deployment-db.yaml | 2 +- .../twenty-docker/k8s/manifests/deployment-server.yaml | 2 +- .../twenty-docker/k8s/manifests/deployment-worker.yaml | 2 +- packages/twenty-e2e-testing/drivers/env_variables.ts | 2 +- packages/twenty-server/.env.test | 2 +- packages/twenty-server/scripts/render-run.sh | 2 +- packages/twenty-server/scripts/render-worker.sh | 2 +- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci-server.yaml b/.github/workflows/ci-server.yaml index 06b141303583..82540a48a40c 100644 --- a/.github/workflows/ci-server.yaml +++ b/.github/workflows/ci-server.yaml @@ -21,7 +21,7 @@ jobs: image: twentycrm/twenty-postgres-spilo env: PGUSER_SUPERUSER: postgres - PGPASSWORD_SUPERUSER: twenty + PGPASSWORD_SUPERUSER: postgres ALLOW_NOSSL: "true" SPILO_PROVIDER: "local" ports: @@ -73,8 +73,8 @@ jobs: - name: Server / Create DB if: steps.changed-files.outputs.any_changed == 'true' run: | - PGPASSWORD=twenty psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "default";' - PGPASSWORD=twenty psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "test";' + PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "default";' + PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "test";' - name: Worker / Run if: steps.changed-files.outputs.any_changed == 'true' run: npx nx run twenty-server:worker:ci @@ -124,7 +124,7 @@ jobs: image: twentycrm/twenty-postgres-spilo env: PGUSER_SUPERUSER: postgres - PGPASSWORD_SUPERUSER: twenty + PGPASSWORD_SUPERUSER: postgres ALLOW_NOSSL: "true" SPILO_PROVIDER: "local" ports: diff --git a/.github/workflows/ci-website.yaml b/.github/workflows/ci-website.yaml index 0f87078849f4..ed5247a487c5 100644 --- a/.github/workflows/ci-website.yaml +++ b/.github/workflows/ci-website.yaml @@ -20,7 +20,7 @@ jobs: image: twentycrm/twenty-postgres-spilo env: PGUSER_SUPERUSER: postgres - PGPASSWORD_SUPERUSER: twenty + PGPASSWORD_SUPERUSER: postgres ALLOW_NOSSL: "true" SPILO_PROVIDER: "local" ports: @@ -46,18 +46,18 @@ jobs: - name: Server / Create DB if: steps.changed-files.outputs.any_changed == 'true' - run: PGPASSWORD=twenty psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "default";' + run: PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "default";' - name: Website / Run migrations if: steps.changed-files.outputs.changed == 'true' run: npx nx database:migrate twenty-website env: - DATABASE_PG_URL: postgres://postgres:twenty@localhost:5432/default + DATABASE_PG_URL: postgres://postgres:postgres@localhost:5432/default - name: Website / Build Website if: steps.changed-files.outputs.changed == 'true' run: npx nx build twenty-website env: - DATABASE_PG_URL: postgres://postgres:twenty@localhost:5432/default + DATABASE_PG_URL: postgres://postgres:postgres@localhost:5432/default - name: Mark as VALID if: steps.changed-files.outputs.changed != 'true' # If no changes, mark as valid diff --git a/Makefile b/Makefile index 3b115523d1f9..ee4fb9ce59ff 100644 --- a/Makefile +++ b/Makefile @@ -2,17 +2,17 @@ postgres-on-docker: docker run -d \ --name twenty_pg \ -e PGUSER_SUPERUSER=postgres \ - -e PGPASSWORD_SUPERUSER=twenty \ + -e PGPASSWORD_SUPERUSER=postgres \ -e ALLOW_NOSSL=true \ -v twenty_db_data:/home/postgres/pgdata \ -p 5432:5432 \ twentycrm/twenty-postgres-spilo:latest @echo "Waiting for PostgreSQL to be ready..." - @until PGPASSWORD=twenty psql -h localhost -p 5432 -U postgres -d postgres \ + @until PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres \ -c 'SELECT pg_is_in_recovery();' 2>/dev/null | grep -q 'f'; do \ sleep 1; \ done - PGPASSWORD=twenty psql -h localhost -p 5432 -U postgres -d postgres \ + PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres \ -c "CREATE DATABASE \"default\" WITH OWNER postgres;" \ -c "CREATE DATABASE \"test\" WITH OWNER postgres;" diff --git a/packages/twenty-docker/docker-compose.yml b/packages/twenty-docker/docker-compose.yml index e44ee876c4c3..2dcb01eebb24 100644 --- a/packages/twenty-docker/docker-compose.yml +++ b/packages/twenty-docker/docker-compose.yml @@ -22,7 +22,7 @@ services: - "3000:3000" environment: PORT: 3000 - PG_DATABASE_URL: postgres://${PGUSER_SUPERUSER:-postgres}:${PGPASSWORD_SUPERUSER:-twenty}@${PG_DATABASE_HOST:-db:5432}/default + PG_DATABASE_URL: postgres://${PGUSER_SUPERUSER:-postgres}:${PGPASSWORD_SUPERUSER:-postgres}@${PG_DATABASE_HOST:-db:5432}/default SERVER_URL: ${SERVER_URL} FRONT_BASE_URL: ${FRONT_BASE_URL:-$SERVER_URL} REDIS_URL: ${REDIS_URL:-redis://redis:6379} @@ -52,7 +52,7 @@ services: image: twentycrm/twenty:${TAG} command: ["yarn", "worker:prod"] environment: - PG_DATABASE_URL: postgres://${PGUSER_SUPERUSER:-postgres}:${PGPASSWORD_SUPERUSER:-twenty}@${PG_DATABASE_HOST:-db:5432}/default + PG_DATABASE_URL: postgres://${PGUSER_SUPERUSER:-postgres}:${PGPASSWORD_SUPERUSER:-postgres}@${PG_DATABASE_HOST:-db:5432}/default SERVER_URL: ${SERVER_URL} FRONT_BASE_URL: ${FRONT_BASE_URL:-$SERVER_URL} REDIS_URL: ${REDIS_URL:-redis://redis:6379} @@ -78,7 +78,7 @@ services: - db-data:/home/postgres/pgdata environment: PGUSER_SUPERUSER: ${PGUSER_SUPERUSER:-postgres} - PGPASSWORD_SUPERUSER: ${PGPASSWORD_SUPERUSER:-twenty} + PGPASSWORD_SUPERUSER: ${PGPASSWORD_SUPERUSER:-postgres} ALLOW_NOSSL: "true" SPILO_PROVIDER: "local" healthcheck: diff --git a/packages/twenty-docker/k8s/manifests/deployment-db.yaml b/packages/twenty-docker/k8s/manifests/deployment-db.yaml index 4cfe13912b5a..02a97c31bcfd 100644 --- a/packages/twenty-docker/k8s/manifests/deployment-db.yaml +++ b/packages/twenty-docker/k8s/manifests/deployment-db.yaml @@ -33,7 +33,7 @@ spec: - name: PGUSER_SUPERUSER value: "postgres" - name: PGPASSWORD_SUPERUSER - value: "twenty" + value: "postgres" ports: - containerPort: 5432 name: tcp diff --git a/packages/twenty-docker/k8s/manifests/deployment-server.yaml b/packages/twenty-docker/k8s/manifests/deployment-server.yaml index cd3ad4aa7fdd..5c79044211e8 100644 --- a/packages/twenty-docker/k8s/manifests/deployment-server.yaml +++ b/packages/twenty-docker/k8s/manifests/deployment-server.yaml @@ -40,7 +40,7 @@ spec: - name: FRONT_BASE_URL value: "https://crm.example.com:443" - name: "PG_DATABASE_URL" - value: "postgres://postgres:twenty@twenty-db.twentycrm.svc.cluster.local/default" + value: "postgres://postgres:postgres@twenty-db.twentycrm.svc.cluster.local/default" - name: "REDIS_URL" value: "redis://twentycrm-redis.twentycrm.svc.cluster.local:6379" - name: ENABLE_DB_MIGRATIONS diff --git a/packages/twenty-docker/k8s/manifests/deployment-worker.yaml b/packages/twenty-docker/k8s/manifests/deployment-worker.yaml index 281652dbbc3a..a92ef25062af 100644 --- a/packages/twenty-docker/k8s/manifests/deployment-worker.yaml +++ b/packages/twenty-docker/k8s/manifests/deployment-worker.yaml @@ -31,7 +31,7 @@ spec: - name: FRONT_BASE_URL value: "https://crm.example.com:443" - name: PG_DATABASE_URL - value: "postgres://postgres:twenty@twenty-db.twentycrm.svc.cluster.local/default" + value: "postgres://postgres:postgres@twenty-db.twentycrm.svc.cluster.local/default" - name: ENABLE_DB_MIGRATIONS value: "false" # it already runs on the server - name: STORAGE_TYPE diff --git a/packages/twenty-e2e-testing/drivers/env_variables.ts b/packages/twenty-e2e-testing/drivers/env_variables.ts index 07ba4f6334b8..7fd2860cb68b 100644 --- a/packages/twenty-e2e-testing/drivers/env_variables.ts +++ b/packages/twenty-e2e-testing/drivers/env_variables.ts @@ -3,7 +3,7 @@ import path from 'path'; export const envVariables = (variables: string) => { let payload = ` - PG_DATABASE_URL=postgres://postgres:twenty@localhost:5432/default + PG_DATABASE_URL=postgres://postgres:postgres@localhost:5432/default FRONT_BASE_URL=http://localhost:3001 ACCESS_TOKEN_SECRET=replace_me_with_a_random_string_access LOGIN_TOKEN_SECRET=replace_me_with_a_random_string_login diff --git a/packages/twenty-server/.env.test b/packages/twenty-server/.env.test index ac0225eacd38..b0ba4b8c3d70 100644 --- a/packages/twenty-server/.env.test +++ b/packages/twenty-server/.env.test @@ -1,4 +1,4 @@ -PG_DATABASE_URL=postgres://postgres:twenty@localhost:5432/test +PG_DATABASE_URL=postgres://postgres:postgres@localhost:5432/test REDIS_URL=redis://localhost:6379 DEBUG_MODE=true diff --git a/packages/twenty-server/scripts/render-run.sh b/packages/twenty-server/scripts/render-run.sh index 813f9e20ff83..e3b12fde915f 100755 --- a/packages/twenty-server/scripts/render-run.sh +++ b/packages/twenty-server/scripts/render-run.sh @@ -1,4 +1,4 @@ #!/bin/sh -export PG_DATABASE_URL=postgres://postgres:twenty@$PG_DATABASE_HOST:$PG_DATABASE_PORT/default +export PG_DATABASE_URL=postgres://postgres:postgres@$PG_DATABASE_HOST:$PG_DATABASE_PORT/default yarn database:init:prod node dist/src/main diff --git a/packages/twenty-server/scripts/render-worker.sh b/packages/twenty-server/scripts/render-worker.sh index 25f259e41724..55565d7f9340 100755 --- a/packages/twenty-server/scripts/render-worker.sh +++ b/packages/twenty-server/scripts/render-worker.sh @@ -1,3 +1,3 @@ #!/bin/sh -export PG_DATABASE_URL=postgres://postgres:twenty@$PG_DATABASE_HOST:$PG_DATABASE_PORT/default +export PG_DATABASE_URL=postgres://postgres:postgres@$PG_DATABASE_HOST:$PG_DATABASE_PORT/default node dist/src/queue-worker/queue-worker