install doveauth system-wide via pip
This commit is contained in:
parent
01f350fa0b
commit
fbda0fb53c
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@ __pycache__/
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
doveauth/dist/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
|
@ -2,6 +2,7 @@
|
||||
Chat Mail pyinfra deploy.
|
||||
"""
|
||||
import importlib.resources
|
||||
import os.path
|
||||
|
||||
from pyinfra import host, logger
|
||||
from pyinfra.operations import apt, files, server, systemd, python
|
||||
@ -9,16 +10,24 @@ from pyinfra.facts.files import File
|
||||
from .acmetool import deploy_acmetool
|
||||
|
||||
|
||||
def _install_chatctl() -> None:
|
||||
def _install_doveauth() -> None:
|
||||
"""Setup chatctl."""
|
||||
doveauth_filename = f'doveauth-0.1.tar.gz'
|
||||
doveauth_path = importlib.resources.files(__package__).joinpath(f'../../../doveauth/dist/{doveauth_filename}')
|
||||
remote_path = f"/tmp/{doveauth_filename}"
|
||||
if os.path.exists(str(doveauth_path)):
|
||||
files.put(
|
||||
src=importlib.resources.files("doveauth")
|
||||
.joinpath("doveauth.py")
|
||||
.open("rb"),
|
||||
dest="/home/vmail/chatctl",
|
||||
user="vmail",
|
||||
group="vmail",
|
||||
mode="755",
|
||||
name="upload local doveauth build",
|
||||
src=doveauth_path.open("rb"),
|
||||
dest=remote_path,
|
||||
)
|
||||
apt.packages(
|
||||
name="apt install python3-pip",
|
||||
packages="python3-pip",
|
||||
)
|
||||
server.shell(
|
||||
name="install local doveauth build with pip",
|
||||
commands=[f"pip install --break-system-packages {remote_path}"]
|
||||
)
|
||||
|
||||
|
||||
@ -159,7 +168,7 @@ def deploy_chatmail(mail_domain: str, mail_server: str, dkim_selector: str) -> N
|
||||
],
|
||||
)
|
||||
|
||||
_install_chatctl()
|
||||
_install_doveauth()
|
||||
dovecot_need_restart = _configure_dovecot(mail_server)
|
||||
postfix_need_restart = _configure_postfix(mail_domain)
|
||||
opendkim_need_restart = _configure_opendkim(mail_domain, dkim_selector)
|
||||
|
@ -1,4 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
: ${CHATMAIL_DOMAIN:=c1.testrun.org}
|
||||
export CHATMAIL_DOMAIN
|
||||
chatmail-pyinfra/venv/bin/pyinfra --ssh-user root "$CHATMAIL_DOMAIN" deploy.py
|
||||
cd doveauth
|
||||
venv/bin/python3 -m build
|
||||
../chatmail-pyinfra/venv/bin/pyinfra --ssh-user root "$CHATMAIL_DOMAIN" ../deploy.py
|
||||
rm -r dist/
|
||||
|
@ -4,5 +4,5 @@ chatmail-pyinfra/venv/bin/pip install pyinfra pytest
|
||||
chatmail-pyinfra/venv/bin/pip install -e chatmail-pyinfra
|
||||
chatmail-pyinfra/venv/bin/pip install -e doveauth
|
||||
python3 -m venv doveauth/venv
|
||||
doveauth/venv/bin/pip install pytest
|
||||
doveauth/venv/bin/pip install pytest build
|
||||
doveauth/venv/bin/pip install -e doveauth
|
||||
|
Loading…
Reference in New Issue
Block a user