T
Twenty9mo ago
paulyili

Yarn not in twenty-Server 0.3.3 (Docker)

I noticed the file size is 112.21 MB for 0.3.3 vs 0.3.2 of 320.31 MB I noticed this as i usually go into the Twenty-Server container a do the yarn database:reset to get things working. and this time i noticed that and npm wasn't installed is this suppose to be included or not?
12 Replies
charles
charles9mo ago
npm is not a must, yarn should be there on production containers the guideline is to use npx actually that's a good point though, I think some commands might not be working. We should have a set of commands for production containers (using npx) and some for dev that will use nx for performances / hot reloading
paulyili
paulyiliOP9mo ago
has anything changed with V 0.3.2 containers ? im consistently getting this when i run yarn database:reset with v0.3.1 & 0.3.2 This use to work all the time before 0.3.3 Failed to perform 'create extension pg_graphql': QueryFailedError: permission denied to create extension "pg_graphql" Performed 'create extension "uuid-ossp"' successfully Failed to perform 'create extension "postgres_fdw"': QueryFailedError: permission denied to create extension "postgres_fdw" Failed to perform 'create extension "wrappers"': QueryFailedError: permission denied for language c Failed to perform 'create extension "mysql_fdw"': QueryFailedError: permission denied to create extension "mysql_fdw" Failed to perform 'create airtable "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "airtable_fdw" Failed to perform 'create bigQuery "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "bigquery_fdw" Failed to perform 'create clickHouse "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "clickhouse_fdw" Failed to perform 'create firebase "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "firebase_fdw" Failed to perform 'create logflare "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "logflare_fdw" Failed to perform 'create s3 "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "s3_fdw" Failed to perform 'create stripe "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "stripe_fdw" Performed 'inflect names for graphql' successfully Failed to perform 'create function graphql': QueryFailedError: schema "graphql" does not exist basically, im having issues with 0.3.3 and i wanted to test a few things on 0.3.2 and now i can't get that to run with the docker compose file i've used at least 20 times.
charles
charles9mo ago
Hi @paulyili, I'm taking a look I suspect that the issue is not with the postgres container itself
charles
charles9mo ago
I'm merging https://github.com/twentyhq/twenty/pull/4644 that should clarify
GitHub
Update yarn commands by charlesBochet · Pull Request #4644 · twenty...
This PRs simplifies and clarifies the commands available for: local setup using nx. Always use: yarn nx <command> self hosting / production environment not using nx. Always use: yarn <com...
charles
charles8mo ago
and I'll try again that everything works @paulyili I've successfully setup a fresh Twenty 0.3.3 project using the latest containers
charles
charles8mo ago
charles
charles8mo ago
So, we should be good. From twenty-server container, here are the new command: - yarn database:init:prod
paulyili
paulyiliOP8mo ago
Do you mind sharing your .env and docker compose. Just want to compare to mine
charles
charles8mo ago
I've tried on render and on render we don't have a .env you can take a look at the render.yaml at the root of the repo I can help troubleshoot if you want What user are you using to connect to your database? Is it the twenty super user? (in your PG_DATABASE_URL)
paulyili
paulyiliOP8mo ago
@charles this is my docker-compose.yml (minus a few things)
version: "3.9"
services:
nginx:
image: nginx
ports:
- "3300:3300"
- "3301:3301"
volumes:
- ./nginx/twenty.conf:/etc/nginx/conf.d/twenty.conf:ro
environment:
- VIRTUAL_HOST=crm.mydomain.com,crmapi.mydomain.com
- VIRTUAL_PORT=3300
- VIRTUAL_PROTO=http
networks:
- twenty_frontend
- twenty_backend
- nginx_proxied
restart: always

twenty:
image: twentycrm/twenty-front:${TAG}
expose:
- 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:
# - backend
- db
networks:
- twenty_frontend
restart: always

backend:
image: twentycrm/twenty-server:${TAG}
expose:
- 3001
environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- PG_DATABASE_URL=${PG_DATABASE_URL}
- FRONT_BASE_URL=${FRONT_BASE_URL}
- PORT=${PORT}
- STORAGE_TYPE=local
- STORAGE_LOCAL_PATH=.local-storage
depends_on:
- db
networks:
- twenty_backend
restart: always

db:
container_name: db
image: twentycrm/twenty-postgres:${TAG}
volumes:
- twenty-db-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=default
networks:
- twenty_backend
restart: always

networks:
twenty_frontend: {}
twenty_backend: {}
nginx_proxied:
external: true

volumes:
twenty-db-data:
version: "3.9"
services:
nginx:
image: nginx
ports:
- "3300:3300"
- "3301:3301"
volumes:
- ./nginx/twenty.conf:/etc/nginx/conf.d/twenty.conf:ro
environment:
- VIRTUAL_HOST=crm.mydomain.com,crmapi.mydomain.com
- VIRTUAL_PORT=3300
- VIRTUAL_PROTO=http
networks:
- twenty_frontend
- twenty_backend
- nginx_proxied
restart: always

twenty:
image: twentycrm/twenty-front:${TAG}
expose:
- 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:
# - backend
- db
networks:
- twenty_frontend
restart: always

