From bc3d43a82b4e20038d9bc98b8aa6b8ba346279b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Raczy=C5=84ski?= Date: Mon, 25 Nov 2024 22:22:15 +0100 Subject: [PATCH] fix volume --- deploy.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/deploy.py b/deploy.py index 4562227..60bb756 100644 --- a/deploy.py +++ b/deploy.py @@ -96,6 +96,8 @@ if not volume: # print(f"Wolumen {volume_name} zostaƂ utworzony") +volume_id = volume.volume.id + cloud_init_gitea = f'''#cloud-config packages: - apt-transport-https @@ -135,6 +137,10 @@ runcmd: - chmod +x /usr/local/bin/docker-compose - systemctl start docker - systemctl enable docker + - mkfs.ext4 -F /dev/disk/by-id/scsi-0HC_Volume_{volume_id} + - mkdir /mnt/{volume_name} + - mount -o discard,defaults /dev/disk/by-id/scsi-0HC_Volume_{volume_id} /mnt/{volume_name} + - echo "/dev/disk/by-id/scsi-0HC_Volume_{volume_id} /mnt/{volume_name} ext4 discard,nofail,defaults 0 0" >> /etc/fstab - cd /root/ && docker-compose up -d ''' @@ -145,7 +151,8 @@ gitea_server = client.servers.create( ssh_keys=[ssh_key], networks=[vnet], location=Location("hel1"), - user_data=cloud_init_gitea + user_data=cloud_init_gitea, + volumes=[volume.volume] ) gitea_server.action.wait_until_finished()