Cannot access Twenty

I setup a standalone local server using an old Mac mini with ubuntu. So I installed everything using Docker method. Here is my .env:
TAG=latest

PG_DATABASE_URL=postgres://twenty:twenty@twenty-db:5432/default

FRONT_BASE_URL=http://localhost:3001
LOCAL_SERVER_URL=http://localhost:3000

ACCESS_TOKEN_SECRET=PWD1
LOGIN_TOKEN_SECRET=PWD2
REFRESH_TOKEN_SECRET=PWD3
FILE_TOKEN_SECRET=PWD4
SIGN_IN_PREFILLED=false

POSTGRES_ADMIN_PASSWORD=PWD5
POSTGRES_USER=postgres
POSTGRES_PASSWORD=twenty

SERVER_URL=https://sgl.local
TAG=latest

PG_DATABASE_URL=postgres://twenty:twenty@twenty-db:5432/default

FRONT_BASE_URL=http://localhost:3001
LOCAL_SERVER_URL=http://localhost:3000

ACCESS_TOKEN_SECRET=PWD1
LOGIN_TOKEN_SECRET=PWD2
REFRESH_TOKEN_SECRET=PWD3
FILE_TOKEN_SECRET=PWD4
SIGN_IN_PREFILLED=false

POSTGRES_ADMIN_PASSWORD=PWD5
POSTGRES_USER=postgres
POSTGRES_PASSWORD=twenty

SERVER_URL=https://sgl.local
And my compose.yaml;
version: "3.9"
services:

twenty-front:
image: twentycrm/twenty-front:${TAG}
ports:
- 3001:3001
environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- REACT_APP_SERVER_BASE_URL=${LOCAL_SERVER_URL}
- REACT_APP_SERVER_AUTH_URL=${LOCAL_SERVER_URL}/auth
- REACT_APP_SERVER_FILES_URL=${LOCAL_SERVER_URL}/files
depends_on:
- twenty-back

twenty-back:
image: twentycrm/twenty-server:${TAG}
ports:
- 3000:3000
environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- PG_DATABASE_URL=${PG_DATABASE_URL}
- FRONT_BASE_URL=${FRONT_BASE_URL}
- PORT=3000
- STORAGE_TYPE=local
- STORAGE_LOCAL_PATH=.local-storage
- ACCESS_TOKEN_SECRET=${ACCESS_TOKEN_SECRET}
- LOGIN_TOKEN_SECRET=${LOGIN_TOKEN_SECRET}
- REFRESH_TOKEN_SECRET=${REFRESH_TOKEN_SECRET}
#- SERVER_URL=${SERVER_URL}
depends_on:
- twenty-db

twenty-db:
image: twentycrm/twenty-postgres:${TAG}
volumes:
- twenty-db-data:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRESQL_DB=default

volumes:
twenty-db-data:
version: "3.9"
services:

twenty-front:
image: twentycrm/twenty-front:${TAG}
ports:
- 3001:3001
environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- REACT_APP_SERVER_BASE_URL=${LOCAL_SERVER_URL}
- REACT_APP_SERVER_AUTH_URL=${LOCAL_SERVER_URL}/auth
- REACT_APP_SERVER_FILES_URL=${LOCAL_SERVER_URL}/files
depends_on:
- twenty-back

twenty-back:
image: twentycrm/twenty-server:${TAG}
ports:
- 3000:3000
environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- PG_DATABASE_URL=${PG_DATABASE_URL}
- FRONT_BASE_URL=${FRONT_BASE_URL}
- PORT=3000
- STORAGE_TYPE=local
- STORAGE_LOCAL_PATH=.local-storage
- ACCESS_TOKEN_SECRET=${ACCESS_TOKEN_SECRET}
- LOGIN_TOKEN_SECRET=${LOGIN_TOKEN_SECRET}
- REFRESH_TOKEN_SECRET=${REFRESH_TOKEN_SECRET}
#- SERVER_URL=${SERVER_URL}
depends_on:
- twenty-db

twenty-db:
image: twentycrm/twenty-postgres:${TAG}
volumes:
- twenty-db-data:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRESQL_DB=default

