Added Apache autoconfiguration to install

This commit is contained in:
Rick Falkvinge
2016-03-15 18:40:18 +01:00
parent 92262cf7b3
commit e3a56ac518
4 changed files with 58 additions and 6 deletions
@@ -2,10 +2,10 @@ Package: swarmops-common
Version: --BuildNumber--
Architecture: all
Maintainer: Rick Falkvinge (swarmops-maintain@falkvinge.net)
Depends: libmono-system-componentmodel-composition4.0-cil (>= 3.2.8),libmono-system-web-services4.0-cil (>= 3.2.8),libmono-system-web-extensions4.0-cil (>= 3.2.8),libmono-system-componentmodel-composition4.0-cil (>= 3.2.8),fonts-liberation,libmono-system-numerics4.0-cil
Depends: dialog (>= 1.1), libmono-system-componentmodel-composition4.0-cil (>= 3.2.8),libmono-system-web-services4.0-cil (>= 3.2.8),libmono-system-web-extensions4.0-cil (>= 3.2.8),libmono-system-componentmodel-composition4.0-cil (>= 3.2.8),fonts-liberation,libmono-system-numerics4.0-cil
Conflicts: swarmops-common-internal,swarmops-common-stable
Homepage: http://swarmops.com/
Description: Swarmops Common
Swarmops is a swarm activist administration system.
This package contains the common components between
front-end and back-end.
frontend and backend.
@@ -7,6 +7,31 @@ if [ ! -e /var/lib/swarmops/upload ]; then
mkdir -p /var/lib/swarmops/upload
chown www-data:www-data /var/lib/swarmops/upload
chmod 777 /var/lib/swarmops/upload
#If there's only 000-default in apache sites, assume new install
if [ "$(ls -l /var/apache/sites-enabled/ | wc-l)" = "2" ]; then
echo "Dialog branch was triggered (this is for debug purposes)"
dialog --menu "This seems to be a new installation of Swarmops Frontend on a newly installed Apache. Would you like to create the necessary site directives and make it the default Apache site?" 12 70 3 1 "No thanks, don't touch my Apache, that's for me alone" 2 "Yes please, make Swarmops the default site for port 80" 3 "Create a Swarmops config, please, but don't enable it"
dialog_return_value = $?
case $dialog_return_value in
1)
echo "Neither reconfiguring Apache nor creating configuration file."
2)
echo "Disabling site 000-default; creating/enabling site 000-swarmops."
a2dissite 000-default
cp /usr/share/swarmops/frontend/apache-default-config.txt /etc/apache2/sites-available
a2ensite 000-swarmops
/etc/init.d/apache2 force-reload
3)
echo "Creating but not enabling 000-swarmops."
cp SOMETHING /etc/apache2/sites-available
esac
fi
fi
# make sure the web frontend (and its init routine) can write to machineKey.config
+10 -4
View File
@@ -73,11 +73,17 @@ namespace Swarmops.Frontend.Pages.v5.Public
// If we're running on Localhost, disable the "is this your server?" question
string localAddress = HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"];
if (localAddress == "127.0.0.1" || localAddress == "::1")
if (IsLocalhost())
{
this.TextServerName.Text = "(localhost)";
this.TextServerAddress.Text = localAddress;
this.TextServerName.Text = @"(localhost)";
if (HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"] == "::1")
{
this.TextServerAddress.Text = @"IPv6 Loopback";
}
else
{
this.TextServerAddress.Text = @"IPv4 Loopback";
}
this.TextServerName.Enabled = false;
this.TextServerAddress.Enabled = false;
}
+21
View File
@@ -0,0 +1,21 @@
ServerName swarmops-frontend
ServerAdmin swarmops-frontend@swarmops.com
DocumentRoot /usr/share/swarmops/frontend/
# Explicitly specify Mono version 4
MonoServerPath swarmops-frontend "/usr/bin/mod-mono-server4"
# Uncomment the below to enable debugging:
# MonoDebug swarmops-frontend true
MonoApplications swarmops-frontend "/:/usr/share/swarmops/frontend/"
<Location "/">
Allow from all
Order allow,deny
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
</IfModule>