Is it possible to host two different applications like ASP.NET Core (C#) and SpringBoot (Java) side by side in a droplet?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi there,
Yes, this is totally doable. What I would personally do here would be to use Docker. That way your apps will be isolated and you will not have to install all of the dependencies on your server directly but you would only run your containers.
You can start with the Docker 1-Click image from the Marketplace here:
Then if your apps are not Dockerized yet, you could do that by following these steps here:
For your ASP.NET Core app:
Publish your ASP.NET Core application:
Create a
Dockerfile
in the root of your ASP.NET Core project:For your your SpringBoot application, if it runs as a JAR, create a
Dockerfile
in the root of your SpringBoot project:Then you can build your Docker images and start your containers on your Droplet.
Navigate to each project’s directory and build the Docker images:
Now, you can run each application in its own Docker container:
Your ASP.NET Core application should be accessible at
http://your_droplet_ip:8080
and your SpringBoot application athttp://your_droplet_ip:9090
.Next, you can add Nginx to work as a reverse proxy so you don’t have to specify your ports.
A few things that you could consider are:
Docker Compose: If you plan to run multiple containers frequently, consider using Docker Compose. It allows you to define and manage multi-container Docker applications.
Data Persistence: If your applications need to store data, consider volume mapping to ensure data persistence outside of the container.
Manage Resources: Be mindful of your Droplet’s resources (CPU, memory). Running multiple applications, especially on a small droplet, can consume resources quickly.
The main benefit again is that each application runs in its isolated environment, ensuring that dependencies and configurations don’t conflict.
Hope that this helps!
Best,
Bobby