Skip to content

Commit

Permalink
feat(svc): add servers database
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelOnFira committed May 2, 2024
1 parent e0c203b commit 3632a26
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
7 changes: 7 additions & 0 deletions svc/pkg/servers/db/servers/Service.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[service]
name = "db-servers"

[runtime]
kind = "crdb"

[database]
Empty file.
36 changes: 36 additions & 0 deletions svc/pkg/servers/db/servers/migrations/20240501133910_init.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
CREATE TABLE servers (
server_id UUID PRIMARY KEY,
datacenter_id UUID NOT NULL REFERENCES datacenters (datacenter_id),
pool_type INT NOT NULL, -- rivet.backend.cluster.PoolType

-- Null until actual server is provisioned
provider_server_id TEXT,
provider_hardware TEXT,
vlan_ip INET,
network_idx INT,
public_ip INET,

-- Null until nomad node successfully registers
nomad_node_id TEXT,

create_ts INT NOT NULL,
provision_complete_ts INT,
install_complete_ts INT,
nomad_join_ts INT,
-- Null if not draining
drain_ts INT,
drain_complete_ts INT,
-- When the server was marked to be deleted by rivet
cloud_destroy_ts INT,
taint_ts INT
);


CREATE TABLE docker_images (
image_id UUID PRIMARY KEY,
image_name TEXT NOT NULL,
image_tag TEXT NOT NULL,
image_digest TEXT NOT NULL,
image_size INT NOT NULL,
image_created_ts INT NOT NULL
);

0 comments on commit 3632a26

Please sign in to comment.