volumes:
twenty-db-data:
Note that I updated twenty-front part with ports: 3001:3001 instead of 3001:3000.
21 Replies
greg [iero]
greg [iero]OP10mo ago
Everything starts fine :
iero@sgl:~/Twenty$ docker-compose up --build -d
Starting twenty_twenty-db_1 ... done
Starting 7eabe2f68bb3_twenty_twenty-back_1 ... done
Starting d7f4a30bd7be_twenty_twenty-front_1 ... done
iero@sgl:~/Twenty$ docker-compose up --build -d
Starting twenty_twenty-db_1 ... done
Starting 7eabe2f68bb3_twenty_twenty-back_1 ... done
Starting d7f4a30bd7be_twenty_twenty-front_1 ... done
No error in the logs. I initiated the database and I can access using 'sgl.local:5432 ' But I cannot access the frontend ("Safari can't open the page").
iero@sgl:~/Twenty$ curl http://localhost:3001
curl: (56) Recv failure: Connection reset by peer
iero@sgl:~/Twenty$ curl http://localhost:3001
curl: (56) Recv failure: Connection reset by peer
Any idea how I can solve this? I suspect I have to use something else than "localhost" in .env but I'm not sure
charles
charles10mo ago
if you ssh into the container and do curl on localhost:3001?
greg [iero]
greg [iero]OP10mo ago
From server container: Connexion refused
iero@sgl:~/Twenty$ docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------------------------------------------
7eabe2f68bb3_twenty_twenty-back_1 docker-entrypoint.sh node ... Up 0.0.0.0:3000->3000/tcp,:::3000->3000/tcp
d7f4a30bd7be_twenty_twenty-front_1 docker-entrypoint.sh /bin/ ... Up 0.0.0.0:3001->3001/tcp,:::3001->3001/tcp
twenty_twenty-db_1 /opt/bitnami/scripts/postg ... Up 0.0.0.0:5432->5432/tcp,:::5432->5432/tcp
iero@sgl:~/Twenty$ docker exec -it 7eabe2f68bb3_twenty_twenty-back_1 sh
/app/packages/twenty-server # curl http://localhost:3001
sh: curl: not found
/app/packages/twenty-server # wget http://localhost:3001
Connecting to localhost:3001 ([::1]:3001)
wget: can't connect to remote host: Connection refused
/app/packages/twenty-server #
iero@sgl:~/Twenty$ docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------------------------------------------
7eabe2f68bb3_twenty_twenty-back_1 docker-entrypoint.sh node ... Up 0.0.0.0:3000->3000/tcp,:::3000->3000/tcp
d7f4a30bd7be_twenty_twenty-front_1 docker-entrypoint.sh /bin/ ... Up 0.0.0.0:3001->3001/tcp,:::3001->3001/tcp
twenty_twenty-db_1 /opt/bitnami/scripts/postg ... Up 0.0.0.0:5432->5432/tcp,:::5432->5432/tcp
iero@sgl:~/Twenty$ docker exec -it 7eabe2f68bb3_twenty_twenty-back_1 sh
/app/packages/twenty-server # curl http://localhost:3001
sh: curl: not found
/app/packages/twenty-server # wget http://localhost:3001
Connecting to localhost:3001 ([::1]:3001)
wget: can't connect to remote host: Connection refused
/app/packages/twenty-server #
Same from front docker
charles
charles10mo ago
can you shouw me the front container logs?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
charles
charles10mo ago
yes, sorry my bad, I thought you were setting up the project to contribute (which is running on port 3001) good that you solved the issue 🙂
greg [iero]
greg [iero]OP10mo ago
Thanks for the confirmation that I need 3001:3000. I updated and relaunch but frontend crashes :
ERROR: for d7f4a30bd7be_twenty_twenty-front_1 'ContainerConfig'

ERROR: for twenty-front 'ContainerConfig'
ERROR: for d7f4a30bd7be_twenty_twenty-front_1 'ContainerConfig'

