mirror of
https://github.com/apricote/home-cloud.git
synced 2026-01-13 13:01:03 +00:00
feat: add terraria server
This commit is contained in:
parent
68222fc63c
commit
60b159d2c8
3 changed files with 54 additions and 1 deletions
|
|
@ -16,3 +16,41 @@ resource "hcloud_volume_attachment" "minecraft_data" {
|
||||||
volume_id = hcloud_volume.minecraft_data.id
|
volume_id = hcloud_volume.minecraft_data.id
|
||||||
server_id = hcloud_server.minecraft.id
|
server_id = hcloud_server.minecraft.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## Terraria
|
||||||
|
|
||||||
|
resource "hcloud_server" "terraria" {
|
||||||
|
name = "terraria"
|
||||||
|
image = "ubuntu-20.04"
|
||||||
|
server_type = "cx21"
|
||||||
|
location = "nbg1"
|
||||||
|
ssh_keys = [data.hcloud_ssh_key.default.id]
|
||||||
|
|
||||||
|
provisioner "file" {
|
||||||
|
content = templatefile("./gameservers/docker-compose.terraria.yml", {
|
||||||
|
image = "ryshe/terraria"
|
||||||
|
image_tag = "tshock-1.4.3.6-4.5.17-2"
|
||||||
|
volume_id = hcloud_volume.terraria_data.id
|
||||||
|
world_name = "TheDriftingMoon"
|
||||||
|
})
|
||||||
|
destination = "/terraria/docker-compose.yml"
|
||||||
|
|
||||||
|
connection {
|
||||||
|
type = "ssh"
|
||||||
|
host = self.ipv4_address
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "hcloud_volume" "terraria_data" {
|
||||||
|
name = "terraria-data"
|
||||||
|
size = 20
|
||||||
|
location = "nbg1"
|
||||||
|
format = "ext4"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "hcloud_volume_attachment" "terraria_data" {
|
||||||
|
volume_id = hcloud_volume.terraria_data.id
|
||||||
|
server_id = hcloud_server.terraria.id
|
||||||
|
automount = true
|
||||||
|
}
|
||||||
|
|
|
||||||
11
gameservers/docker-compose.terraria.yml
Normal file
11
gameservers/docker-compose.terraria.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
tshock:
|
||||||
|
image: ${image}:${image_tag}
|
||||||
|
ports:
|
||||||
|
- 7777:7777
|
||||||
|
volumes:
|
||||||
|
- /mnt/HC_VOLUME_${volume_id}/Terraria/Worlds/:/root/.local/share/Terraria/Worlds/
|
||||||
|
environment:
|
||||||
|
WORLD_FILENAME: ${world_name}.wld
|
||||||
|
|
@ -3,6 +3,10 @@
|
||||||
variable "hcloud_token" {}
|
variable "hcloud_token" {}
|
||||||
|
|
||||||
# Configure the Hetzner Cloud Provider
|
# Configure the Hetzner Cloud Provider
|
||||||
provider hcloud {
|
provider "hcloud" {
|
||||||
token = var.hcloud_token
|
token = var.hcloud_token
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data "hcloud_ssh_key" "default" {
|
||||||
|
name = "default"
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue