summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2023-06-01 18:11:20 -0400
committerAndrew Cady <d@jerkface.net>2023-06-01 18:11:20 -0400
commitcc171c3917d410d4ca95bf305a9f247378fdbb2f (patch)
tree8a0c9ec63e40de9072a3a70edfd40e838fda8c3d /src
parent513765b244d5de1f54edbf4ba6be79c5933cfa3f (diff)
automatic apache configuration of fossil reverse proxy for virtual host of local hostname
Diffstat (limited to 'src')
-rw-r--r--src/fossil-disable-apache@.service9
-rw-r--r--src/fossil-enable-apache@.service14
-rw-r--r--src/fossil.conf~template10
-rw-r--r--src/user/fossil-httpd@.service2
4 files changed, 34 insertions, 1 deletions
diff --git a/src/fossil-disable-apache@.service b/src/fossil-disable-apache@.service
new file mode 100644
index 0000000..4d763e0
--- /dev/null
+++ b/src/fossil-disable-apache@.service
@@ -0,0 +1,9 @@
1[Unit]
2Description = Disable and clean up apache site
3
4[Service]
5Type = oneshot
6ExecStart = sh -xc 'rm -f \
7/etc/apache2/sites-available/fossil-%H.conf \
8/etc/apache2/sites-enabled/fossil-%H.conf'
9ExecStart = systemctl reload apache2
diff --git a/src/fossil-enable-apache@.service b/src/fossil-enable-apache@.service
new file mode 100644
index 0000000..d90a36f
--- /dev/null
+++ b/src/fossil-enable-apache@.service
@@ -0,0 +1,14 @@
1[Unit]
2Description = Create and enable apache2 site
3ConditionPathExists = /etc/apache2/sites-available/fossil.conf~template
4ConditionPathExists = !/etc/apache2/sites-available/fossil-%H.conf
5
6[Service]
7Type = oneshot
8ExecStart = sh -c '\
9sed -e s/%[H]/%H/ \
10< /etc/apache2/sites-available/fossil.conf~template \
11> /etc/apache2/sites-available/fossil-%H.conf \
12'
13ExecStart = a2ensite fossil-%H
14ExecStart = systemctl reload apache2
diff --git a/src/fossil.conf~template b/src/fossil.conf~template
new file mode 100644
index 0000000..797f5e2
--- /dev/null
+++ b/src/fossil.conf~template
@@ -0,0 +1,10 @@
1<VirtualHost *:80>
2 ServerName %H
3 ServerAdmin webmaster@%H
4 ErrorLog ${APACHE_LOG_DIR}/error.log
5 CustomLog ${APACHE_LOG_DIR}/access.log combined
6 DocumentRoot /var/www/html
7 ProxyPreserveHost on
8 ProxyPass / http://localhost:8079/
9 ProxyPassReverse / http://localhost:8079/
10</VirtualHost>
diff --git a/src/user/fossil-httpd@.service b/src/user/fossil-httpd@.service
index eccc17c..9c4aec5 100644
--- a/src/user/fossil-httpd@.service
+++ b/src/user/fossil-httpd@.service
@@ -4,4 +4,4 @@ ConditionUser = !root
4 4
5[Service] 5[Service]
6StandardInput = socket 6StandardInput = socket
7ExecStart = fossil http --repolist --nossl --host=localhost:8079 --localauth ${HOME}/src/ 7ExecStart = fossil http --repolist --nossl --host=%H --localauth ${HOME}/src/