feat(scripts): ✨ Make deploy.py read the amount of replicas from k8s/bot.yml.
This commit is contained in:
+16
-2
@@ -11,6 +11,15 @@ except ImportError:
|
|||||||
)
|
)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
try:
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
print(
|
||||||
|
"You need to install `yaml` to use this file. Run `pip install pyyaml` and try again."
|
||||||
|
)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
username = input("Username for git.nyeki.dev: ")
|
username = input("Username for git.nyeki.dev: ")
|
||||||
password = getpass.getpass("Password for git.nyeki.dev: ")
|
password = getpass.getpass("Password for git.nyeki.dev: ")
|
||||||
|
|
||||||
@@ -34,9 +43,14 @@ print("Waiting 15 seconds to run migrations...")
|
|||||||
|
|
||||||
time.sleep(15)
|
time.sleep(15)
|
||||||
|
|
||||||
shards = input("How many shards are there deployed?: ")
|
with open("./k8s/bot.yml") as stream:
|
||||||
|
try:
|
||||||
|
data = yaml.safe_load(stream)
|
||||||
|
|
||||||
|
os.system(f"microk8s kubectl exec bot-{data["spec"]["replicas"] - 1} -- uv run aerich upgrade")
|
||||||
|
except yaml.YAMLError as exc:
|
||||||
|
print("Could not read the amount of deployed shards.")
|
||||||
|
|
||||||
os.system(f"microk8s kubectl exec bot-{int(shards) - 1} -- uv run aerich upgrade")
|
|
||||||
|
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user