commit ed142d9308e6df484f81b1e72e838dec07f7de1d Author: Alex Pickering Date: Wed Apr 10 23:57:20 2024 -0500 Inital commit diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..241e532 --- /dev/null +++ b/Makefile @@ -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) diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..204f904 --- /dev/null +++ b/config.lua @@ -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 diff --git a/secrets.lua b/secrets.lua new file mode 100644 index 0000000..099131e --- /dev/null +++ b/secrets.lua @@ -0,0 +1,6 @@ +local secrets = { + access_key = "" + secret_key = "" +} + +return secrets diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/src/startup/.gitignore b/src/startup/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tools/etluapp/etluapp.lua b/tools/etluapp/etluapp.lua new file mode 100644 index 0000000..d60b126 --- /dev/null +++ b/tools/etluapp/etluapp.lua @@ -0,0 +1,5 @@ +local etlua = require("etlua") + +local input = io.read("*a") +local template = assert(etlua.compile(input)) +io.write(template({}))