diff --git a/remote-website-container/Dockerfile b/remote-website-container/Dockerfile new file mode 100644 index 000000000..9e71dddb6 --- /dev/null +++ b/remote-website-container/Dockerfile @@ -0,0 +1,49 @@ +FROM alpine:latest + +# Install required packages +RUN apk update && apk add \ + vsftpd \ + nginx \ + php83 \ + php83-fpm \ + php83-opcache \ + php83-json \ + php83-mysqli \ + php83-mbstring \ + php83-session \ + php83-zlib \ + php83-curl \ + php83-phar \ + php83-dom \ + php83-fileinfo \ + php83-gd \ + php83-zip \ + php83-sqlite3 \ + php83-openssl \ + supervisor \ + shadow \ + openssl \ + gettext # For envsubst + +# Create shared group and configure users +RUN addgroup -g 1000 www_shared && \ + mkdir -p /var/www/html && \ + adduser -D -h /var/www/html -G www_shared -s /bin/false allsky && \ + adduser nginx www_shared && \ + chown allsky:www_shared /var/www/html && \ + chmod 2775 /var/www/html + +# Use configuration template +COPY vsftpd.conf.template /etc/vsftpd/ +COPY entrypoint.sh /entrypoint.sh + +# Configure other services +COPY nginx.conf /etc/nginx/nginx.conf +COPY supervisord.conf /etc/supervisord.conf + +# Copy Initial index.html +COPY index.html /var/www/html/index.html + +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/remote-website-container/entrypoint.sh b/remote-website-container/entrypoint.sh new file mode 100644 index 000000000..68e4b0638 --- /dev/null +++ b/remote-website-container/entrypoint.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +# Set default values +export PASV_ADDRESS=${PASV_ADDRESS:-$(curl -s https://api.ipify.org)} +export PASV_MIN_PORT=${PASV_MIN_PORT:-40000} +export PASV_MAX_PORT=${PASV_MAX_PORT:-40010} + +# Generate configuration from template +envsubst < /etc/vsftpd/vsftpd.conf.template > /etc/vsftpd/vsftpd.conf + +# Set FTP password (for Docker testing) +if [ -n "$FTP_PASSWORD" ]; then + echo "allsky:$FTP_PASSWORD" | chpasswd + echo "Using provided FTP password" +else + echo "allsky:$(openssl rand -base64 12)" | chpasswd +fi + +# Ensure default index.html exists if not provided by user +if [ ! -f /var/www/html/index.html ]; then + cat < /var/www/html/index.html + + + Allsky Remote Website is Available! + + +

Success! The Allsky Remote Website is Available!

+

Proceed with Remote Website Installation Script.

+ + +EOF +fi + +# Start services +exec supervisord -c /etc/supervisord.conf \ No newline at end of file diff --git a/remote-website-container/index.html b/remote-website-container/index.html new file mode 100644 index 000000000..bf50a74a3 --- /dev/null +++ b/remote-website-container/index.html @@ -0,0 +1,9 @@ + + + Allsky Remote Website is Available! + + +

Success! The Allsky Remote Website is Available!

+

Proceed with Remote Website Installation Script.

+ + \ No newline at end of file diff --git a/remote-website-container/nginx.conf b/remote-website-container/nginx.conf new file mode 100644 index 000000000..55e8dfc75 --- /dev/null +++ b/remote-website-container/nginx.conf @@ -0,0 +1,31 @@ +user nginx; +worker_processes auto; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + server_name localhost; + root /var/www/html; + index index.php index.html; + + location / { + try_files $uri $uri/ =404; + } + + location ~ \.php$ { + fastcgi_pass 127.0.0.1:9000; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } + } +} diff --git a/remote-website-container/notes.txt b/remote-website-container/notes.txt new file mode 100644 index 000000000..58d187ef7 --- /dev/null +++ b/remote-website-container/notes.txt @@ -0,0 +1,3 @@ +docker buildx build --no-cache --progress=plain -t czech12/allsky-remote-website:latest -t czech12/allsky-remote-website:allsky-web-ftp_v1.0 . + +docker push czech12/allsky-remote-website -a diff --git a/remote-website-container/supervisord.conf b/remote-website-container/supervisord.conf new file mode 100644 index 000000000..2c7590bab --- /dev/null +++ b/remote-website-container/supervisord.conf @@ -0,0 +1,28 @@ +[supervisord] +nodaemon=true +user=root + +[program:php-fpm] +command=php-fpm83 -F +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:nginx] +command=nginx -g "daemon off;" +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:vsftpd] +command=vsftpd /etc/vsftpd/vsftpd.conf +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +exitcodes=0,2 diff --git a/remote-website-container/vsftpd.conf.template b/remote-website-container/vsftpd.conf.template new file mode 100644 index 000000000..135a81ee1 --- /dev/null +++ b/remote-website-container/vsftpd.conf.template @@ -0,0 +1,18 @@ +listen=YES +listen_ipv6=NO +anonymous_enable=NO +local_enable=YES +write_enable=YES +local_umask=002 +dirmessage_enable=YES +xferlog_enable=YES +connect_from_port_20=NO +port_enable=NO +chroot_local_user=YES +allow_writeable_chroot=YES +pasv_enable=YES +pasv_min_port=${PASV_MIN_PORT} +pasv_max_port=${PASV_MAX_PORT} +pasv_address=${PASV_ADDRESS} +pasv_promiscuous=YES +seccomp_sandbox=NO \ No newline at end of file diff --git a/remote-website-container/vsftpd_.conf b/remote-website-container/vsftpd_.conf new file mode 100644 index 000000000..5cad69ecd --- /dev/null +++ b/remote-website-container/vsftpd_.conf @@ -0,0 +1,25 @@ +listen=YES +listen_ipv6=NO +anonymous_enable=NO +local_enable=YES +write_enable=YES +local_umask=002 +dirmessage_enable=YES +xferlog_enable=YES +xferlog_file=/dev/stdout +connect_from_port_20=NO +port_enable=NO +chroot_local_user=YES +allow_writeable_chroot=YES +pasv_enable=YES +pasv_min_port=40000 +pasv_max_port=40010 +pasv_address=0.0.0.0 +seccomp_sandbox=NO +background=NO +log_ftp_protocol=YES +require_ssl_reuse=NO +pasv_promiscuous=YES +userlist_enable=YES +userlist_file=/etc/vsftpd.userlist +userlist_deny=NO \ No newline at end of file