Question

How to deploy spring boot project with mongodb database in digitalocean.

Hi,

I want to deploy my spring boot rest api project , where i used mongodb database,

(1) I created a droplet, (2) then installed java, (3) install tomcat server, (4) installed mongodb server.

then, I generated a war file, and deployed, but it says false.

before generate war file, i have changed my application.properties mongodb configuration.

#for localhost

#spring.data.mongodb.host=localhost
#spring.data.mongodb.port=27017
#spring.data.mongodb.database=MultiVendor

#for droplet [I used it for deploy]

spring.data.mongodb.host=206.1**.1**.1**
spring.data.mongodb.port=27017
spring.data.mongodb.database=mvdb

when I run this applicaton in intellij idea with droplet host, port, console shows Your localhost (206.1.1*.1**) is not a loopback adress We can NOT send shutdown to mongod, because it is denied from remote.***

also u can check my war file name, it autometically named multivendorshop-0.0.1-SNAPSHOT.war and pom.xml file

<groupId>com.cyclicsoft</groupId>
<artifactId>multivendorshop</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>multivendorshop</name>
<description>Multiventor Rest API</description>

once i have faced a problem, i rename a war file ROOT, it showed false in deployment. is any problem with maven install?

I stucked with this deployment problem last couple of days, please help me.


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there,

If your Java application and the MongoDB service are running on the same server, then you could still use localhost for the MongoDB host in your application properties file. This should fix the error that you are getting.

If you have two different servers for your database and your application, then you would need to configure MongoDB to accept remote connections. You can do that by following the steps here:

https://www.digitalocean.com/community/tutorials/how-to-configure-remote-access-for-mongodb-on-ubuntu-20-04

Hope that this helps! Regards, Bobby