commit 7497efbf9babb23a5c2b53854b3adb77f1d6aa4e Author: Dirk Heilig Date: Thu Apr 4 16:15:42 2024 +0200 first commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..49a2433 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM debian:12 +RUN apt-get update && apt-get upgrade -y && apt-get clean +RUN apt-get install -y supervisor apache2 php libapache2-mod-php php-mbstring php-zip curl git openscad zip +RUN apt-get clean +RUN chown -R www-data:www-data /var/www +RUN curl https://files.openscad.org/snapshots/OpenSCAD-2024.03.28.ai18952-x86_64.AppImage > /tmp/openscad +RUN chmod +x /tmp/openscad +WORKDIR /opt +RUN /tmp/openscad --appimage-extract +RUN ln -s /opt/squashfs-root/usr/bin/openscad /usr/local/bin/openscad +USER 33:33 +WORKDIR /var/www +RUN mkdir -p /var/www/html +RUN rm -rf /var/www/html/* +RUN ln -s /var/www/src/index.php /var/www/html/index.php +RUN mkdir queue +RUN git clone https://git.c3re.de/dirk/AuerNameTag.git +ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf +ADD src /var/www/src +USER root +CMD ["/usr/bin/supervisord", "-c" , "/etc/supervisor/conf.d/supervisord.conf"] diff --git a/devrun b/devrun new file mode 100755 index 0000000..bb1b71b --- /dev/null +++ b/devrun @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -e +docker build -t taggor . +docker run -p 8888:80 -v "$PWD/src:/var/www/src" --rm -it taggor "$@" \ No newline at end of file diff --git a/src/index.php b/src/index.php new file mode 100644 index 0000000..7e94fa0 --- /dev/null +++ b/src/index.php @@ -0,0 +1,112 @@ + + + c3RE AuerBoxTag Generator (Download starting) + + + +Your job $jobId is Finished. + +Back + + +EOT; + + + + } + header('HTTP/1.1 404 Not Found'); + exit; + } + + $myPositionInQueue++; + + echo << + + c3RE AuerBoxTag Generator ($myPositionInQueue) + + + +Your job $jobId is $myPositionInQueue in the queue. + + +EOT; + exit; +} + + + +$err=''; +switch($_GET['err']){ + case 'notags': + $err='Please provide at least one tag'; + break; +} +?> + + + c3RE AuerBoxTag Generator + + +

c3RE AuerBoxTag Generator

+
+
+ +
+
+ +
+ + diff --git a/src/queue b/src/queue new file mode 100755 index 0000000..00729ba --- /dev/null +++ b/src/queue @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +cd "$( dirname "${BASH_SOURCE[0]}" )" +while :; do + sleep 5 & + ./queueWorker >> /var/www/html/log.txt + wait +done \ No newline at end of file diff --git a/src/queueWorker b/src/queueWorker new file mode 100755 index 0000000..a8f727e --- /dev/null +++ b/src/queueWorker @@ -0,0 +1,45 @@ +#!/usr/bin/env php +