diff --git a/modules/fstab.lua b/modules/fstab.lua index 7585fac..c5a63a0 100644 --- a/modules/fstab.lua +++ b/modules/fstab.lua @@ -7,7 +7,12 @@ local function add_mount(mount) table.insert(mounts, mount) add_file("/etc/fstab", utils.join_table(mounts, "\n")) end +local function add_tmpfs(path) + add_mount("tmpfs "..path.." tmpfs defaults,noexec,nosuid 0 0") + mkdir(path) +end modules.fstab = { add_mount = add_mount, + add_tmpfs = add_tmpfs, } diff --git a/modules/nginx.lua b/modules/nginx.lua new file mode 100644 index 0000000..f7bdd11 --- /dev/null +++ b/modules/nginx.lua @@ -0,0 +1,9 @@ +modules.nginx = {} +add_packages({ "nginx" }) +modules.fstab.add_tmpfs("/var/lib/nginx/tmp") +modules.data.add_data_dir("/data/nginx/logs", "/var/log/nginx", "nginx", "nginx") +modules.runit.add_service("nginx", [[#!/bin/sh +exec 2>&1 +mkdir /run/nginx || exit 1 +exec nginx -g 'daemon off;' +]]) diff --git a/setup.lua b/setup.lua index 836d2a7..ebc32ec 100644 --- a/setup.lua +++ b/setup.lua @@ -46,6 +46,7 @@ module "kernel" module "runit" module "hostname" module "dhcpcd" +module "nginx" print("=> Installing and upgrading packages...") utils.expect_nil(alpine.make_world(root, packages))