aboutsummaryrefslogtreecommitdiff
path: root/scripts/provision-host
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-07-14 17:57:00 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-07-14 17:57:00 -0300
commit1d188c127a7bfe5c67c80ccce5e4f72324622933 (patch)
tree3a6c168933a7577f8e7fae88f7971007a47b9db8 /scripts/provision-host
parent2b9749daf243778dbb1e5cfaf2b62d7351252a68 (diff)
downloadcopyfarai-1d188c127a7bfe5c67c80ccce5e4f72324622933.tar.gz
copyfarai-1d188c127a7bfe5c67c80ccce5e4f72324622933.tar.bz2
Provision: split between provision and provision-host
Diffstat (limited to 'scripts/provision-host')
-rwxr-xr-xscripts/provision-host43
1 files changed, 43 insertions, 0 deletions
diff --git a/scripts/provision-host b/scripts/provision-host
new file mode 100755
index 0000000..2d0fab5
--- /dev/null
+++ b/scripts/provision-host
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# Provisioner for the hosting environment
+#
+
+# Parameters
+DIRNAME="`dirname $0`"
+
+# Basic dependencies
+DEPENDENCIES="apache2"
+
+# Check for sudo
+if [ "`whoami`" != "root" ]; then
+ SUDO="sudo"
+fi
+
+# Ensure an up-to-date system
+$SUDO apt-get update && $SUDO apt-get dist-upgrade -y && $SUDO apt-get autoremove -y && $SUDO apt-get clean
+
+# Install dependencies
+$SUDO apt install -y $DEPENDENCIES
+
+# Configure virtual host for the local service
+cat <<-EOF | $SUDO tee /etc/apache2/sites-available/local.conf > /dev/null
+<VirtualHost *:80>
+ ServerName estudo.local
+ DocumentRoot "/srv/shared/site"
+
+ <Directory /srv/shared/site>
+ Options Indexes FollowSymLinks
+ AllowOverride All
+ Require all granted
+ </Directory>
+</VirtualHost>
+EOF
+
+# Enable virtual host
+$SUDO a2ensite local
+$SUDO systemctl reload apache2
+
+# Configure PATH
+#mkdir -p ~/.custom
+#echo 'export PATH=$PATH:/srv/shared/scripts' > ~/.custom/profile