aws / aws/elastic-beanstalk-roadmap

Automatic restart of tomcat like it was on AL1

Open
#263 8 comments 2 reactions 0 assignees View on GitHub
Proposed
Dominant language
No language data
Stars
283
Forks
11
PR merge metrics
No merged PRs in 30d

Description

### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request.
* Please do not leave "+1" or "me too" comments. They generate extra noise for issue followers and do not help prioritize the request.

**Tell us about your request**
Since migration from AL1 to AL2 we have lost the automatic restart of Tomcat service in case of crash.
Previously when tomcat crashes, it was auto-restarted by monit. This is no longer the case in AL2.

**Is this request specific to an Elastic Beanstalk [platform](https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html)?**
Yes - Tomcat

**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
When tomcat crashes, the application is no longer available. Beanstalk console shows a simple message: "Tomcat service not started"

**Are you currently working around this issue?**
I tried to add "Restart=always" in file /etc/systemd/system/tomcat.service.d/tomcat.conf using .ebextensions, but unfortunately there is no hook between the configuration file creation and the start of tomcat

**Additional context**
With linux 1 we had file /etc/monit.d/monit-tomcat8.conf with content

```
# Beanstalk Supported

# http support
set daemon 30
set httpd port 2812 and
use address localhost
allow localhost

#tomcat
check process tomcat with pidfile /var/run/tomcat8.pid
start program = "/etc/init.d/tomcat8 start"
stop program = "/etc/init.d/tomcat8 stop"
```

Now with AL2 we have /etc/systemd/system/tomcat.service.d/tomcat.conf with content

```
[Unit]
PartOf=aws-eb.target

[Service]
ExecStartPost=/bin/sh -c "systemctl show -p MainPID tomcat.service | cut -d= -f2 > /var/pids/tomcat.pid"
ExecStopPost=/bin/sh -c "rm -f /var/pids/tomcat.pid"
```

We should add this line in this file to enable automatic restart:

`Restart=always`

Contributor guide

Open the contributing guide

Research direction

Start with /etc/systemd/system/tomcat.service.d/tomcat.conf and compare its current [Service] settings with the requested systemd behavior. The work is done when the configuration enables automatic Tomcat restart after a crash and the AL2 Tomcat platform starts with that setting applied.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, linux
Domain
cloud, devops, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.