ERROR: for twenty-front 'ContainerConfig'
Complete logs in file
greg [iero]
greg [iero]OP10mo ago
Here is my updated compose.yaml ` version: "3.9" services: twenty-front: image: twentycrm/twenty-front:${TAG} ports: - 3001:3000 environment: - SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED} - REACT_APP_SERVER_BASE_URL=${LOCAL_SERVER_URL} - REACT_APP_SERVER_AUTH_URL=${LOCAL_SERVER_URL}/auth - REACT_APP_SERVER_FILES_URL=${LOCAL_SERVER_URL}/files depends_on: - twenty-back twenty-back: image: twentycrm/twenty-server:${TAG} ports: - 3000:3000 environment: - SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED} - PG_DATABASE_URL=${PG_DATABASE_URL} - FRONT_BASE_URL=${FRONT_BASE_URL} - PORT=3000 - STORAGE_TYPE=local - STORAGE_LOCAL_PATH=.local-storage - ACCESS_TOKEN_SECRET=${ACCESS_TOKEN_SECRET} - LOGIN_TOKEN_SECRET=${LOGIN_TOKEN_SECRET} - REFRESH_TOKEN_SECRET=${REFRESH_TOKEN_SECRET} #- SERVER_URL=${SERVER_URL} depends_on: - twenty-db twenty-db: image: twentycrm/twenty-postgres:${TAG} volumes: - twenty-db-data:/var/lib/postgresql/data ports: - 5432:5432 environment: - POSTGRESQL_USER=${POSTGRES_USER} - POSTGRESQL_PASSWORD=${POSTGRES_PASSWORD} - POSTGRESQL_DB=default volumes: twenty-db-data:
greg [iero]
greg [iero]OP10mo ago
Ok I destroyed all containers/volume and setup everything. It's better, I can access the front, but cannot login I've done a "yarn database:init:prod"' from server
No description
Tom Ebeyer
Tom Ebeyer10mo ago
check your console/network and look for the graphql request
greg [iero]
greg [iero]OP10mo ago
You're right
[Error] Could not connect to the server.
[Error] Fetch API cannot load http://localhost:3000/graphql due to access control checks.
[Error] Failed to load resource: Could not connect to the server. (graphql, line 0)
[Error] Could not connect to the server.
[Error] Could not connect to the server.
[Error] Fetch API cannot load http://localhost:3000/graphql due to access control checks.
[Error] Failed to load resource: Could not connect to the server. (graphql, line 0)
[Error] Could not connect to the server.
Tom Ebeyer
Tom Ebeyer10mo ago
I've got a similar error I'm working through. mine is at backend:3000/graphql but I don't have that set anywhere. Even renamed in docker-compose to be sure but still have the error
greg [iero]
greg [iero]OP10mo ago
Ok I updated "localhost" with my local server name in .env file I relaunched everything. No error, but when I try to sign in with a new email and click in "Continue" nothing append I was wondering if I have to reset the database, so I tried yarn nx from server docker but it doesnt find nx
iero@sgl:~/Twenty$ docker exec -it 7509f8e421bf sh
/app/packages/twenty-server # yarn nx database:init twenty-server
node:internal/modules/cjs/loader:1080
throw err;
^

Error: Cannot find module '/app/node_modules/nx/bin/nx.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Node.js v18.17.1
iero@sgl:~/Twenty$ docker exec -it 7509f8e421bf sh
/app/packages/twenty-server # yarn nx database:init twenty-server
node:internal/modules/cjs/loader:1080
throw err;
^

Error: Cannot find module '/app/node_modules/nx/bin/nx.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Node.js v18.17.1
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
greg [iero]
greg [iero]OP10mo ago
Thanks, I already succeeded to setup a docker install on my laptop. But cannot reproduce it 😄 Before a "yarn database:reset" command worked, but not anymore :
/app/packages/twenty-server # yarn database:reset
Usage Error: Couldn't find a script named "database:reset".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] [--require #0] <scriptName> ...
/app/packages/twenty-server # yarn database:reset
Usage Error: Couldn't find a script named "database:reset".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] [--require #0] <scriptName> ...
Tom Ebeyer
Tom Ebeyer10mo ago
looks nice but that docker image isn't published image: twentycrm/twenty:${TAG}
greg [iero]
greg [iero]OP10mo ago
Ok I run:
yarn database:init:prod
yarn database:migrate:prod
yarn database:init:prod
yarn database:migrate:prod
And it worked
Tom Ebeyer
Tom Ebeyer10mo ago
can you share your compose and env?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
charles
charles10mo ago
We are releasing new docker-compose one 1 liner install very soon, it might help 🙂 It should simplify the install!
greg [iero]
greg [iero]OP10mo ago
Here it is : .env:
TAG=latest

PG_DATABASE_URL=postgres://twenty:twenty@twenty-db:5432/default

FRONT_BASE_URL=http://server.local:3001
LOCAL_SERVER_URL=http://server.local:3000

ACCESS_TOKEN_SECRET=PWD1
LOGIN_TOKEN_SECRET=PWD2
REFRESH_TOKEN_SECRET=PWD3
FILE_TOKEN_SECRET=PWD4
SIGN_IN_PREFILLED=false

POSTGRES_ADMIN_PASSWORD=PWD5
POSTGRES_USER=postgres
POSTGRES_PASSWORD=twenty
TAG=latest

PG_DATABASE_URL=postgres://twenty:twenty@twenty-db:5432/default

FRONT_BASE_URL=http://server.local:3001
LOCAL_SERVER_URL=http://server.local:3000

ACCESS_TOKEN_SECRET=PWD1
LOGIN_TOKEN_SECRET=PWD2
REFRESH_TOKEN_SECRET=PWD3
FILE_TOKEN_SECRET=PWD4
SIGN_IN_PREFILLED=false

POSTGRES_ADMIN_PASSWORD=PWD5
POSTGRES_USER=postgres
POSTGRES_PASSWORD=twenty
compose.yaml:
version: "3.9"
services:

twenty-front:
image: twentycrm/twenty-front:${TAG}
ports:
- 3001:3000
environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- REACT_APP_SERVER_BASE_URL=${LOCAL_SERVER_URL}
- REACT_APP_SERVER_AUTH_URL=${LOCAL_SERVER_URL}/auth
- REACT_APP_SERVER_FILES_URL=${LOCAL_SERVER_URL}/files
depends_on:
- twenty-back

twenty-back:
image: twentycrm/twenty-server:${TAG}
ports:
- 3000:3000
environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- PG_DATABASE_URL=${PG_DATABASE_URL}
- FRONT_BASE_URL=${FRONT_BASE_URL}
- PORT=3000
- STORAGE_TYPE=local
- STORAGE_LOCAL_PATH=.local-storage
- ACCESS_TOKEN_SECRET=${ACCESS_TOKEN_SECRET}
- LOGIN_TOKEN_SECRET=${LOGIN_TOKEN_SECRET}
- REFRESH_TOKEN_SECRET=${REFRESH_TOKEN_SECRET}
depends_on:
- twenty-db

twenty-db:
image: twentycrm/twenty-postgres:${TAG}
volumes:
- twenty-db-data:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRESQL_DB=default

volumes:
twenty-db-data:
version: "3.9"
services:

twenty-front:
image: twentycrm/twenty-front:${TAG}
ports:
- 3001:3000
environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- REACT_APP_SERVER_BASE_URL=${LOCAL_SERVER_URL}
- REACT_APP_SERVER_AUTH_URL=${LOCAL_SERVER_URL}/auth
- REACT_APP_SERVER_FILES_URL=${LOCAL_SERVER_URL}/files
depends_on:
- twenty-back

twenty-back:
image: twentycrm/twenty-server:${TAG}
ports:
- 3000:3000
environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- PG_DATABASE_URL=${PG_DATABASE_URL}
- FRONT_BASE_URL=${FRONT_BASE_URL}
- PORT=3000
- STORAGE_TYPE=local
- STORAGE_LOCAL_PATH=.local-storage
- ACCESS_TOKEN_SECRET=${ACCESS_TOKEN_SECRET}
- LOGIN_TOKEN_SECRET=${LOGIN_TOKEN_SECRET}
- REFRESH_TOKEN_SECRET=${REFRESH_TOKEN_SECRET}
depends_on:
- twenty-db

twenty-db:
image: twentycrm/twenty-postgres:${TAG}
volumes:
- twenty-db-data:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRESQL_DB=default

volumes:
twenty-db-data:
Great, I would love to test it on my server when ready 👍
Want results from more Discord servers?
Add your server