yay, progress!

This commit is contained in:
Michael Becker 2025-01-12 23:27:27 -05:00
parent ceb24e8b01
commit 0c8962cdfb
6 changed files with 82 additions and 32 deletions

View File

@ -1,13 +1,5 @@
#!/bin/bash
SUV_ID=$(hexdump -vn8 -e'2/4 "%08x" 1 "\n"' /dev/urandom)
SUV_NAME=i-0$SUV_ID
echo "Building SUV $SUV_NAME ..."
# *** DO NOT REMOVE THE FIRST DOT ***
SUV_DOMAINNAME=".privatesuv.com"
# build the image (i.e. 'mocha suv init' )
docker build -t mocha-httpd -f mocha-suv/docker/Dockerfile .
@ -18,16 +10,16 @@ if [ $? -ne 0 ]; then
fi
docker network create --driver=bridge --subnet=10.7.0.0/16 --ip-range=10.7.0.0/24 --gateway=10.7.0.1 mocha-docker
NETWORK_NAME=mocha-docker
NETWORK_SUBNET=10.7
NETWORK_EXISTS=$(docker network ls | grep $NETWORK_NAME)
if [ "$NETWORK_EXISTS" == "" ]; then
docker network create --driver=bridge --subnet=$NETWORK_SUBNET.0.0/16 --ip-range=$NETWORK_SUBNET.0.0/24 --gateway=$NETWORK_SUBNET.0.1 $NETWORK_NAME
fi
# initiate a container (i.e. 'mocha suv up i-0...' )
# docker run --name $SUV_NAME -d -p 8000:80 --net mocha-docker mocha-httpd # -p 8000:80 mocha-httpd
# docker inspect $SUV_NAME
# SUV_IP=$(docker container exec $SUV_NAME hostname -i)
# echo "Enter administrative password to add entry to /etc/hosts file if wanted"
# echo -e "$SUV_IP\t\t$SUV_NAME$SUV_DOMAINNAME" | sudo tee -a /etc/hosts
# echo "$SUV_NAME : $SUV_IP"

12
docker-rm Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
NAMES=$(docker container ls -a --format '{{.Names}}' | grep i-0)
for NAME in $NAMES; do
echo $NAME
docker container rm -f $NAME
done

24
docker-run Normal file → Executable file
View File

@ -1,9 +1,9 @@
#!/bin/bash
./docker-build
USE_SSL=false
./docker-build
Q=$?
if [ $Q -ne 0 ]; then
@ -32,6 +32,8 @@ if [ $? -ne 0 ]; then
fi
SUV_NAME=i-0$SUV_ID
SUV_DOMAINNAME=.privatesuv.com
echo "provisioning new Docker-based SUV with id $SUV_NAME"
if [ $? -ne 0 ]; then
@ -45,7 +47,7 @@ fi
docker network create --subnet=10.8.0.0/16 mocha-docker
# initiate a container (i.e. 'mocha suv up i-0...' )
if [ $PORT_FORWARD != "" ]; then
if [ "$PORT_FORWARD" != "" ]; then
if [ "$USE_SSL" == "true" ]; then
@ -64,4 +66,18 @@ fi
echo "waiting for network to settle..."
sleep 3
docker inspect $SUV_NAME
# docker inspect $SUV_NAME
SUV_IP=$(docker container exec $SUV_NAME hostname -i)
if [ $? -ne 0 ]; then
echo "Something went wrong; please check your configuration"
else
echo "Enter administrative password to add entry to /etc/hosts file if wanted"
echo -e "$SUV_IP\t\t$SUV_NAME$SUV_DOMAINNAME" | sudo tee -a /etc/hosts
echo "$SUV_NAME : $SUV_IP"
fi

View File

@ -1,18 +1,29 @@
# FROM httpd
FROM ubuntu:24.04
FROM ubuntu
RUN apt update && apt upgrade -y && apt install -y php php-mbstring php-curl php-xml pwgen
RUN rm /usr/local/apache2/htdocs/index.html
# RUN rm /usr/local/apache2/htdocs/index.html
RUN rm /var/www/html/index.html
RUN a2enmod ssl && a2enmod rewrite
RUN service apache2 restart
COPY mocha-php/mocha-php/src/mocha-php /usr/local/apache2/htdocs/
# COPY mocha-php/mocha-php/src/mocha-php /usr/local/apache2/htdocs/
COPY mocha-php/mocha-php/src/mocha-php /var/www/html
COPY mocha-php/phast/lib/phast/server /var/www/html/lib/phast
COPY mocha-php/phast/lib/phast/client/scripts /var/www/html/scripts/phast
COPY mocha-suv/common/certs/localhost.crt /etc/ssl/certs
COPY mocha-suv/common/certs/localhost.key /etc/ssl/certs
COPY mocha-suv/docker/httpd.conf /usr/local/apache2/conf/httpd.conf
COPY mocha-suv/docker/ports.conf /usr/local/apache2/conf/ports.conf
COPY mocha-suv/docker/site.conf /usr/local/apache2/conf/site.conf
# COPY mocha-suv/docker/httpd.conf /usr/local/apache2/conf/httpd.conf
# COPY mocha-suv/docker/ports.conf /usr/local/apache2/conf/ports.conf
COPY mocha-suv/docker/ports.conf /etc/apache2/ports.conf
# COPY mocha-suv/docker/site.conf /usr/local/apache2/conf/site.conf
COPY mocha-suv/docker/site.conf /etc/apache2/sites-available/000-default.conf
EXPOSE 443
CMD [ "apache2ctl", "-D", "FOREGROUND" ]

View File

@ -0,0 +1,18 @@
<VirtualHost *:443>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/usr/local/apache2/htdocs"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
<Directory "/usr/local/apache2/htdocs">
AllowOverride all
</Directory>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/localhost.crt
SSLCertificateKeyFile /etc/ssl/certs/localhost.key
</VirtualHost>

View File

@ -1,12 +1,13 @@
<VirtualHost *:443>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/usr/local/apache2/htdocs"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
<Directory "/usr/local/apache2/htdocs">
DocumentRoot "/var/www/html"
ServerName dummy-host2.example.com
# ErrorLog "logs/dummy-host2.example.com-error_log"
# CustomLog "logs/dummy-host2.example.com-access_log" common
<Directory "/var/www/html">
AllowOverride all
</Directory>