-
-
Notifications
You must be signed in to change notification settings - Fork 892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connecting Next.js with server actions to database with Internal Connection URL #507
Comments
@Siumauricio Do you have any suggestions on how to fix this problem? |
I think I also face this issue, so if this is not intentional then it is a huge bug :( |
The error is normal to happen, one way to solve it is to use an internal network so that the services can communicate, I know nixpacks has an open issue railwayapp/nixpacks#1057, I do not know if heroku has an option to pass a custom network, the only way to solve that could be using your own custom Dockerfile |
@Siumauricio how do you setup an internal network for the app and database to communicate? I don't see anything in Dokploy or the documentation about it |
Still no solution @joshfester, the only way is to expose the database to the internet, I have to add some way to pass a custom command to the dockerfile, since nixpacks or heroku doesn't accept custom networks. |
Thanks @Siumauricio , would you expect it to work with a Dockerfile or maybe Docker Compose? |
docker/buildx#175 and moby/buildkit#978 I think there is no optimal way, according to what I investigated is that you can not specify a network because of buildkit, buildkit uses many caching features, secrets, the only way to solve this problem is disabling DOCKER_BUILDKIT=0 and adding a network flag to the dockerfile builder, because heroku and nixpacks doesn't support networks, but we will lose all those features, at the moment there is no optimal solution, so the only way is exposing the database, I have been trying with Dockerfile, but the problem is what I said above @joshfester I think it is more a limitation of docker than of dokploy itself, since dokploy is a very fine wrapper over docker. |
@Siumauricio And from your perspective, do you view the exposure of the database as a major security breach or not? Would you recommend going into production with such a database? In comparison with, for example, the Neon project, which allows connection to their remote databases in the same way, everything tells me that this is not a problem, but I would like to hear your opinion. |
IMO it is less secure, yes, but I do not consider it as a major breach. There are many companies that sell PostgresQL as a service, and after paying them, they provide us nothing more than a database URL. |
I agree with @sangdth , it is less secure as it does not use any encryption, only the security of the database password. I think implementing encryption to the database I think would be more secure. |
I've managed to do it by exposing the database through some port and accessing it with the VPS public IP. For security, I blocked that port with the firewall, so no one could access it from outside. Also, it would be nice if something could be implemented with railwayapp/nixpacks#1119 |
Actually that's a very good idea, good solution! @JuanM04 |
I’m not sure if this could be a solution, but I connected two services within the project by linking them to an external Docker network. I manually created the Docker network on the VPS with Perhaps a good feature would be to allow the creation of external networks within Dokploy that are completely separate from any stack. These networks could then be reusable for other services as needed. Just saying it maybe could be like interesting idea. I am new to Dokploy, so maybe I am missing something. Note: None of the services are publicly accessible except through the Traefik reverse proxy. |
Thanks for the suggestion. It seems to be working with less configuration and settings. |
Looks like the nixpack PR has been merged, although some caveats to note: In short, using |
Any updates on this ? So It's an issue with the buildpack ? |
Any updates on this one? I’m facing the same issue and I don’t want to expose the db publicly. |
To Reproduce
After I created the Next application and deployed it to Dokploy and connected to the Dokploy database (PostgreSQL), communication works if I connect via an external connection string, but when I change that connection string to internal in the environment, then the build of Next application crashes.
Current vs. Expected behavior
I expect to have a connection to the database through internal communication on the server and not through the Internet. I see internet connect to databse as a huge security flaw.
Provide environment information
Which area(s) are affected? (Select all that apply)
Application, Docker Compose, Docker
Additional context
I'll pass the repository of an example Next application that accesses the database. It is necessary to set the environment variable in the Dokploy to the database for access. Varaible name: DATABASE_URL
https://github.com/milanpanin/test-dokploy
The text was updated successfully, but these errors were encountered: