Inital commit

This commit is contained in:
Alex Pickering 2024-04-10 23:57:20 -05:00
commit ed142d9308
7 changed files with 93 additions and 0 deletions

27
Makefile Normal file
View File

@ -0,0 +1,27 @@
# Before running "make", check the instructions in the readme
# binaries
pp=luajit tools/etluapp/etluapp.lua # preprocessor
startup_code=$(wildcard src/startup/*.sh.etlua) # startup files that need to be run through the preprocessor
startup_built=$(startup_code:src/startup/%.etlua=build/startup/%) # the files after preprocessing
srcs=$(wildcard src/*.etlua) # other files to run through the preprocessor
built=$(srcs:src/%.etlua=build/%) # other files after preprocessing
ready=$(built) $(startup_built)
all: $(ready)
echo "Ready: $(startup_built)"
cd build && terraform init && terraform apply
$(built): build/% : src/%.etlua config.lua secrets.lua
cat $< | $(pp) > $@
$(startup_built) : build/startup/% : src/startup/%.etlua config.lua secrets.lua
cat $< | $(pp) > $@
build/init.tf : config.lua
clean:
rm $(startup_built) $(built)

0
build/.gitignore vendored Normal file
View File

55
config.lua Normal file
View File

@ -0,0 +1,55 @@
-- Configuration!
-- Change this stuff
-- Bits of config
local config = {
aws_region="us-west-2",
domain = "txwea.boo",
subdomain_fmt = "%s.txwea.boo",
version="0.0.1",
}
-- These scripts spin up
-- each vps gets a name, and each vps gets some services. Each services may
-- depend on other services in a directed acyclic graph.
config.services = {
mc = {-- The minecraft server
ports = {25565},
public = true,
},
laminar = { -- A laminar ci/cd server
ports = {8080},
},
web = {-- Web server hosts the mmc instance, the map, ect.
ports = {80, 443},
public = true,
},
ssh = { -- The ssh server into the vpc, so you can bounce to other boxes that may not open ssh directly
ports = {22},
public = true,
},
}
-- Configure services -> machines
config.machines = {
main = {
services = {"mc","laminar","web","ssh"},
size = "t3.nano"
},
}
config.mods = {
shared = {},
server = {},
client = {},
}
-- Validation! Don't change stuff below this line!
for _,mod in pairs(config.mods.shared) do
table.insert(config.mods.client,mod)
table.insert(config.mods.server,mod)
end
return config

6
secrets.lua Normal file
View File

@ -0,0 +1,6 @@
local secrets = {
access_key = "<your access key here>"
secret_key = "<your secret key here>"
}
return secrets

0
src/.gitignore vendored Normal file
View File

0
src/startup/.gitignore vendored Normal file
View File

View File

@ -0,0 +1,5 @@
local etlua = require("etlua")
local input = io.read("*a")
local template = assert(etlua.compile(input))
io.write(template({}))