mirror of https://github.com/dirtbags/tanks.git
Compare commits
No commits in common. "267a3b013b4813d65fae244c2dc666f4d26fef54" and "f4fa1e288982b91ab0659c9a3452c29998a1c2ef" have entirely different histories.
267a3b013b
...
f4fa1e2889
24
Dockerfile
24
Dockerfile
|
@ -1,21 +1,9 @@
|
||||||
FROM docker.io/library/httpd:2.4-alpine3.18 AS builder
|
FROM alpine AS builder
|
||||||
|
|
||||||
RUN apk --no-cache add \
|
|
||||||
build-base \
|
|
||||||
m4 \
|
|
||||||
markdown
|
|
||||||
|
|
||||||
|
RUN apk --no-cache add build-base m4 markdown
|
||||||
COPY . /src
|
COPY . /src
|
||||||
RUN make -C /src DESTDIR=/tanks && \
|
RUN make -C /src DESTDIR=/tanks install
|
||||||
make -C /src DESTDIR=/tanks install
|
|
||||||
|
|
||||||
# dos2unix src/go.sh src/rank.awk src/round.sh src/summary.awk && \
|
FROM neale/eris
|
||||||
|
COPY --from=builder /tanks /tanks
|
||||||
|
CMD [ "/tanks/bin/go.sh" ]
|
||||||
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" ]
|
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -17,7 +17,7 @@ install: $(BINARIES) $(HTML)
|
||||||
install summary.awk $(DESTDIR)/bin
|
install summary.awk $(DESTDIR)/bin
|
||||||
install forftanks $(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 upload.cgi $(DESTDIR)/www
|
||||||
install -m 0644 $(HTML) $(DESTDIR)/www
|
install -m 0644 $(HTML) $(DESTDIR)/www
|
||||||
install -m 0644 $(WWW) $(DESTDIR)/www
|
install -m 0644 $(WWW) $(DESTDIR)/www
|
||||||
|
|
8
go.sh
8
go.sh
|
@ -1,16 +1,14 @@
|
||||||
#!/bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
cd $(dirname $0)/../www
|
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
|
while true; do
|
||||||
../bin/round.sh /tanks/www/state/*
|
../bin/round.sh */
|
||||||
sleep 60
|
sleep 60
|
||||||
done
|
done
|
||||||
) &
|
) &
|
||||||
|
|
38
httpd.conf
38
httpd.conf
|
@ -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
|
|
1
rank.awk
1
rank.awk
|
@ -75,6 +75,7 @@ END {
|
||||||
printf("<td>" reason[me] "</td>");
|
printf("<td>" reason[me] "</td>");
|
||||||
printf("<td>" lasterr[me] "</td>");
|
printf("<td>" lasterr[me] "</td>");
|
||||||
printf("</tr>\n");
|
printf("</tr>\n");
|
||||||
|
printf("<!-- score " path[me] " " i " -->\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
round.sh
2
round.sh
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
if [ "$#" -gt 0 ]; then
|
if [ "$#" -gt 0 ]; then
|
||||||
tanks="$@"
|
tanks="$@"
|
||||||
|
|
|
@ -285,8 +285,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
snprintf(path, sizeof(path), "%s%s/", BASE_PATH, token);
|
snprintf(path, sizeof(path), "%s%s/", BASE_PATH, token);
|
||||||
if (-1 == stat(path, &st))
|
if (-1 == stat(path, &st))
|
||||||
//return croak(422, "Invalid token");
|
return croak(422, "Invalid token");
|
||||||
return croak(422, path);
|
|
||||||
if (!S_ISDIR(st.st_mode))
|
if (!S_ISDIR(st.st_mode))
|
||||||
return croak(422, "Invalid token");
|
return croak(422, "Invalid token");
|
||||||
for (i = 0; entries[i].name; i += 1) {
|
for (i = 0; entries[i].name; i += 1) {
|
||||||
|
|
Loading…
Reference in New Issue