mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-04-19 23:36:04 -04:00
Create terraform for gitlab runner
This commit is contained in:
parent
725a60596c
commit
edc6b85046
2
cicd/.gitignore
vendored
Normal file
2
cicd/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.terraform*
|
||||
terraform.tfstate*
|
20
cicd/provider.tf
Normal file
20
cicd/provider.tf
Normal file
@ -0,0 +1,20 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
digitalocean = {
|
||||
source = "digitalocean/digitalocean"
|
||||
version = "~> 2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "do_token" {}
|
||||
variable "ssh_key" {}
|
||||
variable "pvt_key" {}
|
||||
|
||||
provider "digitalocean" {
|
||||
token = var.do_token
|
||||
}
|
||||
|
||||
data "digitalocean_ssh_key" "ssh_key" {
|
||||
name = var.ssh_key
|
||||
}
|
29
cicd/runner.tf
Normal file
29
cicd/runner.tf
Normal file
@ -0,0 +1,29 @@
|
||||
resource "digitalocean_droplet" "veilid-runner-1" {
|
||||
image = "debian-11-x64"
|
||||
name = "veilid-runner-1"
|
||||
region = "nyc1"
|
||||
size = "s-1vcpu-512mb-10gb"
|
||||
ssh_keys = [
|
||||
data.digitalocean_ssh_key.ssh_key.id
|
||||
]
|
||||
|
||||
connection {
|
||||
host = self.ipv4_address
|
||||
user = "root"
|
||||
type = "ssh"
|
||||
private_key = file(var.pvt_key)
|
||||
timeout = "2m"
|
||||
}
|
||||
|
||||
provisioner "remote-exec" {
|
||||
inline = [
|
||||
"apt-get update",
|
||||
"apt-get -y install ca-certificates curl gnupg lsb-release",
|
||||
"mkdir -p /etc/apt/keyrings/",
|
||||
"curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg",
|
||||
"echo \"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable\" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null",
|
||||
"apt-get update",
|
||||
"apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user