44 lines
1.0 KiB
Python
44 lines
1.0 KiB
Python
import os
|
|
import time
|
|
import getpass
|
|
|
|
try:
|
|
import toml
|
|
|
|
except ImportError:
|
|
print(
|
|
"You need to install `toml` to use this file. Run `pip install toml` and try again."
|
|
)
|
|
sys.exit()
|
|
|
|
username = input("Username for git.nyeki.dev: ")
|
|
password = getpass.getpass("Password for git.nyeki.dev: ")
|
|
|
|
os.system(f"git pull https://{username}:{password}@git.nyeki.dev/payphone/payphone")
|
|
|
|
data = toml.load(open("pyproject.toml"))
|
|
version = data["project"]["version"].split(".")
|
|
latest_tag = "v" + version[1]
|
|
|
|
os.system(
|
|
f"microk8s kubectl set image sts/bot bot=registry.nyeki.dev/payphone/payphone/shard:{latest_tag}"
|
|
)
|
|
os.system(
|
|
f"""
|
|
microk8s kubectl set image pod/tasks \
|
|
connect=registry.nyeki.dev/payphone/payphone/tasks:{latest_tag}
|
|
"""
|
|
)
|
|
|
|
print("Waiting 15 seconds to run migrations...")
|
|
|
|
time.sleep(15)
|
|
|
|
shards = input("How many shards are there deployed?: ")
|
|
|
|
os.system(f"microk8s kubectl exec bot-{int(shards) - 1} -- uv run aerich upgrade")
|
|
|
|
print("Done!")
|
|
|
|
# expire=registry.nyeki.dev/payphone/payphone/shard:v{latest_version}
|