diff --git a/Backend/etcsystemd/swarmops-backend.service b/Backend/libsystemd/swarmops-backend.service
similarity index 86%
rename from Backend/etcsystemd/swarmops-backend.service
rename to Backend/libsystemd/swarmops-backend.service
index 930c96c9..694ea5e5 100644
--- a/Backend/etcsystemd/swarmops-backend.service
+++ b/Backend/libsystemd/swarmops-backend.service
@@ -6,6 +6,9 @@ After=network.target
ExecStart=/usr/bin/mono /usr/share/swarmops/backend/Swarmops.Backend.exe
WorkingDirectory=/usr/share/swarmops/backend
Restart=on-abort
+User=swarmopsback
+Group=swarmopsback
+
[Install]
WantedBy=multi-user.target
diff --git a/BuildFiles/Building/ccnet.config b/BuildFiles/Building/ccnet.config
index 4452e4d3..3179e3ee 100644
--- a/BuildFiles/Building/ccnet.config
+++ b/BuildFiles/Building/ccnet.config
@@ -96,26 +96,18 @@
-
-
-
- bash
- -c "mv /home/builder/swarmops/sources/continuous/repo/Backend/etcinitd /home/builder/swarmops/builds/internal/backend"
- Copying /etc/init.d files for Backend Upstart
-
-
bash
- -c "mv /home/builder/swarmops/sources/continuous/repo/Backend/etcsystemd /home/builder/swarmops/builds/internal/backend"
- Copying /etc/init.d files for Backend Upstart
+ -c "mv /home/builder/swarmops/sources/continuous/repo/Backend/libsystemd /home/builder/swarmops/builds/internal/backend"
+ Copying /lib/systemd files for Swarmops Backend
bash
- -c "mv /home/builder/swarmops/sources/continuous/repo/FrontSocket/etcsystemd /home/builder/swarmops/builds/internal/frontend"
- Copying /etc/init.d files for Backend Upstart
+ -c "mv /home/builder/swarmops/sources/continuous/repo/FrontSocket/libsystemd /home/builder/swarmops/builds/internal/frontend"
+ Copying /lib/systemd files for Swarmops Frontend
diff --git a/BuildFiles/Building/xsl/header.xsl b/BuildFiles/Building/xsl/header.xsl
index e41077a6..7f5b8c07 100644
--- a/BuildFiles/Building/xsl/header.xsl
+++ b/BuildFiles/Building/xsl/header.xsl
@@ -35,7 +35,7 @@
-
+
diff --git a/BuildFiles/Packaging/scripts/repackage-build-package b/BuildFiles/Packaging/scripts/repackage-build-package
index 40372052..a84b22d3 100755
--- a/BuildFiles/Packaging/scripts/repackage-build-package
+++ b/BuildFiles/Packaging/scripts/repackage-build-package
@@ -96,15 +96,7 @@ if [ "$COPYFILES" == "yes" ]; then
rm -rf $DEPLOYDIR/$TARGETDIR/staging
fi
- if [ -d $SOURCEDIR/etcinitd ]; then
- echo "Adding /etc/init.d files..."
- mkdir -p etc/init.d
- cp $SOURCEDIR/etcinitd/* etc/init.d/.
- chmod +x etc/init.d/*
- ls -la etc/init.d
- fi
-
- if [ -d $SOURCEDIR/etcsystemd ]; then
+ if [ -d $SOURCEDIR/libsystemd ]; then
echo "Adding /lib/systemd files..."
mkdir -p lib/systemd/system
cp $SOURCEDIR/etcsystemd/* lib/systemd/system/.
@@ -174,7 +166,7 @@ fi
cd ../..
-scripts/repackage-build-package-distro $PACKAGENAME $DROPFOLDER squeeze,trusty,xenial,jessie $PACKAGE $BUILDID
+scripts/repackage-build-package-distro $PACKAGENAME $DROPFOLDER xenial,jessie,stretch $PACKAGE $BUILDID
# TODO: FIX INTERNAL INSTALL?
diff --git a/BuildFiles/Packaging/templates/postinst-backend.template b/BuildFiles/Packaging/templates/postinst-backend.template
index f0cbc653..8e5c934a 100644
--- a/BuildFiles/Packaging/templates/postinst-backend.template
+++ b/BuildFiles/Packaging/templates/postinst-backend.template
@@ -2,22 +2,12 @@
#echo "DEBUG: Executing post-installation script, swarmops-backend"
-#make sure some directories exist
-mkdir -p /var/lib/swarmops/upload
-#todo: check for database upgrade
+adduser --system --group --quiet swarmopsback
-#if we're running systemd, use systemd;
-#otherwise, use upstart
+#Upstart deprecated; support systemd only
-if [ -z $(pidof -s systemd) ]; then
- #start the daemon
- /etc/init.d/swarmops-backend start
- #register the daemon
- update-rc.d swarmops-backend defaults 90 10 > /dev/null
-else
- systemctl enable swarmops-backend
- systemctl start swarmops-backend
-fi
+systemctl enable swarmops-backend
+systemctl start swarmops-backend
#echo "DEBUG: Exiting post-install script, swarmops-backend"
diff --git a/BuildFiles/Packaging/templates/postinst-frontend.template b/BuildFiles/Packaging/templates/postinst-frontend.template
index e56daec0..bfd7dea6 100644
--- a/BuildFiles/Packaging/templates/postinst-frontend.template
+++ b/BuildFiles/Packaging/templates/postinst-frontend.template
@@ -2,6 +2,8 @@
#echo "DEBUG: Executing post-install script, swarmops-frontend"
+adduser --system --group --quiet swarmopsfront
+
# make sure the upload folder exists and is writeable by www-data
# do not make any changes to an already existing folder
@@ -77,15 +79,11 @@ chown www-data:www-data /etc/swarmops/database.config
chown www-data:www-data /etc/swarmops/symmetricKey.config
-# if we stopped Apache in preinst (1st install), restart it
+# Enable required Apache mods and restart Apache
-if [ -e /tmp/swarmops-restart-apache.flag ]; then
- /etc/init.d/apache2 start
- rm /tmp/swarmops-restart-apache.flag
-else
- # Actually, _always_ restart Apache - something isn't right otherwise
- /etc/init.d/apache2 restart
-fi
+a2enmod --quiet proxy
+a2enmod --quiet proxy_wstunnel
+systemctl restart apache2
# Always end a frontend update with an Apache reload to clear caches
diff --git a/BuildFiles/Packaging/templates/preinst-frontend.template b/BuildFiles/Packaging/templates/preinst-frontend.template
index 6815cc99..760ed129 100644
--- a/BuildFiles/Packaging/templates/preinst-frontend.template
+++ b/BuildFiles/Packaging/templates/preinst-frontend.template
@@ -7,12 +7,10 @@
#echo "DEBUG: Executing pre-install script, swarmops-frontend"
if [ ! -e /etc/swarmops/database.config ]; then
- if [ -e /etc/init.d/apache2 ]; then
- if [ -z $(pidof -s apache2) ]; then
- # Set a flag to postinst to restart Apache
- echo foo > /tmp/swarmops-restart-apache.flag
- /etc/init.d/apache2 stop
- fi
+ if [ ! -z $(pidof -s apache2) ]; then
+ # Set a flag to postinst to restart Apache
+ echo foo > /tmp/swarmops-restart-apache.flag
+ systemctl stop apache2
fi
fi
diff --git a/BuildFiles/Packaging/templates/prerm-backend.template b/BuildFiles/Packaging/templates/prerm-backend.template
index 51d3dde7..edd7f5c7 100644
--- a/BuildFiles/Packaging/templates/prerm-backend.template
+++ b/BuildFiles/Packaging/templates/prerm-backend.template
@@ -2,14 +2,9 @@
#echo "DEBUG: Executing pre-remove script, swarmops-backend"
-# Different paths for systemd and upstart
+# Support for Upstart deprecated; support systemd only
-if [ -z $(pidof systemd) ]; then
- update-rc.d -f swarmops-backend remove > /dev/null
- /etc/init.d/swarmops-backend stop
-else
- systemctl stop swarmops-backend
- systemctl disable swarmops-backend
-fi
+systemctl stop swarmops-backend
+systemctl disable swarmops-backend
#echo "DEBUG: Exiting pre-remove script, swarmops-backend"
diff --git a/FrontSocket/etcsystemd/swarmops-frontend.service b/FrontSocket/libsystemd/swarmops-frontend.service
similarity index 86%
rename from FrontSocket/etcsystemd/swarmops-frontend.service
rename to FrontSocket/libsystemd/swarmops-frontend.service
index 2d27edae..cfc8a41e 100644
--- a/FrontSocket/etcsystemd/swarmops-frontend.service
+++ b/FrontSocket/libsystemd/swarmops-frontend.service
@@ -6,6 +6,8 @@ After=network.target
ExecStart=/usr/bin/mono /usr/share/swarmops/frontend/bin/Swarmops.Frontend.Socket.exe
WorkingDirectory=/usr/share/swarmops/frontend
Restart=on-abort
+User=swarmopsfront
+Group=swarmopsfront
[Install]
WantedBy=multi-user.target
diff --git a/Site/apache-default-config.txt b/Site/apache-default-config.txt
index 4263d8e8..b6ce6c99 100644
--- a/Site/apache-default-config.txt
+++ b/Site/apache-default-config.txt
@@ -2,6 +2,10 @@ ServerName swarmops-frontend
ServerAdmin swarmops-frontend@swarmops.com
DocumentRoot /usr/share/swarmops/frontend/
+# Redirect websocket requests to Swarmops FrontSocket server
+ProxyRequests Off
+ProxyPass "/ws/" "ws:/localhost:12172"
+
# Explicitly specify Mono version 4
MonoServerPath swarmops-frontend "/usr/bin/mod-mono-server4"