Incepter
Incepter

Reputation: 2968

How to re-deploy springboot application without down time

I have limited resources so I can't set complete microservices architecture with docker & kubernetes, and my app is being used continuously bu users.

I have to re-deploy my app for each new release/hot-fix, do you know how can I achieve that with minimal down time?

Information about my app:

I thought about this solution:

Is there anyone who faced this problem before ? or any thought how to achieve it?

Thank you in advance.

Upvotes: 1

Views: 2350

Answers (1)

Heuriskos
Heuriskos

Reputation: 532

Ask the person who runs the corporate nginx proxy to load balance between two instances of your application, e.g. one running on 8080 and one on 8081. You can then update your applications one at a time. You might also need to externalise certain things, e.g. running any session management on a separate host, instead of relying on the in-memory session handling.

upstream production {
    server 123.456.789:8080;
    server 123.456.789:8081;
}

server {
    listen 80;
    server_name some.host;
    location / {
        proxy_pass http://production;
    }
}

https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/

You'll need to be able to dynamically configure Spring Boot's server port to make the application listen on separate ports. Alternatively, you could also make them run on separate hosts.

Upvotes: 6

Related Questions