Skip to content

Commit b6e2dad

Browse files
committed
Add docker hostingmethod
1 parent 159a5ae commit b6e2dad

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66
This project mostly adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html);
77
however, insignificant breaking changes do not guarantee a major version bump, see the reasoning [here](https://github.com/kyb3r/modmail/issues/319). If you're a plugin developer, note the "BREAKING" section.
88

9+
# v3.9.2
10+
11+
### Improved
12+
13+
- Additional HostingMethods (i.e. DOCKER, PM2, SCREEN). Autoupdates are now disabled on all docker instances. ([GH #2977](https://github.com/kyb3r/modmail/issues/2977), [PR #2988](https://github.com/kyb3r/modmail/pull/2988))
14+
915
# v3.9.1
1016

1117
### Internal

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FROM python:3.7-alpine
2+
ENV USING_DOCKER yes
23
WORKDIR /modmailbot
34
COPY . /modmailbot
45
RUN export PIP_NO_CACHE_DIR=false \

bot.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ def hosting_method(self) -> HostingMethod:
112112
if os.environ.get("INVOCATION_ID"):
113113
return HostingMethod.SYSTEMD
114114

115+
if os.environ.get("USING_DOCKER"):
116+
return HostingMethod.DOCKER
117+
118+
if os.environ.get("INVOCATION_ID"):
119+
return HostingMethod.SYSTEMD
120+
115121
if os.environ.get("TERM"):
116122
return HostingMethod.SCREEN
117123

@@ -1671,6 +1677,10 @@ async def before_autoupdate(self):
16711677
logger.warning("Autoupdates disabled.")
16721678
self.autoupdate_loop.cancel()
16731679

1680+
if self.hosting_method == HostingMethod.DOCKER:
1681+
logger.warning("Autoupdates disabled as using Docker.")
1682+
self.autoupdate_loop.cancel()
1683+
16741684
if not self.config.get("github_token") and self.hosting_method == HostingMethod.HEROKU:
16751685
logger.warning("GitHub access token not found.")
16761686
logger.warning("Autoupdates disabled.")

core/models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ class DMDisabled(IntEnum):
276276
class HostingMethod(IntEnum):
277277
HEROKU = 0
278278
PM2 = 1
279-
OTHER = 2
280-
SYSTEMD = 3
281-
SCREEN = 4
279+
SYSTEMD = 2
280+
SCREEN = 3
281+
DOCKER = 4
282+
OTHER = 5

0 commit comments

Comments
 (0)