Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
missytake | d99841843c |
|
@ -5,10 +5,10 @@ StartLimitIntervalSec=0
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/podman run --rm --name={{container_name}} {{environment}} {{mount}} {{port}} docker.io/library/{{container}}:{{version}}
|
||||
EnvironmentFile=%h/.env
|
||||
ExecStart=/usr/bin/podman run --rm --name={{name}} {{environment}} {{mount}} {{port}} {{container}}:{{version}}
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
|
|
34
pyinfra.py
34
pyinfra.py
|
@ -15,8 +15,6 @@ def deploy_wordpress(
|
|||
mysql_root_password: str = None,
|
||||
_su: dict = {},
|
||||
):
|
||||
if not mysql_root_password:
|
||||
mysql_root_password = mysql_password
|
||||
# check that podman is installed
|
||||
secrets = [
|
||||
f"MYSQL_PASSWORD={mysql_password}",
|
||||
|
@ -40,21 +38,10 @@ def deploy_wordpress(
|
|||
"ufw allow 443",
|
||||
"ufw allow 80",
|
||||
"ufw allow 22",
|
||||
"ufw allow 42022",
|
||||
"ufw status",
|
||||
# "ufw reload?",
|
||||
],
|
||||
)
|
||||
files.directory(
|
||||
name="create db_data directory",
|
||||
path=f"/home/{unix_user}/db_data",
|
||||
**_su,
|
||||
)
|
||||
files.directory(
|
||||
name="create wp-content directory",
|
||||
path=f"/home/{unix_user}/wp-content",
|
||||
**_su,
|
||||
)
|
||||
|
||||
print(importlib.resources.files(__package__))
|
||||
service_path = f"/home/{unix_user}/.config/systemd/user/"
|
||||
|
@ -71,12 +58,12 @@ def deploy_wordpress(
|
|||
files.template(
|
||||
name="upload wordpress systemd service",
|
||||
src=importlib.resources.files(__package__) / "podman.service.j2",
|
||||
dest=f"{service_path}{domain}_wp.service",
|
||||
dest=f"{service_path}wordpress.service",
|
||||
description="run wordpress podman container",
|
||||
container_name=f"{domain}_wp",
|
||||
environment="-e " + " -e ".join(environment),
|
||||
mount="--mount " + " --mount ".join(mount),
|
||||
port=f"-p 127.0.0.1:{wordpress_port}:80",
|
||||
name=f"{domain}_wp",
|
||||
environment="-e " + "-e ".join(environment),
|
||||
mount="--mount " + "--mount ".join(mount),
|
||||
port=f"-p 127.0.0.1:{nginx_port}:80"
|
||||
container="wordpress",
|
||||
version=wordpress_version,
|
||||
**_su,
|
||||
|
@ -91,12 +78,12 @@ def deploy_wordpress(
|
|||
files.template(
|
||||
name="upload mysql systemd service",
|
||||
src=importlib.resources.files(__package__) / "podman.service.j2",
|
||||
dest=f"{service_path}{domain}_db.service",
|
||||
dest=f"{service_path}mysql.service",
|
||||
description="run mysql podman container",
|
||||
container_name=f"{domain}_db",
|
||||
environment="-e " + " -e ".join(environment),
|
||||
mount=f"--mount type=bind,source=/home/{unix_user}/db_data,destination=/var/lib/mysql",
|
||||
port=f"-p {mysql_port}:3306",
|
||||
name=f"{domain}_db",
|
||||
environment="-e " + "-e ".join(environment),
|
||||
mount=f"--mount type=bind,source=/home/{unix_user}/db_data/_data/,destination=/var/lib/mysql",
|
||||
port=f"-p {mysql_port}:3306"
|
||||
container="mysql",
|
||||
version="5.7",
|
||||
**_su,
|
||||
|
@ -119,5 +106,4 @@ def deploy_wordpress(
|
|||
daemon_reload=True,
|
||||
user_name=unix_user,
|
||||
user_mode=True,
|
||||
**_su,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue