Update 'hertzner.py'

This commit is contained in:
Patryk Gałka 2024-02-08 05:14:35 +01:00
parent 415abc7c8b
commit ef5f109964

View File

@ -6,7 +6,6 @@ from hcloud.server_types import ServerType
from hcloud._exceptions import APIException from hcloud._exceptions import APIException
from hcloud.servers.domain import ServerCreatePublicNetwork from hcloud.servers.domain import ServerCreatePublicNetwork
from time import sleep
YOUR_API_TOKEN = "" YOUR_API_TOKEN = ""
@ -77,11 +76,11 @@ package_upgrade: true
groups: groups:
- docker - docker
system_info: system_info:
default_user: default_user:
groups: [ docker ] groups: [ docker ]
packages: packages:
- apt-transport-https - apt-transport-https
- ca-certificates - ca-certificates
@ -89,7 +88,7 @@ packages:
- gnupg - gnupg
- lsb-release - lsb-release
- unattended-upgrades - unattended-upgrades
runcmd: runcmd:
- mkdir -p /etc/apt/keyrings - mkdir -p /etc/apt/keyrings
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
@ -98,15 +97,15 @@ runcmd:
- apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin - apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
- systemctl enable docker - systemctl enable docker
- systemctl start docker - systemctl start docker
- git clone https://git.wmi.amu.edu.pl/s434686/zpzc-3 - git clone https://git.wmi.amu.edu.pl/s434686/zpzc-3.git /zpzc-3
- docker compose -f /zpzc-3/db.yml up -d
- echo 'Done'
final_message: "The system is finally up, after $UPTIME seconds"
bootcmd: bootcmd:
- cd zpzc-3 - docker compose -f /zpzc-3/db.yml up -d
- docker compose -f db.yml up -d
""" final_message: "The system is finally up, after $UPTIME seconds"
"""
) )
db_server = response.server db_server = response.server
print(f"{db_server.id=} {db_server.name=} {db_server.status=}") print(f"{db_server.id=} {db_server.name=} {db_server.status=}")
@ -129,11 +128,11 @@ package_upgrade: true
groups: groups:
- docker - docker
system_info: system_info:
default_user: default_user:
groups: [ docker ] groups: [ docker ]
packages: packages:
- apt-transport-https - apt-transport-https
- ca-certificates - ca-certificates
@ -141,7 +140,7 @@ packages:
- gnupg - gnupg
- lsb-release - lsb-release
- unattended-upgrades - unattended-upgrades
runcmd: runcmd:
- mkdir -p /etc/apt/keyrings - mkdir -p /etc/apt/keyrings
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
@ -150,18 +149,16 @@ runcmd:
- apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin - apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
- systemctl enable docker - systemctl enable docker
- systemctl start docker - systemctl start docker
- git clone https://git.wmi.amu.edu.pl/s434686/zpzc-3 - git clone https://git.wmi.amu.edu.pl/s434686/zpzc-3.git /zpzc-3
- cd zpzc-3 - docker compose -f /zpzc-3/gitea.yml up -d
- docker compose -f db.yml up -d - echo 'Done'
bootcmd:
- docker compose -f /zpzc-3/gitea.yml up -d
final_message: "The system is finally up, after $UPTIME seconds" final_message: "The system is finally up, after $UPTIME seconds"
bootcmd: """
- cd zpzc-3
- docker compose -f db.yml up -d
""",
) )
_gitea_server = gitea_server.server _gitea_server = gitea_server.server
print(f"{_gitea_server.id=} {_gitea_server.name=} {_gitea_server.status=}, {gitea_server.root_password} ") print(f"{_gitea_server.id=} {_gitea_server.name=} {_gitea_server.status=}, {gitea_server.root_password} ")