How do I connect to the postgres db deployed on fly?
I deployed my aspp using wasp deploy fly deploy and i want to see the data in the db, how can I do that?
4 Replies
Hi @linus. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To connect to your PostgreSQL database deployed on Fly, you can follow these steps:
1. Open a tunnel to your Fly production database using the
fly proxy
command. Replace <db-name>
with the name of your database:
Keep this terminal tab running and open a new terminal tab for future commands.
2. Get your database name and password. You can get the database name by running:
and then typing:
You'll find your database name there. By convention, it should be server_name_with_underscores
.
To get the database password, run:
then
3. Set the database URL in your .env.server
file to point to your production database. Replace <password>
and <db_name>
with your actual database password and name:
For example:
4. Now you should be connected to your production database. Be careful with the commands you execute since you're connected to the production database. You can test the connection by running wasp db studio
. If it connects, the connection works.
5. After you're done, remember to remove the DATABASE_URL
from the local .env.server
and close the tunnel.
For more details, you can refer to this Github issue (https://github.com/wasp-lang/wasp/issues/1464) which provides a detailed workflow on how to seed a production database on Fly.
Please note that you should be careful when interacting with your production database to avoid accidentally modifying or deleting important data.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @linus, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?I don't have a DATABASE_URL set up in the .env.server file, do i need one for production?
Wohooo @linus, you just became a Waspeteer level 1!
Check this out https://github.com/wasp-lang/learning-materials?tab=readme-ov-file#running-wasp-db-studio-on-production-db it should provide all the details!
GitHub
GitHub - wasp-lang/learning-materials: A place to collect some usef...
A place to collect some useful learning materials for Wasp - wasp-lang/learning-materials