backend:
image: twentycrm/twenty-server:${TAG}
expose:
- 3001
environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- PG_DATABASE_URL=${PG_DATABASE_URL}
- FRONT_BASE_URL=${FRONT_BASE_URL}
- PORT=${PORT}
- STORAGE_TYPE=local
- STORAGE_LOCAL_PATH=.local-storage
depends_on:
- db
networks:
- twenty_backend
restart: always

db:
container_name: db
image: twentycrm/twenty-postgres:${TAG}
volumes:
- twenty-db-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=default
networks:
- twenty_backend
restart: always

networks:
twenty_frontend: {}
twenty_backend: {}
nginx_proxied:
external: true

volumes:
twenty-db-data:
this is the .env
TAG=latest

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

FRONT_BASE_URL=https://crm.mydomain.com
LOCAL_SERVER_URL=https://crm.mydomain.com
SERVER_URL=https://crm.mydomain.com

PORT=3001

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

API_TOKEN_EXPIRES_IN=1000y

EMAIL_FROM_NAME=Admin
EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=465
EMAIL_SMTP_PASSWORD=secret
PASSWORD_RESET_TOKEN_EXPIRES_IN=5m
EMAIL_DRIVER=smtp
MESSAGING_PROVIDER_GMAIL_ENABLED=true
AUTH_GOOGLE_ENABLED=true
AUTH_GOOGLE_CLIENT_ID=secret
AUTH_GOOGLE_CLIENT_SECRET=secret
FRONT_AUTH_CALLBACK_URL=https://crm.mydomain.com/verify
AUTH_GOOGLE_CALLBACK_URL=https://crm.mydomain.com/auth/google/redirect
MESSAGING_PROVIDER_GMAIL_CALLBACK_URL=https://crm.mydomain.com/auth/google-gmail/get-access-token
IS_SIGN_UP_DISABLED=false

# Database
POSTGRES_USER=twenty
POSTGRES_PASSWORD=twenty
POSTGRES_ADMIN_PASSWORD=twenty
TAG=latest

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

FRONT_BASE_URL=https://crm.mydomain.com
LOCAL_SERVER_URL=https://crm.mydomain.com
SERVER_URL=https://crm.mydomain.com

PORT=3001

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

API_TOKEN_EXPIRES_IN=1000y

EMAIL_FROM_NAME=Admin
EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=465
EMAIL_SMTP_PASSWORD=secret
PASSWORD_RESET_TOKEN_EXPIRES_IN=5m
EMAIL_DRIVER=smtp
MESSAGING_PROVIDER_GMAIL_ENABLED=true
AUTH_GOOGLE_ENABLED=true
AUTH_GOOGLE_CLIENT_ID=secret
AUTH_GOOGLE_CLIENT_SECRET=secret
FRONT_AUTH_CALLBACK_URL=https://crm.mydomain.com/verify
AUTH_GOOGLE_CALLBACK_URL=https://crm.mydomain.com/auth/google/redirect
MESSAGING_PROVIDER_GMAIL_CALLBACK_URL=https://crm.mydomain.com/auth/google-gmail/get-access-token
IS_SIGN_UP_DISABLED=false

# Database
POSTGRES_USER=twenty
POSTGRES_PASSWORD=twenty
POSTGRES_ADMIN_PASSWORD=twenty
when i ran yarn database:init:prod i get this: Failed to perform 'create extension pg_graphql': QueryFailedError: permission denied to create extension "pg_graphql" Performed 'create extension "uuid-ossp"' successfully Failed to perform 'create extension "postgres_fdw"': QueryFailedError: permission denied to create extension "postgres_fdw" Failed to perform 'create extension "wrappers"': QueryFailedError: permission denied for language c Failed to perform 'create extension "mysql_fdw"': QueryFailedError: permission denied to create extension "mysql_fdw" Failed to perform 'create airtable "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "airtable_fdw" Failed to perform 'create bigQuery "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "bigquery_fdw" Failed to perform 'create clickHouse "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "clickhouse_fdw" Failed to perform 'create firebase "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "firebase_fdw" Failed to perform 'create logflare "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "logflare_fdw" Failed to perform 'create s3 "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "s3_fdw" Failed to perform 'create stripe "wrappers"': QueryFailedError: permission denied to create foreign-data wrapper "stripe_fdw" Performed 'inflect names for graphql' successfully Failed to perform 'create function graphql': QueryFailedError: schema "graphql" does not exist But this i can log in and it throws erros like this Error during useFindManyRecords for "activities", QueryFailedError since you mentioned the twenty super user for the db, i have this feeling im not using it now
charles
charles8mo ago
ok, could you ssh into your docker container and check if the postgres pg_graphql extension is present in: /opt/bitnami/postgresql/share/extension/ ? Mmh no actually the issue is that you should keep: POSTGRES_USER=postgres and not POSTGRES_USER=twenty POSTGRES_USER is used by postgresql container to start the server. It's not a super user. If you put twenty, then it will be confused between twenty super user and this startup user I think you should see errors in your postgres container docker logs saying that user already exist or something like this
paulyili
paulyiliOP8mo ago
Bingo. that worked. 2nd set of eyes really does help! @charles BTW that docker-compose.yml & .env is a great baseline to get a production containers running if want it running though a reverse proxy.
Want results from more Discord servers?
Add your server