Compare commits

..

No commits in common. "267a3b013b4813d65fae244c2dc666f4d26fef54" and "f4fa1e288982b91ab0659c9a3452c29998a1c2ef" have entirely different histories.

7 changed files with 13 additions and 65 deletions

View File

@ -1,21 +1,9 @@
FROM docker.io/library/httpd:2.4-alpine3.18 AS builder
RUN apk --no-cache add \
build-base \
m4 \
markdown
FROM alpine AS builder
RUN apk --no-cache add build-base m4 markdown
COPY . /src
RUN make -C /src DESTDIR=/tanks && \
make -C /src DESTDIR=/tanks install
RUN make -C /src DESTDIR=/tanks install
# dos2unix src/go.sh src/rank.awk src/round.sh src/summary.awk && \
FROM docker.io/library/httpd:2.4-alpine3.18
COPY --from=builder /tanks/bin /tanks/bin
COPY --from=builder /tanks/www /tanks/www-orig
COPY httpd.conf /usr/local/apache2/conf/httpd.conf
#RUN sed -i 's/\/usr\/local\/apache2\/htdocs/\/tanks\/www/' /usr/local/apache2/conf/httpd.conf && \
# sed -i 's/Options Indexes FollowSymLinks/Options Indexes FollowSymLinks ExecCGI\n AddHandler cgi-script .cgi\n SetEnv BASE_PATH \/tanks\/tanks\//' /usr/local/apache2/conf/httpd.conf
CMD [ "sh", "-c", "if [[ ! -d /tanks/www/ ]]; then mkdir /tanks/www/; fi && cp -ru /tanks/www-orig/* /tanks/www/ & /tanks/bin/go.sh" ]
FROM neale/eris
COPY --from=builder /tanks /tanks
CMD [ "/tanks/bin/go.sh" ]

View File

@ -17,7 +17,7 @@ install: $(BINARIES) $(HTML)
install summary.awk $(DESTDIR)/bin
install forftanks $(DESTDIR)/bin
install -d -o $(shell id -u www-data) -g $(shell id -g www-data) $(DESTDIR)/www
install -d -o $(id -u www) -g $(id -g www) $(DESTDIR)/www
install upload.cgi $(DESTDIR)/www
install -m 0644 $(HTML) $(DESTDIR)/www
install -m 0644 $(WWW) $(DESTDIR)/www

8
go.sh
View File

@ -1,16 +1,14 @@
#!/bin/sh
#! /bin/sh
cd $(dirname $0)/../www
export BASE_PATH=/tanks/www/state/
(
httpd-foreground
s6-tcpserver -u $(id -u www) -g $(id -g www) 0.0.0.0 80 /usr/bin/eris -c -.
) &
(
while true; do
../bin/round.sh /tanks/www/state/*
../bin/round.sh */
sleep 60
done
) &

View File

@ -1,38 +0,0 @@
ServerRoot "/usr/local/apache2"
Listen 80
LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule mime_module modules/mod_mime.so
LoadModule env_module modules/mod_env.so
LoadModule cgid_module modules/mod_cgid.so
LoadModule log_config_module modules/mod_log_config.so
<IfModule unixd_module>
User www-data
Group www-data
</IfModule>
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/tanks/www"
<Directory "/tanks/www">
Options Indexes FollowSymLinks ExecCGI
AddHandler cgi-script .cgi
PassEnv BASE_PATH
Require all granted
</Directory>
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog /dev/stdout common
</IfModule>
LogLevel warn
ErrorLog /dev/stderr

View File

@ -75,6 +75,7 @@ END {
printf("<td>" reason[me] "</td>");
printf("<td>" lasterr[me] "</td>");
printf("</tr>\n");
printf("<!-- score " path[me] " " i " -->\n");
}
}
}

View File

@ -1,4 +1,4 @@
#!/bin/sh
#! /bin/sh
if [ "$#" -gt 0 ]; then
tanks="$@"

View File

@ -285,8 +285,7 @@ main(int argc, char *argv[])
snprintf(path, sizeof(path), "%s%s/", BASE_PATH, token);
if (-1 == stat(path, &st))
//return croak(422, "Invalid token");
return croak(422, path);
return croak(422, "Invalid token");
if (!S_ISDIR(st.st_mode))
return croak(422, "Invalid token");
for (i = 0; entries[i].name; i += 1) {