Add script for removing
This commit is contained in:
parent
60b341cf14
commit
3940a3083b
@ -1 +1,5 @@
|
|||||||
Aby zadziałało, należy utworzyć plik z kluczem publicznym ssh (pod nazwą 'ssh_key.pub') oraz z kluczem api (pod nazwą 'api_key')
|
1. Utworzyć plik z kluczem publicznym ssh pod nazwą 'ssh_key.pub'
|
||||||
|
2. Utworzyć plik z kluczem api pod nazwą 'api_key'
|
||||||
|
3. chmod +x deploy.sh
|
||||||
|
4. Uruchomić skrypt 'deploy.sh'
|
||||||
|
5. (Opcjonalnie) jeżeli chce się usunąć utworzone zasoby - uruchomić skrypt 'remove.py'
|
@ -6,7 +6,6 @@ from hcloud.networks.domain import NetworkSubnet
|
|||||||
from hcloud.locations.domain import Location
|
from hcloud.locations.domain import Location
|
||||||
from hcloud.images.domain import Image
|
from hcloud.images.domain import Image
|
||||||
from hcloud.server_types.domain import ServerType
|
from hcloud.server_types.domain import ServerType
|
||||||
from hcloud.volumes.domain import Volume
|
|
||||||
from constants import *
|
from constants import *
|
||||||
|
|
||||||
|
|
||||||
|
23
remove.py
Normal file
23
remove.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
from constants import *
|
||||||
|
from hcloud import Client
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
with open(API_KEY_FNAME) as f:
|
||||||
|
api_key = f.read()
|
||||||
|
|
||||||
|
client = Client(api_key)
|
||||||
|
|
||||||
|
ssh_key = client.ssh_keys.get_by_name(SSH_KEY_NAME)
|
||||||
|
vnet = client.networks.get_by_name(VNET_NAME)
|
||||||
|
db_server = client.servers.get_by_name(DB_SERVER_NAME)
|
||||||
|
gitea_server = client.servers.get_by_name(GITEA_SERVER_NAME)
|
||||||
|
|
||||||
|
ssh_key.delete()
|
||||||
|
vnet.delete()
|
||||||
|
db_server.delete()
|
||||||
|
gitea_server.delete()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in New Issue
Block a user