From 921b6a28ad4ee754cb561c48aa8a5206a9e6f664 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Thu, 27 Feb 2025 09:55:36 +0100 Subject: docs(server): add an example for running a luarocks server --- docs/index.md | 3 +++ docs/local_server.md | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 docs/local_server.md (limited to 'docs') diff --git a/docs/index.md b/docs/index.md index 584414ab..075593e7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -31,6 +31,9 @@ * [LuaRocks through a proxy](luarocks_through_a_proxy.md) * [Embedding LuaRocks in an application](embedding_luarocks_in_an_application.md) * [Integrating distro modules with LuaRocks](integrating_distro_modules_with_luarocks.md) + +* LuaRocks servers + * [Creating a local LuaRocks server](local_server.md) * [Hosting binary rocks](hosting_binary_rocks.md) * Reference diff --git a/docs/local_server.md b/docs/local_server.md new file mode 100644 index 00000000..ae81b226 --- /dev/null +++ b/docs/local_server.md @@ -0,0 +1,36 @@ +# Creating a local LuaRocks server + +This Docker based example shows how to create a local LuaRocks +server. This can be used to serve private rocks, or only curated rocks. + +The rocks directory is "./rocks" (manifest file will be generated here, so +it only needs to contain the rock and rockspec files). +The server will be available at http://localhost:8080 + +Use LuaRocks with the following flag; + + --server http://localhost:8080 + +To ONLY use this server (a fully curated approach), use the following flag; + + --only-server http://localhost:8080 + + +## Example script: +```bash +#!/usr/bin/env bash + +# default rocks directory is "./rocks" +ROCKSDIR=$(pwd)/rocks +mkdir -p "$ROCKSDIR" + +# generate a manifest file +docker run --rm -v "$ROCKSDIR":/rocks \ + akorn/luarocks:lua5.1-alpine \ + luarocks-admin make_manifest /rocks + +# start nginx to serve rocks +docker run --rm --name luarocks-server \ + -v "$ROCKSDIR":/usr/share/nginx/html:ro \ + -p 8080:80 nginx +``` -- cgit v1.2.3-55-g6feb