commit 789c7a3e58350e60fce3bd39f03066896455ea9b
parent 3b14e82d502de02f1aadd5ca6fd1b02764a0c24b
Author: rbckman <rob@tarina.org>
Date: Mon, 12 Oct 2020 22:02:29 +0300
install script för devvare
Diffstat:
A | install.sh | | | 79 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 79 insertions(+), 0 deletions(-)
diff --git a/install.sh b/install.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+ROOT_UID=0 # Root has $UID 0.
+
+if [ "$UID" -eq "$ROOT_UID" ]
+then
+ echo "OK"
+else
+ echo "Run with sudo!"
+ echo "sudo ./install.sh"
+ exit 0
+fi
+
+echo "Hurray! du e sudo user!"
+cat <<'EOF'
+
+ .__---~~~(~~-_.
+ _-' ) -~~- ) _-" )_
+ ( ( `-,_..`.,_--_ '_,)_
+ ( -_) ( -_-~ -_ `, )
+ (_ -_ _-~-__-~`, ,' )__-'))--___--~~~--__--~~--___--__..
+ _ ~`_-'( (____;--==,,_))))--___--~~~--__--~~--__----~~~'`=__-~+_-_.
+(@) (@) ````` `-_(())_-~ mn
+
+echo "Installing all dependencies..."
+apt-get update
+sudo apt install apache2 libapache2-mod-wsgi-py3 python3-pip
+python3 -m pip install web.py==0.61
+
+EOF
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+ACONF="/etc/apache2/sites-available/bygdis.conf"
+
+echo "Adding local site to /etc/apache2/sites-available/bygdis.conf"
+cat <<'EOF' > $ACONF
+<VirtualHost *:80>
+ ServerName localhost
+EOF
+echo " DocumentRoot $DIR" >> $ACONF
+echo " WSGIScriptAlias / $DIR/server.py" >> $ACONF
+echo " WSGIPassAuthorization On" >> $ACONF
+echo " AddType text/html .py" >> $ACONF
+echo " Alias /static $DIR/public_html/static" >> $ACONF
+echo " <Directory $DIR/public_html>" >> $ACONF
+cat <<'EOF' >> $ACONF
+ Options FollowSymlinks
+ AllowOverride None
+ Require all granted
+ </Directory>
+ ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
+ <Directory "/usr/lib/cgi-bin">
+ AllowOverride None
+ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
+ Require all granted
+ </Directory>
+EOF
+echo " ErrorLog $DIR/error.log" >> $ACONF
+echo "</VirtualHost>" >> $ACONF
+
+echo "<Directory $DIR>" >> /etc/apache2/apache2.conf
+cat <<'EOF' >> /etc/apache2/apache2.conf
+ Options Indexes FollowSymLinks
+ AllowOverride None
+ Require all granted
+</Directory>
+EOF
+
+sudo a2ensite bygdis.conf
+sudo systemctl restart apache2
+
+cat <<'EOF'
+ .-.
+ .-""`""-. |(@ @)
+ _/`oOoOoOoOo`\_ \ \-/
+ '.-=-=-=-=-=-=-.' \/ \
+ `-=.=-.-=.=-' \ /\
+ ^ ^ ^ _H_ \
+
+alrite, du kan nu skriva in "localhost" i webläsarn. bygdis.fi siidona borde va up-n-running på din egen dator, nu kan du börja testa devva. skicka pull request sen ba när du ha duuna någå siistit.