I replaced the server url in the test:
I replaced the server url in the test:
I'm not confortable with the
POSTGRES_ADMIN_PASSWORD
line without a password. I'm not familiar with this process. When is this password setup?
Is it OK to update it after launching the first docker compose? It might be better to setup a password automaticaly.
Maybe we could use this command to create a random password here:
40 Replies
Regarding the password, it's indeed a bit of an issue, but it's actually hardcoded for now in the postgres image, we could try to focus on that, or at least create an issue about it @charles
The database should be isolated as long as no port is exposed in the docker compose π
So this .env line is useless?
oh wait, I think i'm mistaking with something else, no you right, this one should be randomized !
it's the twenty:twenty user that is problematic
π Makes more sense. You could randomize twenty:twenty during the database initiation step, but I don't see any database init in your script ?
It's all in the postgres package
https://github.com/twentyhq/twenty/blob/main/packages/twenty-postgres/init.sql
GitHub
twenty/packages/twenty-postgres/init.sql at main Β· twentyhq/twenty
Building a modern alternative to Salesforce, powered by the community. - twentyhq/twenty
It's creating a superuser in order to be able to install pg extensions, it seems that the default root user created by bitnami as insuficient permisions
Regarding URL,
I added FRONT_BASE_URL in .env as I had this error:
The subtitution wasn't working ?
FRONT_BASE_URL: ${FRONT_BASE_URL:-$SERVER_URL}
In most configurations it should be the same as SERVER_URL, the only case where you would want it to differ is when you host the frontend on a bucket or some external service
Just to make sure, do you use docker compose
or docker-compose
, i have a hard time understanding how these behavior occurs on version similar to mine π³Nope it was not working.
I have
SERVER_URL=http://sgl.local:3000
FRONT_BASE_URL=http://sgl.local:3000
I used docker-compose
oh, can you run
docker-compose version
?iero@sgl:~/twenty$ docker compose version
Docker Compose version v2.25.0
and with
docker-compose
it's actually two different thingsSorry
iero@sgl:~/twenty$ docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.10.12
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022
I see now π
This one is one major behind π΅
Ok I try to update it
The new standard would be to use
docker compose
plugin instead of the standalone docker-compose
(i know it's twisted..), you could try to update the docker-compose https://docs.docker.com/compose/install/standalone/I bet most of the formating issues will be gone π
In the one-liner we actually use
docker compose
that's why it might have failed on reboot, I suppose we could print a warning message if both are installed on the system and that the major is not >=2OK
iero@sgl:~/twenty$ /usr/bin/docker-compose version
Docker Compose version v2.26.0
It should be a smoother experience π
It's strange, I have this error now..
I restart the script from scratch
The migration script is using a flag in the
/app/${STORAGE_LOCAL_PATH:-.local-storage}
path to know if it has seeded the database already, if it got interrupted before writting the flag on the disk you might get a few errors, I don't know if it's breaking anything thoughOK @Freebios I removed everything and started fro scratch. It works smoothly now.
So, maybe :
- check docker compose version before launching the steps
- Add a random password in .env POSTGRES_ADMIN_PASSWORD
- Ask for server name and propose localhost per default
- Use ${SERVER_URL} in healthcheck
To expose the server, I just have to expose the 3000 port? No 3001 port anymore?
Yes the frontend is served by the backend now π
Nice!
Use ${SERVER_URL} in healthcheckWas it testing your physical server localhost instead of container one ? It should be a local healthcheck to make sure the container is started, if i put ${SERVER_URL} and that the reverse proxy is not well configured, the healthcheck could fail for no apparent reason I could use the container dns
http://server:3000/healthz
if localhost was an issueIn fact it works, it just took time
Yeah the seeding might take time depending on your hardware, I could try to print server logs until it's ready so user sees that something is going on, or change the text for something like "Database initialization in progress, please be patient it can take a few minutes"
Yes it's a good idea
I will try to migrate my database and setup nginx with ssl to reach this server and I'm all good. Maybe the second part could be added in the script as well
@FΓ©lix What do you think? I would say that we could keep migration instructions in the documentation, like explaining how to load a database dump, but it could actually be usefull for people migrating their stack from one place to another to simply be able to inject an sql file without having to deal with docker volumes
there is an actual documentation page for that? I don't see anything in the twenty documentation website
I don't think it exists yet, but if you are looking for some leads to do it in your case in the mean time, i would say you would need to
docker compose exec -it db /bin/bash
do a pg_dump
and then docker compose cp ... ...
OK, I planned to expose the database and do a
pg_dump -U twenty -h server -p 5432 -F c default > db.tar
but I never tried yet to restore it afterwards. I will do soon
But good idea with exec. I have to expose the database as sometimes I have to manualy remove an action that broke the datamodelto restore, either expose it, or cp the dump into the container and then connect using postgres and redirect the dump file into the session
postgres -U twenty -h server -p 5432 < my_dump.sql
(something like that)not
pg_restore
?
I'll try it and confirmoh, try pg_restore first π
i got used to redirect by hand
Erk my actual database is in 0.3.2. I do need to launch some migrate commands, afterwards right?
I would say so yes
But I don't know twenty enough yet to tell you how π
Unknown Userβ’9mo ago
Message Not Public
Sign In & Join Server To View
OK I've tested the process and described the steps here:
https://discord.com/channels/1130383047699738754/1222855378224676894/1222855378224676894
If you have corrections/improvements, I will be happy to test
When in prod, I will do daily dump and regular restore to be sure I will not lose data.
Another use case is to work on local setup when I'm in a plane or in a remote area without internet connection.