Merge branch 'master' of gitea.azcona-becker.net:mochapowered/mocha-suv

This commit is contained in:
Michael Becker 2024-12-23 07:28:28 -05:00
commit fed3d1089c
6 changed files with 55 additions and 8 deletions

2
.gitignore vendored
View File

@ -15,3 +15,5 @@
# Provisioned SUVs # Provisioned SUVs
machines/ machines/
*.swp

17
docker-build Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# generate random UUID for new SUV
# thanks https://stackoverflow.com/questions/34328759
SUV_ID=$(hexdump -vn8 -e'2/4 "%08x" 1 "\n"' /dev/urandom)
SUV_NAME=i-0$SUV_ID
# build the image (i.e. 'mocha suv init' )
docker build -t mocha-httpd -f mocha-suv/docker/Dockerfile .
# initiate a container (i.e. 'mocha suv up i-0...' )
docker run --name $SUV_NAME -d --net mocha-docker -it mocha-httpd # -p 8000:80 mocha-httpd
echo "waiting for network to settle..."
sleep 3
docker inspect $SUV_NAME

@ -1 +1 @@
Subproject commit 54d5ab8b2c37bb9139eb6800631eece9b60ee25a Subproject commit 569e302f3000e236ba562f17bc83d9e70a54fbf5

15
mocha-suv/configure vendored
View File

@ -1,6 +1,21 @@
# mocha-suv post-installation configuration script # mocha-suv post-installation configuration script
# to be run on the SUV virtual machine (if building manually) # to be run on the SUV virtual machine (if building manually)
# set to 0 if we already have an installed SUV or CUP
FULL=1
if [ $FULL -eq 1 ]; then
# update the package repository and install required packages
apt update
# !!! NOTE: we are no longer requiring mysql for Mocha if we use the mocha-dotnet OMS
apt install apache2 php pwgen
apt install dotnet-runtime-8.0
mkdir -p /usr/share/mocha/system
fi
ENABLE_SSL=1 ENABLE_SSL=1
if [ $ENABLE_SSL -eq 1 ]; then if [ $ENABLE_SSL -eq 1 ]; then

View File

@ -0,0 +1,7 @@
FROM httpd
RUN apt update && apt upgrade && apt install -y php php-mbstring php-curl php-xml pwgen
RUN rm /usr/local/apache2/htdocs/index.html
COPY mocha-php/mocha-php/src/mocha-php /usr/local/apache2/htdocs/

View File

@ -16,7 +16,13 @@ SUV_IP=$SUV_IP_PREFIX.$SUV_IP_FIRST.$SUV_IP_LAST
SUV_ALWAYS_PROVISION="false" SUV_ALWAYS_PROVISION="false"
SUV_UNATTENDED="false" SUV_UNATTENDED="false"
USE_VAGRANT="false" BACKEND="virtualbox"
if [ "$1" == "--backend" ]; then
BACKEND="$2"
shift
shift
fi
if [ "$1" == "--transient" ]; then if [ "$1" == "--transient" ]; then
shift shift
@ -32,10 +38,6 @@ if [ "$1" == "--unattended" ]; then
shift shift
fi fi
if [ "$1" == "--use-vagrant" ]; then
USE_VAGRANT="true"
fi
SUV_TEMPLATE="default" SUV_TEMPLATE="default"
if [ "$1" != "" ]; then if [ "$1" != "" ]; then
@ -90,11 +92,11 @@ fi
sed -i -e "s/@@MOCHA_SUV_ID@@/$SUV_NAME/" -e "s/@@MOCHA_SUV_ADDRESS@@/$SUV_IP/" -e "s/@@MOCHA_SUV_HOSTNAME@@/$SUV_IP_OR_DNS/" -e "s/@@MOCHA_ALWAYS_PROVISION@@/$SUV_ALWAYS_PROVISION/" ./Vagrantfile sed -i -e "s/@@MOCHA_SUV_ID@@/$SUV_NAME/" -e "s/@@MOCHA_SUV_ADDRESS@@/$SUV_IP/" -e "s/@@MOCHA_SUV_HOSTNAME@@/$SUV_IP_OR_DNS/" -e "s/@@MOCHA_ALWAYS_PROVISION@@/$SUV_ALWAYS_PROVISION/" ./Vagrantfile
if [ "$USE_VAGRANT" == "true" ]; then if [ "$BACKEND" == "vagrant" ]; then
vagrant up vagrant up
else elif [ "$BACKEND" == "virtualbox" ]; then
# create a new Host-Only Network Interface # create a new Host-Only Network Interface
HOIFNAME=$(VBoxManage hostonlyif create | grep -o -P "(?<=').*(?=')" ) HOIFNAME=$(VBoxManage hostonlyif create | grep -o -P "(?<=').*(?=')" )
@ -107,6 +109,10 @@ else
# assign the newly-created Host-Only Network Interface to the newly-created VM # assign the newly-created Host-Only Network Interface to the newly-created VM
VBoxManage modifyvm mochasuv-$SUV_NAME --nic2=hostonly --host-only-adapter2=$HOIFNAME VBoxManage modifyvm mochasuv-$SUV_NAME --nic2=hostonly --host-only-adapter2=$HOIFNAME
else
echo "backend not supported: $BACKEND"
fi fi
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then