user/dev discussion of public-inbox itself
 help / color / mirror / Atom feed
* [PATCH] examples: add imapd systemd examples
@ 2020-08-23  7:49 Eric Wong
  2020-08-25  2:47 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2020-08-23  7:49 UTC (permalink / raw)
  To: meta

We've got examples for all the other daemons, too!
---
 examples/public-inbox-imap-onion.socket | 12 +++++++
 examples/public-inbox-imapd.socket      | 12 +++++++
 examples/public-inbox-imapd@.service    | 43 +++++++++++++++++++++++++
 examples/public-inbox-imaps.socket      | 12 +++++++
 4 files changed, 79 insertions(+)
 create mode 100644 examples/public-inbox-imap-onion.socket
 create mode 100644 examples/public-inbox-imapd.socket
 create mode 100644 examples/public-inbox-imapd@.service
 create mode 100644 examples/public-inbox-imaps.socket

diff --git a/examples/public-inbox-imap-onion.socket b/examples/public-inbox-imap-onion.socket
new file mode 100644
index 00000000..76b4e7ca
--- /dev/null
+++ b/examples/public-inbox-imap-onion.socket
@@ -0,0 +1,12 @@
+# ==> /etc/systemd/system/public-inbox-imap-onion.socket <==
+# This unit is for the corresponding line in torrc(5):
+# HiddenServicePort 143 unix:/run/imapd.onion.sock
+[Unit]
+Description = public-inbox-imap .onion socket
+
+[Socket]
+ListenStream = /run/imapd.onion.sock
+Service = public-inbox-imapd@1.service
+
+[Install]
+WantedBy = sockets.target
diff --git a/examples/public-inbox-imapd.socket b/examples/public-inbox-imapd.socket
new file mode 100644
index 00000000..fcd924fd
--- /dev/null
+++ b/examples/public-inbox-imapd.socket
@@ -0,0 +1,12 @@
+# ==> /etc/systemd/system/public-inbox-imapd.socket <==
+[Unit]
+Description = public-inbox-imapd socket
+
+[Socket]
+ListenStream = 0.0.0.0:143
+BindIPv6Only = ipv6-only
+ListenStream = [::]:143
+Service = public-inbox-imapd@1.service
+
+[Install]
+WantedBy = sockets.target
diff --git a/examples/public-inbox-imapd@.service b/examples/public-inbox-imapd@.service
new file mode 100644
index 00000000..e0446ed3
--- /dev/null
+++ b/examples/public-inbox-imapd@.service
@@ -0,0 +1,43 @@
+# ==> /etc/systemd/system/public-inbox-imapd@.service <==
+# Since SIGUSR2 upgrades do not work under systemd, this service file
+# allows starting two simultaneous services during upgrade time
+# (e.g. public-inbox-imapd@1 public-inbox-imapd@2) with the intention
+# that they take turns running in-between upgrades.  This should
+# allow upgrading without downtime.
+
+[Unit]
+Description = public-inbox-imapd IMAP server %i
+Wants = public-inbox-imapd.socket public-inbox-imaps.socket \
+public-inbox-imap-onion.socket
+After = public-inbox-imapd.socket public-inbox-imaps.socket \
+public-inbox-imap-onion.socket
+
+[Service]
+Environment = PI_CONFIG=/home/pi/.public-inbox/config \
+PATH=/usr/local/bin:/usr/bin:/bin \
+PERL_INLINE_DIRECTORY=/tmp/.pub-inline
+
+LimitNOFILE = 30000
+ExecStartPre = /bin/mkdir -p -m 1777 /tmp/.pub-inline
+ExecStart = /usr/local/bin/public-inbox-imapd -W0 \
+-1 /var/log/public-inbox/imapd.out.log \
+--cert /etc/ssl/certs/news.example.com.pem \
+--key /etc/ssl/private/news.example.com.key
+StandardError = syslog
+
+# NonBlocking is REQUIRED to avoid a race condition if running
+# simultaneous services
+NonBlocking = true
+
+Sockets = public-inbox-imapd.socket public-inbox-imaps.socket \
+public-inbox-imap-onion.socket
+
+KillSignal = SIGQUIT
+User = nobody
+Group = ssl-cert
+ExecReload = /bin/kill -HUP $MAINPID
+TimeoutStopSec = 86400
+KillMode = process
+
+[Install]
+WantedBy = multi-user.target
diff --git a/examples/public-inbox-imaps.socket b/examples/public-inbox-imaps.socket
new file mode 100644
index 00000000..b61cc742
--- /dev/null
+++ b/examples/public-inbox-imaps.socket
@@ -0,0 +1,12 @@
+# ==> /etc/systemd/system/public-inbox-imaps.socket <==
+[Unit]
+Description = public-inbox-imaps socket
+
+[Socket]
+ListenStream = 0.0.0.0:993
+BindIPv6Only = ipv6-only
+ListenStream = [::]:993
+Service = public-inbox-imapd@1.service
+
+[Install]
+WantedBy = sockets.target

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] examples: add imapd systemd examples
  2020-08-23  7:49 [PATCH] examples: add imapd systemd examples Eric Wong
@ 2020-08-25  2:47 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2020-08-25  2:47 UTC (permalink / raw)
  To: meta

Also squashed this in before pushing:

diff --git a/MANIFEST b/MANIFEST
index d86d3b15..35adc8d3 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -83,6 +83,10 @@ examples/nginx_proxy
 examples/public-inbox-config
 examples/public-inbox-httpd.socket
 examples/public-inbox-httpd@.service
+examples/public-inbox-imap-onion.socket
+examples/public-inbox-imapd.socket
+examples/public-inbox-imapd@.service
+examples/public-inbox-imaps.socket
 examples/public-inbox-nntpd.socket
 examples/public-inbox-nntpd@.service
 examples/public-inbox-nntps.socket

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-25  2:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-23  7:49 [PATCH] examples: add imapd systemd examples Eric Wong
2020-08-25  2:47 ` Eric Wong

user/dev discussion of public-inbox itself

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ https://public-inbox.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git