diff --git a/.gitignore b/.gitignore index 45c6f3f..5da9352 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ machines/ *.bak *.swp +# ignore the mocha-dotnet oms build dir +mocha-suv/docker/fs/usr/lib/mocha/oms diff --git a/.gitmodules b/.gitmodules index 1d4191f..e7c3993 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "mocha-common"] path = mocha-common url = git@gitea.azcona-becker.net:mochapowered/mocha-common +[submodule "mocha-dotnet"] + path = mocha-dotnet + url = git@gitea.azcona-becker.net:mochapowered/mocha-dotnet diff --git a/docker-build b/docker-build index a41b38d..f022602 100755 --- a/docker-build +++ b/docker-build @@ -1,5 +1,22 @@ #!/bin/bash +# update .NET +pushd ../mocha-dotnet/mocha-dotnet/src/app/Mocha.Oms.Server +dotnet build +popd + +# build the libraries +pushd mocha-common/mocha-common +./build +popd + +mkdir -p ./mocha-suv/docker/fs/usr/lib/mocha/oms +cp -r ../mocha-dotnet/mocha-dotnet/src/app/Mocha.Oms.Server/bin/Debug/net8.0/* ./mocha-suv/docker/fs/usr/lib/mocha/oms + +mkdir -p ./mocha-suv/docker/fs/usr/share/mocha/system +cp mocha-common/mocha-common/output/net.alcetech.Mocha.System.mcl ./mocha-suv/docker/fs/usr/share/mocha/system +cp mocha-common/mocha-common/output/net.alcetech.Mocha.Web.mcl ./mocha-suv/docker/fs/usr/share/mocha/system + # build the image (i.e. 'mocha suv init' ) docker build -t mocha-httpd -f mocha-suv/docker/Dockerfile . diff --git a/mocha-common b/mocha-common index 5a4d4aa..0c9db45 160000 --- a/mocha-common +++ b/mocha-common @@ -1 +1 @@ -Subproject commit 5a4d4aa243bc02348eb717496739c696268a3a1e +Subproject commit 0c9db452e4933c07337aee94b05f29f08e5a4bb4 diff --git a/mocha-php b/mocha-php index 162cbff..0375e39 160000 --- a/mocha-php +++ b/mocha-php @@ -1 +1 @@ -Subproject commit 162cbff537903be8f76b0da5939606ebe1763c8b +Subproject commit 0375e3977a54c557417b307454e1074a0b0f3807 diff --git a/mocha-suv/docker/Dockerfile b/mocha-suv/docker/Dockerfile index 48ebe24..f995394 100644 --- a/mocha-suv/docker/Dockerfile +++ b/mocha-suv/docker/Dockerfile @@ -1,13 +1,16 @@ # FROM httpd FROM ubuntu -RUN apt update && apt upgrade -y && apt install -y php php-mbstring php-curl php-xml pwgen +RUN apt update && apt upgrade -y && apt install -y php php-mbstring php-curl php-xml pwgen dotnet-runtime-8.0 # RUN rm /usr/local/apache2/htdocs/index.html -RUN rm /var/www/html/index.html +RUN rm /var/www/html/index.html && a2enmod ssl && a2enmod rewrite && service apache2 restart -RUN a2enmod ssl && a2enmod rewrite -RUN service apache2 restart +RUN mkdir /usr/lib/mocha && mkdir /etc/mocha && mkdir /var/mocha + +# install the root file system overlay +COPY mocha-suv/docker/fs / +COPY mocha-common/mocha-common/data/uploads /var/mocha/uploads # COPY mocha-php/mocha-php/src/mocha-php /usr/local/apache2/htdocs/ COPY mocha-php/mocha-php/src/mocha-php /var/www/html @@ -25,5 +28,6 @@ COPY mocha-suv/docker/ports.conf /etc/apache2/ports.conf COPY mocha-suv/docker/site.conf /etc/apache2/sites-available/000-default.conf EXPOSE 443 -CMD [ "apache2ctl", "-D", "FOREGROUND" ] + +CMD [ "mochactl", "start" ] diff --git a/mocha-suv/docker/fs/usr/lib/systemd/system/mocha-oms.service b/mocha-suv/docker/fs/usr/lib/systemd/system/mocha-oms.service new file mode 100644 index 0000000..f37af80 --- /dev/null +++ b/mocha-suv/docker/fs/usr/lib/systemd/system/mocha-oms.service @@ -0,0 +1,18 @@ +[Unit] +Description=The Mocha OMS Server +After=network.target remote-fs.target nss-lookup.target +Documentation=https://support.mochapowered.com/oms-dotnet/1.3/ + +[Service] +Type=forking +Environment=MOCHAOMS_STARTED_BY_SYSTEMD=true +ExecStart=/usr/sbin/mochactl start-oms +ExecStop=/usr/sbin/mochactl stop-oms +ExecReload=/usr/sbin/mochactl reload-oms +KillMode=mixed +PrivateTmp=true +Restart=on-abort +OOMPolicy=continue + +[Install] +WantedBy=multi-user.target diff --git a/mocha-suv/docker/fs/usr/sbin/mochactl b/mocha-suv/docker/fs/usr/sbin/mochactl new file mode 100755 index 0000000..14f06a0 --- /dev/null +++ b/mocha-suv/docker/fs/usr/sbin/mochactl @@ -0,0 +1,14 @@ +#!/bin/bash + +EXECPATH="/usr/lib/mocha/oms" +EXECFILE="Mocha.Oms.Server" + +case "$1" in + "start-oms") + exec $EXECPATH/$EXECFILE & + ;; + "start") + exec $EXECPATH/$EXECFILE & + apache2ctl -D FOREGROUND + ;; +esac diff --git a/mocha-suv/docker/fs/usr/share/mocha/system/net.alcetech.Mocha.System.mcl b/mocha-suv/docker/fs/usr/share/mocha/system/net.alcetech.Mocha.System.mcl new file mode 100644 index 0000000..194c383 Binary files /dev/null and b/mocha-suv/docker/fs/usr/share/mocha/system/net.alcetech.Mocha.System.mcl differ diff --git a/mocha-suv/docker/fs/usr/share/mocha/system/net.alcetech.Mocha.Web.mcl b/mocha-suv/docker/fs/usr/share/mocha/system/net.alcetech.Mocha.Web.mcl new file mode 100644 index 0000000..4bc2c7d Binary files /dev/null and b/mocha-suv/docker/fs/usr/share/mocha/system/net.alcetech.Mocha.Web.mcl differ