Add the ability to test the website locally
That serve the website to http://127.0.0.1:8080/ Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
This commit is contained in:
parent
44aa09777d
commit
58fc2a673d
|
@ -1,4 +1,5 @@
|
||||||
/untitled/
|
/untitled/
|
||||||
/id_oauth2_bearer
|
/id_oauth2_bearer
|
||||||
/index.html
|
/index.html
|
||||||
|
/lighttpd.conf
|
||||||
/website.tar.gz
|
/website.tar.gz
|
||||||
|
|
19
Makefile
19
Makefile
|
@ -35,12 +35,27 @@ build:
|
||||||
./build.sh
|
./build.sh
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@printf "%s\n\t%s\n\t%s\n\t%s\n" \
|
@printf "%s\n\t%s\n\t%s\n\t%s\n\t%s\n" \
|
||||||
"Available commands:" \
|
"Available commands:" \
|
||||||
"help # Print this help" \
|
"help # Print this help" \
|
||||||
|
"test # run lighttpd on localhost:8080" \
|
||||||
"upload # Upload the website to https://$(DOMAIN)" \
|
"upload # Upload the website to https://$(DOMAIN)" \
|
||||||
"website.tar.gz # Create a tarball of the website"
|
"website.tar.gz # Create a tarball of the website"
|
||||||
|
|
||||||
|
test: website.tar.gz
|
||||||
|
guix shell \
|
||||||
|
--container \
|
||||||
|
--network \
|
||||||
|
--emulate-fhs \
|
||||||
|
bash \
|
||||||
|
coreutils \
|
||||||
|
gzip \
|
||||||
|
lighttpd \
|
||||||
|
sed \
|
||||||
|
tar \
|
||||||
|
-- \
|
||||||
|
./serve.sh website.tar.gz
|
||||||
|
|
||||||
upload: website.tar.gz
|
upload: website.tar.gz
|
||||||
curl \
|
curl \
|
||||||
--oauth2-bearer `cat id_oauth2_bearer` \
|
--oauth2-bearer `cat id_oauth2_bearer` \
|
||||||
|
@ -54,6 +69,8 @@ index.html: index.html.tmpl
|
||||||
website.tar.gz: build index.html
|
website.tar.gz: build index.html
|
||||||
sed 's/DOMAIN/$(DOMAIN)/' index.html.tmpl > index.html
|
sed 's/DOMAIN/$(DOMAIN)/' index.html.tmpl > index.html
|
||||||
tar \
|
tar \
|
||||||
|
--exclude-vcs \
|
||||||
|
--exclude-vcs-ignores \
|
||||||
--format=gnu \
|
--format=gnu \
|
||||||
--mtime='1970-01-01 00:00Z' \
|
--mtime='1970-01-01 00:00Z' \
|
||||||
--owner=0 --group=0 --numeric-owner \
|
--owner=0 --group=0 --numeric-owner \
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
server.bind = "localhost"
|
||||||
|
server.port = 8080
|
||||||
|
server.document-root = "TMPDIR"
|
||||||
|
dir-listing.activate = "enable"
|
||||||
|
index-file.names = ( "index.html" )
|
||||||
|
mimetype.assign = (
|
||||||
|
".html" => "text/html",
|
||||||
|
".txt" => "text/plain",
|
||||||
|
".css" => "text/css",
|
||||||
|
".js" => "application/x-javascript",
|
||||||
|
".jpg" => "image/jpeg",
|
||||||
|
".jpeg" => "image/jpeg",
|
||||||
|
".gif" => "image/gif",
|
||||||
|
".png" => "image/png",
|
||||||
|
"" => "application/octet-stream"
|
||||||
|
)
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Copyright (C) 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo "$0 <path/to/tarball>"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -ne 1 ] ; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
basedir="$(dirname $(realpath $0))"
|
||||||
|
|
||||||
|
tarball="$1"
|
||||||
|
|
||||||
|
tmpdir="$(mktemp -d)"
|
||||||
|
|
||||||
|
tar xf "${tarball}" -C "${tmpdir}"
|
||||||
|
|
||||||
|
sed "s#TMPDIR#${tmpdir}#g" \
|
||||||
|
"${basedir}/lighttpd.conf.tmpl" > \
|
||||||
|
"${basedir}/lighttpd.conf"
|
||||||
|
|
||||||
|
lighttpd -f lighttpd.conf -D
|
Loading…
Reference in New Issue