Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZIF-583] feat: mta out flow #20

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion mta/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pkgname="carbonio-mta"
pkgver="4.1.1"
pkgver="4.1.2"
pkgrel="1"
pkgdesc="An open-source, community-driven email server"
maintainer="Zextras <[email protected]>"
Expand Down Expand Up @@ -56,6 +56,8 @@ package() {
# consul for mta
install -Dm 755 "${pkgname}" \
"${pkgdir}/usr/bin/${pkgname}"
install -Dm 755 "${pkgname}-flow" \
"${pkgdir}/usr/bin/${pkgname}-flow"
install -Dm 644 "${pkgname}-sidecar.service" \
"${pkgdir}/lib/systemd/system/${pkgname}-sidecar.service"
install -Dm 644 "${pkgname}.hcl" \
Expand All @@ -68,6 +70,8 @@ package() {
"${pkgdir}/etc/carbonio/mta/service-discover/intentions.json"
install -Dm 644 service-protocol.json \
"${pkgdir}/etc/carbonio/mta/service-discover/service-protocol.json"
install -Dm 644 prepared-query.json \
"${pkgdir}/etc/carbonio/mta/service-discover/prepared-query.json"

# postfix
install -D conf/postfix/master.cf.in \
Expand Down
3 changes: 3 additions & 0 deletions mta/carbonio-mta
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ fi
chown ${SERVICE_USER}:${SERVICE_GROUP} ${SERVICE_BASE_DIR}/token
chmod 0600 ${SERVICE_BASE_DIR}/token

# register prepared query
omelyanovich-zextras marked this conversation as resolved.
Show resolved Hide resolved
curl --request POST --data @${SERVICE_BASE_DIR}/prepared-query.json http://127.0.0.1:8500/v1/query?token=${CONSUL_HTTP_TOKEN}

consul reload

# limit token visibility as much as possible
Expand Down
26 changes: 26 additions & 0 deletions mta/carbonio-mta-flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
#
# SPDX-License-Identifier: GPL-2.0-only

if [[ $(id -u) -ne 0 ]]; then
echo "Please run as root"
exit 1
fi

if [[ "$1" != "setup" ]]; then
echo "Syntax: '${SERVICE_NAME} setup' to automatically configure the service"
exit 1;
fi

source /opt/zextras/bin/zmshutil || exit 1

zmsetvars

if [ "$mtaincomingonly" = "TRUE" ]; then
/bin/sed -i 's/carbonio-mta-inout/carbonio-mta-in/g' /etc/zextras/service-discover/carbonio-mta.hcl
elif [ "$mtaincomingonly" = "FALSE" ] || [ -z $mtaincomingonly]; then
/bin/sed -i 's/carbonio-mta-in/carbonio-mta-inout/g' /etc/zextras/service-discover/carbonio-mta.hcl
fi

trap - EXIT
3 changes: 2 additions & 1 deletion mta/carbonio-mta-setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
carbonio-mta setup
carbonio-mta-flow setup
carbonio-mta setup
1 change: 1 addition & 0 deletions mta/carbonio-mta.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ services {
}
name = "carbonio-mta"
port = 25
tags = ["carbonio-mta-inout"]
}
7 changes: 7 additions & 0 deletions mta/prepared-query.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Name": "carbonio-mta-out",
"Service": {
"Service": "carbonio-mta",
"Tags": ["carbonio-mta-inout"]
}
}