]> Untitled Git - godot-builder.git/commitdiff
Squashed commit of the following: 0.4.0
authorClifton Palmer <clifton.james.palmer@protonmail.com>
Tue, 18 Mar 2025 15:09:40 +0000 (10:09 -0500)
committerClifton Palmer <clifton.james.palmer@protonmail.com>
Tue, 18 Mar 2025 15:12:30 +0000 (10:12 -0500)
    * Added webhook server
    * Bugfix in builder
    * Added redis to nginx image

.env [new file with mode: 0644]
builder/entrypoint.sh
docker-compose-prod.yml
docker-compose.yml
hook/Dockerfile [new file with mode: 0644]
hook/build-request.html [new file with mode: 0644]
hook/example.lua [new file with mode: 0644]
hook/httpd.conf [new file with mode: 0644]
hook/make-build-request.lua [new file with mode: 0644]
nginx/Dockerfile [new file with mode: 0644]
nginx/conf.d/godot.conf

diff --git a/.env b/.env
new file mode 100644 (file)
index 0000000..ffeec89
--- /dev/null
+++ b/.env
@@ -0,0 +1 @@
+DOCKER_TAG=0.4.0
index 1013354345995fe494a535d94c37b53dc18d919c..2702b04729a24cfa4e39bbee7500dcc42d6b445e 100755 (executable)
@@ -9,7 +9,7 @@ function intr() {
 trap intr SIGINT
 
 SLEEP_INT=$1
 trap intr SIGINT
 
 SLEEP_INT=$1
-[[ -n "$SLEEP_INT" ]] || SLEEP_INT=60
+[[ "$SLEEP_INT" -gt 0 ]] || SLEEP_INT=60
 
 echo Starting builder polling every $SLEEP_INT seconds...
 
 
 echo Starting builder polling every $SLEEP_INT seconds...
 
index 807a666afcdc26812574a7849b094a2fa129b54a..afe28f78ceee667d963d52d62473e4c49c9df562 100644 (file)
@@ -6,7 +6,7 @@ networks:
         driver: overlay
 services:
     web:
         driver: overlay
 services:
     web:
-        image: nginx:1.27-alpine
+        image: cjpalmer/godot-web:$DOCKER_TAG
         volumes:
         - ./nginx/conf.d/:/etc/nginx/conf.d/
         - godot-build:/build
         volumes:
         - ./nginx/conf.d/:/etc/nginx/conf.d/
         - godot-build:/build
@@ -20,7 +20,7 @@ services:
         networks:
         - backend
     builder:
         networks:
         - backend
     builder:
-        image: cjpalmer/godot-builder:0.3.1
+        image: cjpalmer/godot-builder:$DOCKER_TAG
         volumes:
         - godot-build:/build
         - godot-project:/project
         volumes:
         - godot-build:/build
         - godot-project:/project
index a4ced6593e3e251cbc4ffa2c6588ebe68311021a..5533030f4cd7084ee4202147134a89877bc8f728 100644 (file)
@@ -1,7 +1,8 @@
 version: '3'
 services:
     web:
 version: '3'
 services:
     web:
-        image: nginx:1.27-alpine
+        build: ./nginx
+        image: cjpalmer/godot-web:$DOCKER_TAG
         volumes:
         - ./nginx/conf.d/:/etc/nginx/conf.d/
         - godot-build-dev:/build
         volumes:
         - ./nginx/conf.d/:/etc/nginx/conf.d/
         - godot-build-dev:/build
@@ -11,9 +12,14 @@ services:
         - 80:80
     redis:
         image: redis:alpine
         - 80:80
     redis:
         image: redis:alpine
+    hook:
+        build: ./hook
+        image: cjpalmer/godot-webhook:$DOCKER_TAG
+        depends_on:
+        - redis
     builder:
         build: ./builder
     builder:
         build: ./builder
-        image: cjpalmer/godot-builder:0.3.1
+        image: cjpalmer/godot-builder:$DOCKER_TAG
         volumes:
         - godot-build-dev:/build
         - godot-project:/project
         volumes:
         - godot-build-dev:/build
         - godot-project:/project
diff --git a/hook/Dockerfile b/hook/Dockerfile
new file mode 100644 (file)
index 0000000..056ac5b
--- /dev/null
@@ -0,0 +1,8 @@
+FROM httpd:2.4-alpine
+
+RUN apk add --no-cache redis
+
+ADD ./*.html /usr/local/apache2/htdocs/
+ADD ./*.lua  /usr/local/apache2/cgi-bin/
+
+ADD ./httpd.conf /usr/local/apache2/conf/httpd.conf
diff --git a/hook/build-request.html b/hook/build-request.html
new file mode 100644 (file)
index 0000000..97afac0
--- /dev/null
@@ -0,0 +1,24 @@
+<html>
+<head>
+<title>Snapshot Build Request</title>
+<script>
+function validate() {
+    return( true );
+}
+</script>
+</head>
+<body>
+<form name="get-search-pattern" onsubmit="return(validate());">
+
+<p>
+<h3>What snapshot URI should I build from?</h3>
+<input type="text" name="snapshot_uri" />
+</p>
+
+<p>
+<input type="submit" value="submit" />
+</p>
+
+</form>
+</body>
+</html>
diff --git a/hook/example.lua b/hook/example.lua
new file mode 100644 (file)
index 0000000..9e2c879
--- /dev/null
@@ -0,0 +1,32 @@
+require "apache2"
+require "string"
+
+--[[
+     This is the default method name for Lua handlers, see the optional
+     function-name in the LuaMapHandler directive to choose a different
+     entry point.
+--]]
+function handle(r)
+    r.content_type = "text/plain"
+
+    if r.method == 'GET' then
+        r:puts("Hello Lua World!\n")
+        for k, v in pairs( r:parseargs() ) do
+            r:puts( string.format("%s: %s\n", k, v) )
+        end
+    elseif r.method == 'POST' then
+        r:puts("Hello Lua World!\n")
+        for k, v in pairs( r:parsebody() ) do
+            r:puts( string.format("%s: %s\n", k, v) )
+        end
+    elseif r.method == 'PUT' then
+-- use our own Error contents
+        r:puts("Unsupported HTTP method " .. r.method)
+        r.status = 405
+        return apache2.OK
+    else
+-- use the ErrorDocument
+        return 501
+    end
+    return apache2.OK
+end
diff --git a/hook/httpd.conf b/hook/httpd.conf
new file mode 100644 (file)
index 0000000..d588173
--- /dev/null
@@ -0,0 +1,557 @@
+#\r
+# This is the main Apache HTTP server configuration file.  It contains the\r
+# configuration directives that give the server its instructions.\r
+# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.\r
+# In particular, see \r
+# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>\r
+# for a discussion of each configuration directive.\r
+#\r
+# Do NOT simply read the instructions in here without understanding\r
+# what they do.  They're here only as hints or reminders.  If you are unsure\r
+# consult the online docs. You have been warned.  \r
+#\r
+# Configuration and logfile names: If the filenames you specify for many\r
+# of the server's control files begin with "/" (or "drive:/" for Win32), the\r
+# server will use that explicit path.  If the filenames do *not* begin\r
+# with "/", the value of ServerRoot is prepended -- so "logs/access_log"\r
+# with ServerRoot set to "/usr/local/apache2" will be interpreted by the\r
+# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" \r
+# will be interpreted as '/logs/access_log'.\r
+\r
+#\r
+# ServerRoot: The top of the directory tree under which the server's\r
+# configuration, error, and log files are kept.\r
+#\r
+# Do not add a slash at the end of the directory path.  If you point\r
+# ServerRoot at a non-local disk, be sure to specify a local disk on the\r
+# Mutex directive, if file-based mutexes are used.  If you wish to share the\r
+# same ServerRoot for multiple httpd daemons, you will need to change at\r
+# least PidFile.\r
+#\r
+ServerRoot "/usr/local/apache2"\r
+\r
+#\r
+# Mutex: Allows you to set the mutex mechanism and mutex file directory\r
+# for individual mutexes, or change the global defaults\r
+#\r
+# Uncomment and change the directory if mutexes are file-based and the default\r
+# mutex file directory is not on a local disk or is not appropriate for some\r
+# other reason.\r
+#\r
+# Mutex default:logs\r
+\r
+#\r
+# Listen: Allows you to bind Apache to specific IP addresses and/or\r
+# ports, instead of the default. See also the <VirtualHost>\r
+# directive.\r
+#\r
+# Change this to Listen on specific IP addresses as shown below to \r
+# prevent Apache from glomming onto all bound IP addresses.\r
+#\r
+#Listen 12.34.56.78:80\r
+Listen 80\r
+\r
+#\r
+# Dynamic Shared Object (DSO) Support\r
+#\r
+# To be able to use the functionality of a module which was built as a DSO you\r
+# have to place corresponding `LoadModule' lines at this location so the\r
+# directives contained in it are actually available _before_ they are used.\r
+# Statically compiled modules (those listed by `httpd -l') do not need\r
+# to be loaded here.\r
+#\r
+# Example:\r
+# LoadModule foo_module modules/mod_foo.so\r
+#\r
+LoadModule mpm_event_module modules/mod_mpm_event.so\r
+#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so\r
+#LoadModule mpm_worker_module modules/mod_mpm_worker.so\r
+LoadModule authn_file_module modules/mod_authn_file.so\r
+#LoadModule authn_dbm_module modules/mod_authn_dbm.so\r
+#LoadModule authn_anon_module modules/mod_authn_anon.so\r
+#LoadModule authn_dbd_module modules/mod_authn_dbd.so\r
+#LoadModule authn_socache_module modules/mod_authn_socache.so\r
+LoadModule authn_core_module modules/mod_authn_core.so\r
+LoadModule authz_host_module modules/mod_authz_host.so\r
+LoadModule authz_groupfile_module modules/mod_authz_groupfile.so\r
+LoadModule authz_user_module modules/mod_authz_user.so\r
+#LoadModule authz_dbm_module modules/mod_authz_dbm.so\r
+#LoadModule authz_owner_module modules/mod_authz_owner.so\r
+#LoadModule authz_dbd_module modules/mod_authz_dbd.so\r
+LoadModule authz_core_module modules/mod_authz_core.so\r
+#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so\r
+#LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.so\r
+LoadModule access_compat_module modules/mod_access_compat.so\r
+LoadModule auth_basic_module modules/mod_auth_basic.so\r
+#LoadModule auth_form_module modules/mod_auth_form.so\r
+#LoadModule auth_digest_module modules/mod_auth_digest.so\r
+#LoadModule allowmethods_module modules/mod_allowmethods.so\r
+#LoadModule isapi_module modules/mod_isapi.so\r
+#LoadModule file_cache_module modules/mod_file_cache.so\r
+#LoadModule cache_module modules/mod_cache.so\r
+#LoadModule cache_disk_module modules/mod_cache_disk.so\r
+#LoadModule cache_socache_module modules/mod_cache_socache.so\r
+#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so\r
+#LoadModule socache_dbm_module modules/mod_socache_dbm.so\r
+#LoadModule socache_memcache_module modules/mod_socache_memcache.so\r
+#LoadModule socache_redis_module modules/mod_socache_redis.so\r
+#LoadModule watchdog_module modules/mod_watchdog.so\r
+#LoadModule macro_module modules/mod_macro.so\r
+#LoadModule dbd_module modules/mod_dbd.so\r
+#LoadModule bucketeer_module modules/mod_bucketeer.so\r
+#LoadModule dumpio_module modules/mod_dumpio.so\r
+#LoadModule echo_module modules/mod_echo.so\r
+#LoadModule example_hooks_module modules/mod_example_hooks.so\r
+#LoadModule case_filter_module modules/mod_case_filter.so\r
+#LoadModule case_filter_in_module modules/mod_case_filter_in.so\r
+#LoadModule example_ipc_module modules/mod_example_ipc.so\r
+#LoadModule buffer_module modules/mod_buffer.so\r
+#LoadModule data_module modules/mod_data.so\r
+#LoadModule ratelimit_module modules/mod_ratelimit.so\r
+LoadModule reqtimeout_module modules/mod_reqtimeout.so\r
+#LoadModule ext_filter_module modules/mod_ext_filter.so\r
+#LoadModule request_module modules/mod_request.so\r
+#LoadModule include_module modules/mod_include.so\r
+LoadModule filter_module modules/mod_filter.so\r
+#LoadModule reflector_module modules/mod_reflector.so\r
+#LoadModule substitute_module modules/mod_substitute.so\r
+#LoadModule sed_module modules/mod_sed.so\r
+#LoadModule charset_lite_module modules/mod_charset_lite.so\r
+#LoadModule deflate_module modules/mod_deflate.so\r
+#LoadModule xml2enc_module modules/mod_xml2enc.so\r
+#LoadModule proxy_html_module modules/mod_proxy_html.so\r
+#LoadModule brotli_module modules/mod_brotli.so\r
+LoadModule mime_module modules/mod_mime.so\r
+#LoadModule ldap_module modules/mod_ldap.so\r
+LoadModule log_config_module modules/mod_log_config.so\r
+#LoadModule log_debug_module modules/mod_log_debug.so\r
+#LoadModule log_forensic_module modules/mod_log_forensic.so\r
+#LoadModule logio_module modules/mod_logio.so\r
+LoadModule lua_module modules/mod_lua.so\r
+LoadModule env_module modules/mod_env.so\r
+#LoadModule mime_magic_module modules/mod_mime_magic.so\r
+#LoadModule cern_meta_module modules/mod_cern_meta.so\r
+#LoadModule expires_module modules/mod_expires.so\r
+LoadModule headers_module modules/mod_headers.so\r
+#LoadModule ident_module modules/mod_ident.so\r
+#LoadModule usertrack_module modules/mod_usertrack.so\r
+#LoadModule unique_id_module modules/mod_unique_id.so\r
+LoadModule setenvif_module modules/mod_setenvif.so\r
+LoadModule version_module modules/mod_version.so\r
+#LoadModule remoteip_module modules/mod_remoteip.so\r
+#LoadModule proxy_module modules/mod_proxy.so\r
+#LoadModule proxy_connect_module modules/mod_proxy_connect.so\r
+#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so\r
+#LoadModule proxy_http_module modules/mod_proxy_http.so\r
+#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so\r
+#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so\r
+#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so\r
+#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so\r
+#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so\r
+#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so\r
+#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so\r
+#LoadModule proxy_express_module modules/mod_proxy_express.so\r
+#LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so\r
+#LoadModule session_module modules/mod_session.so\r
+#LoadModule session_cookie_module modules/mod_session_cookie.so\r
+#LoadModule session_crypto_module modules/mod_session_crypto.so\r
+#LoadModule session_dbd_module modules/mod_session_dbd.so\r
+#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so\r
+#LoadModule slotmem_plain_module modules/mod_slotmem_plain.so\r
+#LoadModule ssl_module modules/mod_ssl.so\r
+#LoadModule optional_hook_export_module modules/mod_optional_hook_export.so\r
+#LoadModule optional_hook_import_module modules/mod_optional_hook_import.so\r
+#LoadModule optional_fn_import_module modules/mod_optional_fn_import.so\r
+#LoadModule optional_fn_export_module modules/mod_optional_fn_export.so\r
+#LoadModule dialup_module modules/mod_dialup.so\r
+#LoadModule http2_module modules/mod_http2.so\r
+#LoadModule proxy_http2_module modules/mod_proxy_http2.so\r
+#LoadModule md_module modules/mod_md.so\r
+#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\r
+#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so\r
+#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so\r
+#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so\r
+LoadModule unixd_module modules/mod_unixd.so\r
+#LoadModule heartbeat_module modules/mod_heartbeat.so\r
+#LoadModule heartmonitor_module modules/mod_heartmonitor.so\r
+#LoadModule dav_module modules/mod_dav.so\r
+LoadModule status_module modules/mod_status.so\r
+LoadModule autoindex_module modules/mod_autoindex.so\r
+#LoadModule asis_module modules/mod_asis.so\r
+#LoadModule info_module modules/mod_info.so\r
+#LoadModule suexec_module modules/mod_suexec.so\r
+<IfModule !mpm_prefork_module>\r
+       #LoadModule cgid_module modules/mod_cgid.so\r
+</IfModule>\r
+<IfModule mpm_prefork_module>\r
+       #LoadModule cgi_module modules/mod_cgi.so\r
+</IfModule>\r
+#LoadModule dav_fs_module modules/mod_dav_fs.so\r
+#LoadModule dav_lock_module modules/mod_dav_lock.so\r
+#LoadModule vhost_alias_module modules/mod_vhost_alias.so\r
+#LoadModule negotiation_module modules/mod_negotiation.so\r
+LoadModule dir_module modules/mod_dir.so\r
+#LoadModule imagemap_module modules/mod_imagemap.so\r
+#LoadModule actions_module modules/mod_actions.so\r
+#LoadModule speling_module modules/mod_speling.so\r
+#LoadModule userdir_module modules/mod_userdir.so\r
+LoadModule alias_module modules/mod_alias.so\r
+#LoadModule rewrite_module modules/mod_rewrite.so\r
+\r
+<IfModule unixd_module>\r
+#\r
+# If you wish httpd to run as a different user or group, you must run\r
+# httpd as root initially and it will switch.  \r
+#\r
+# User/Group: The name (or #number) of the user/group to run httpd as.\r
+# It is usually good practice to create a dedicated user and group for\r
+# running httpd, as with most system services.\r
+#\r
+User www-data\r
+Group www-data\r
+\r
+</IfModule>\r
+\r
+# 'Main' server configuration\r
+#\r
+# The directives in this section set up the values used by the 'main'\r
+# server, which responds to any requests that aren't handled by a\r
+# <VirtualHost> definition.  These values also provide defaults for\r
+# any <VirtualHost> containers you may define later in the file.\r
+#\r
+# All of these directives may appear inside <VirtualHost> containers,\r
+# in which case these default settings will be overridden for the\r
+# virtual host being defined.\r
+#\r
+\r
+#\r
+# ServerAdmin: Your address, where problems with the server should be\r
+# e-mailed.  This address appears on some server-generated pages, such\r
+# as error documents.  e.g. admin@your-domain.com\r
+#\r
+ServerAdmin you@example.com\r
+\r
+#\r
+# ServerName gives the name and port that the server uses to identify itself.\r
+# This can often be determined automatically, but we recommend you specify\r
+# it explicitly to prevent problems during startup.\r
+#\r
+# If your host doesn't have a registered DNS name, enter its IP address here.\r
+#\r
+#ServerName www.example.com:80\r
+\r
+#\r
+# Deny access to the entirety of your server's filesystem. You must\r
+# explicitly permit access to web content directories in other \r
+# <Directory> blocks below.\r
+#\r
+<Directory />\r
+    AllowOverride none\r
+    Require all denied\r
+</Directory>\r
+\r
+#\r
+# Note that from this point forward you must specifically allow\r
+# particular features to be enabled - so if something's not working as\r
+# you might expect, make sure that you have specifically enabled it\r
+# below.\r
+#\r
+\r
+#\r
+# DocumentRoot: The directory out of which you will serve your\r
+# documents. By default, all requests are taken from this directory, but\r
+# symbolic links and aliases may be used to point to other locations.\r
+#\r
+DocumentRoot "/usr/local/apache2/htdocs"\r
+<Directory "/usr/local/apache2/htdocs">\r
+    #\r
+    # Possible values for the Options directive are "None", "All",\r
+    # or any combination of:\r
+    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews\r
+    #\r
+    # Note that "MultiViews" must be named *explicitly* --- "Options All"\r
+    # doesn't give it to you.\r
+    #\r
+    # The Options directive is both complicated and important.  Please see\r
+    # http://httpd.apache.org/docs/2.4/mod/core.html#options\r
+    # for more information.\r
+    #\r
+    Options Indexes FollowSymLinks\r
+\r
+    #\r
+    # AllowOverride controls what directives may be placed in .htaccess files.\r
+    # It can be "All", "None", or any combination of the keywords:\r
+    #   AllowOverride FileInfo AuthConfig Limit\r
+    #\r
+    AllowOverride None\r
+\r
+    #\r
+    # Controls who can get stuff from this server.\r
+    #\r
+    Require all granted\r
+</Directory>\r
+\r
+#\r
+# DirectoryIndex: sets the file that Apache will serve if a directory\r
+# is requested.\r
+#\r
+<IfModule dir_module>\r
+    DirectoryIndex index.html\r
+</IfModule>\r
+\r
+#\r
+# The following lines prevent .htaccess and .htpasswd files from being \r
+# viewed by Web clients. \r
+#\r
+<Files ".ht*">\r
+    Require all denied\r
+</Files>\r
+\r
+# run lua scripts using ".lua" extension\r
+<Files "*.lua">\r
+    SetHandler lua-script\r
+</Files>\r
+\r
+#\r
+# ErrorLog: The location of the error log file.\r
+# If you do not specify an ErrorLog directive within a <VirtualHost>\r
+# container, error messages relating to that virtual host will be\r
+# logged here.  If you *do* define an error logfile for a <VirtualHost>\r
+# container, that host's errors will be logged there and not here.\r
+#\r
+ErrorLog /proc/self/fd/2\r
+\r
+#\r
+# LogLevel: Control the number of messages logged to the error_log.\r
+# Possible values include: debug, info, notice, warn, error, crit,\r
+# alert, emerg.\r
+#\r
+LogLevel warn\r
+\r
+<IfModule log_config_module>\r
+    #\r
+    # The following directives define some format nicknames for use with\r
+    # a CustomLog directive (see below).\r
+    #\r
+    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined\r
+    LogFormat "%h %l %u %t \"%r\" %>s %b" common\r
+\r
+    <IfModule logio_module>\r
+      # You need to enable mod_logio.c to use %I and %O\r
+      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio\r
+    </IfModule>\r
+\r
+    #\r
+    # The location and format of the access logfile (Common Logfile Format).\r
+    # If you do not define any access logfiles within a <VirtualHost>\r
+    # container, they will be logged here.  Contrariwise, if you *do*\r
+    # define per-<VirtualHost> access logfiles, transactions will be\r
+    # logged therein and *not* in this file.\r
+    #\r
+    CustomLog /proc/self/fd/1 common\r
+\r
+    #\r
+    # If you prefer a logfile with access, agent, and referer information\r
+    # (Combined Logfile Format) you can use the following directive.\r
+    #\r
+    #CustomLog "logs/access_log" combined\r
+</IfModule>\r
+\r
+<IfModule alias_module>\r
+    #\r
+    # Redirect: Allows you to tell clients about documents that used to \r
+    # exist in your server's namespace, but do not anymore. The client \r
+    # will make a new request for the document at its new location.\r
+    # Example:\r
+    # Redirect permanent /foo http://www.example.com/bar\r
+\r
+    #\r
+    # Alias: Maps web paths into filesystem paths and is used to\r
+    # access content that does not live under the DocumentRoot.\r
+    # Example:\r
+    # Alias /webpath /full/filesystem/path\r
+    #\r
+    # If you include a trailing / on /webpath then the server will\r
+    # require it to be present in the URL.  You will also likely\r
+    # need to provide a <Directory> section to allow access to\r
+    # the filesystem path.\r
+\r
+    #\r
+    # ScriptAlias: This controls which directories contain server scripts. \r
+    # ScriptAliases are essentially the same as Aliases, except that\r
+    # documents in the target directory are treated as applications and\r
+    # run by the server when requested rather than as documents sent to the\r
+    # client.  The same rules about trailing "/" apply to ScriptAlias\r
+    # directives as to Alias.\r
+    #\r
+    ScriptAlias /hook/ "/usr/local/apache2/cgi-bin/"\r
+\r
+</IfModule>\r
+\r
+<IfModule cgid_module>\r
+    #\r
+    # ScriptSock: On threaded servers, designate the path to the UNIX\r
+    # socket used to communicate with the CGI daemon of mod_cgid.\r
+    #\r
+    #Scriptsock cgisock\r
+</IfModule>\r
+\r
+#\r
+# "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased\r
+# CGI directory exists, if you have that configured.\r
+#\r
+<Directory "/usr/local/apache2/cgi-bin">\r
+    AllowOverride None\r
+    Options Indexes FollowSymLinks\r
+    #Options None\r
+    Require all granted\r
+</Directory>\r
+\r
+<IfModule headers_module>\r
+    #\r
+    # Avoid passing HTTP_PROXY environment to CGI's on this or any proxied\r
+    # backend servers which have lingering "httpoxy" defects.\r
+    # 'Proxy' request header is undefined by the IETF, not listed by IANA\r
+    #\r
+    RequestHeader unset Proxy early\r
+</IfModule>\r
+\r
+<IfModule mime_module>\r
+    #\r
+    # TypesConfig points to the file containing the list of mappings from\r
+    # filename extension to MIME-type.\r
+    #\r
+    TypesConfig conf/mime.types\r
+\r
+    #\r
+    # AddType allows you to add to or override the MIME configuration\r
+    # file specified in TypesConfig for specific file types.\r
+    #\r
+    #AddType application/x-gzip .tgz\r
+    #\r
+    # AddEncoding allows you to have certain browsers uncompress\r
+    # information on the fly. Note: Not all browsers support this.\r
+    #\r
+    #AddEncoding x-compress .Z\r
+    #AddEncoding x-gzip .gz .tgz\r
+    #\r
+    # If the AddEncoding directives above are commented-out, then you\r
+    # probably should define those extensions to indicate media types:\r
+    #\r
+    AddType application/x-compress .Z\r
+    AddType application/x-gzip .gz .tgz\r
+\r
+    #\r
+    # AddHandler allows you to map certain file extensions to "handlers":\r
+    # actions unrelated to filetype. These can be either built into the server\r
+    # or added with the Action directive (see below)\r
+    #\r
+    # To use CGI scripts outside of ScriptAliased directories:\r
+    # (You will also need to add "ExecCGI" to the "Options" directive.)\r
+    #\r
+    #AddHandler cgi-script .cgi\r
+\r
+    # For type maps (negotiated resources):\r
+    #AddHandler type-map var\r
+\r
+    #\r
+    # Filters allow you to process content before it is sent to the client.\r
+    #\r
+    # To parse .shtml files for server-side includes (SSI):\r
+    # (You will also need to add "Includes" to the "Options" directive.)\r
+    #\r
+    #AddType text/html .shtml\r
+    #AddOutputFilter INCLUDES .shtml\r
+</IfModule>\r
+\r
+#\r
+# The mod_mime_magic module allows the server to use various hints from the\r
+# contents of the file itself to determine its type.  The MIMEMagicFile\r
+# directive tells the module where the hint definitions are located.\r
+#\r
+#MIMEMagicFile conf/magic\r
+\r
+#\r
+# Customizable error responses come in three flavors:\r
+# 1) plain text 2) local redirects 3) external redirects\r
+#\r
+# Some examples:\r
+#ErrorDocument 500 "The server made a boo boo."\r
+#ErrorDocument 404 /missing.html\r
+#ErrorDocument 404 "/cgi-bin/missing_handler.pl"\r
+#ErrorDocument 402 http://www.example.com/subscription_info.html\r
+#\r
+\r
+#\r
+# MaxRanges: Maximum number of Ranges in a request before\r
+# returning the entire resource, or one of the special\r
+# values 'default', 'none' or 'unlimited'.\r
+# Default setting is to accept 200 Ranges.\r
+#MaxRanges unlimited\r
+\r
+#\r
+# EnableMMAP and EnableSendfile: On systems that support it, \r
+# memory-mapping or the sendfile syscall may be used to deliver\r
+# files.  This usually improves server performance, but must\r
+# be turned off when serving from networked-mounted \r
+# filesystems or if support for these functions is otherwise\r
+# broken on your system.\r
+# Defaults: EnableMMAP On, EnableSendfile Off\r
+#\r
+#EnableMMAP off\r
+#EnableSendfile on\r
+\r
+# Supplemental configuration\r
+#\r
+# The configuration files in the conf/extra/ directory can be \r
+# included to add extra features or to modify the default configuration of \r
+# the server, or you may simply copy their contents here and change as \r
+# necessary.\r
+\r
+# Server-pool management (MPM specific)\r
+#Include conf/extra/httpd-mpm.conf\r
+\r
+# Multi-language error messages\r
+#Include conf/extra/httpd-multilang-errordoc.conf\r
+\r
+# Fancy directory listings\r
+#Include conf/extra/httpd-autoindex.conf\r
+\r
+# Language settings\r
+#Include conf/extra/httpd-languages.conf\r
+\r
+# User home directories\r
+#Include conf/extra/httpd-userdir.conf\r
+\r
+# Real-time info on requests and configuration\r
+#Include conf/extra/httpd-info.conf\r
+\r
+# Virtual hosts\r
+#Include conf/extra/httpd-vhosts.conf\r
+\r
+# Local access to the Apache HTTP Server Manual\r
+#Include conf/extra/httpd-manual.conf\r
+\r
+# Distributed authoring and versioning (WebDAV)\r
+#Include conf/extra/httpd-dav.conf\r
+\r
+# Various default settings\r
+#Include conf/extra/httpd-default.conf\r
+\r
+# Configure mod_proxy_html to understand HTML4/XHTML1\r
+<IfModule proxy_html_module>\r
+Include conf/extra/proxy-html.conf\r
+</IfModule>\r
+\r
+# Secure (SSL/TLS) connections\r
+#Include conf/extra/httpd-ssl.conf\r
+#\r
+# Note: The following must must be present to support\r
+#       starting without SSL on platforms with no /dev/random equivalent\r
+#       but a statically compiled-in mod_ssl.\r
+#\r
+<IfModule ssl_module>\r
+SSLRandomSeed startup builtin\r
+SSLRandomSeed connect builtin\r
+</IfModule>\r
+\r
diff --git a/hook/make-build-request.lua b/hook/make-build-request.lua
new file mode 100644 (file)
index 0000000..8634cb2
--- /dev/null
@@ -0,0 +1,45 @@
+require "apache2"
+
+--[[
+If a snapshot link is given, then push it onto the builder redis queue
+
+Example snapshot link:
+https://git.purplebirdman.com/wolf-seeking-sheep.git/snapshot/127ef0ef17ec1067f77bb7097e84a537a4a01ec7.tar.gz
+]]--
+
+function lpush_onto_job_queue(s)
+    local cmd = ("redis-cli -h redis LPUSH snapshots %s"):format(s)
+    local handle = io.popen(cmd)
+    local output = handle:read('*a')
+    handle:close()
+
+    return output
+end
+
+function dump_file(s)
+    local handle = io.open(s)
+    local output = handle:read('*a')
+    handle:close()
+
+    return output;
+end
+
+function handle(r)
+    r.content_type = "text/html"
+
+    local args = r:parseargs()
+    local snapshot_uri = args.snapshot_uri
+
+    if snapshot_uri then
+        -- filename might have spaces that apache replaces with '+'
+        snapshot_uri = string.gsub(snapshot_uri, '+', ' ')
+        snapshot_uri = string.gsub(snapshot_uri, '%%2F', '/')
+
+        local out = lpush_onto_job_queue(snapshot_uri)
+        r:puts( out )
+        return apache2.OK
+    else
+        r:puts( dump_file(r.document_root .. '/build-request.html') )
+        return apache2.OK
+    end
+end
diff --git a/nginx/Dockerfile b/nginx/Dockerfile
new file mode 100644 (file)
index 0000000..9bbed94
--- /dev/null
@@ -0,0 +1,3 @@
+FROM nginx:1.27-alpine
+
+RUN apk add --no-cache redis
index 3acaff1c805dff9d9341e2e73d78be42c2383f6a..2ef0e053615ccaec3616f601dee08358bb826102 100644 (file)
@@ -7,6 +7,10 @@ server {
         autoindex on;
     }
 
         autoindex on;
     }
 
+    location /hook/ {
+        proxy_pass http://hook;
+    }
+
     #------------------------------------------------
     # Adds required support for Godot 4 WebGL Support
     #------------------------------------------------
     #------------------------------------------------
     # Adds required support for Godot 4 WebGL Support
     #------------------------------------------------