====== Hackhub ====== Hackhub is our member database and lives on [[projects:finzean|Finzean]]. It is very closely integrated with [[projects:57_north_id|57North ID]] and both need to be running. Hackhub code is hosted at [[https://github.com/hackerdeen/hackhub|Github]]. ===== Hibby's work in progress attempt to set up hackhub on a server===== ==== Requirements ==== Some form of OS (Debian stable): * Python * Flask * Apache2 * libapache2-mod-wsgi * sqlite3 * slapd * ldap-utils * ldapscripts ==== Process ==== - Install Debian Stable - ''apt install python-flask sqlite3 slapd ldap-utils ldapscripts git apache2 libapache2-mod-wsgi python-virtualenv python-ldap'' - Import LDAP - Migrate hackhub DB - ''/home/hackhub/hackhub.db'' - ''adduser hackhub'' - ensure hackhub has no password, has a ''/home/hackhub'' and a shell of /bin/sh - ''pip2 install python-cas monthdelta'' - ''su -l hackhub'' - ''git clone https://github.com/hackerdeen/hackhub'' - Configure ''hackhub/local_settings.py'' - ''cd && virtualenv .hackhub'' - Configure [[projects:57_north_id|ID]] ===== LDAP ===== ==== Exporting LDAP ==== Export Database Schema and cn=config - ''slapcat -n 0 -l /tmp/57nldap.config'' Export user data: - ''slapcat -n 1 -l /tmp/57nldap.users'' Copy these two files to where the new db is. Use SCP or something secure ==== Importing LDAP ==== Stop slapd: - ''systemctl stop slapd'' Make sure that the existing slapd.d folder on the new machine is empty: - ''rm -rf /etc/ldap/slapd.d/*'' Add the schema and cn=config: - ''slapadd -n 0 -F /etc/ldap/slapd.d -l /tmp/57nldap.config'' Add the user data: - ''slapadd -n 1 -l /tmp/57nldap.users'' Change the ownership of the slapd.d folder: - ''chown -R openldap:openldap slapd.d'' Start slapd: - ''systemctl start slapd'' ====== Apache ====== ===== Modules ===== - ''a2enmod rewrite'' - ''a2enmod wsgi'' ===== Hackhub site file ===== ==== Cleartext ==== ServerName hub.57north.org.uk ServerAdmin ctte-private@57north.co RewriteEngine on RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,QSA,R=permanent] # vim: syntax=apache ts=4 sw=4 sts=4 sr noet ==== SSL ==== WSGIPythonPath /home/hackhub/hackhub ServerName hub.57north.org.uk ServerAdmin ctte-private@57north.co SSLCertificateFile /etc/letsencrypt/live/hub.57north.org.uk/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/hub.57north.org.uk/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf WSGIDaemonProcess hackhub user=hackhub group=hackhub threads=2 WSGIScriptAlias / /home/hackhub/hackhub/hackhub.wsgi DocumentRoot /home/hackhub/hackhub RewriteEngine On RewriteRule ^/$ https://57north.org.uk [L,R=301] WSGIProcessGroup hackhub WSGIApplicationGroup %{GLOBAL} Require all granted # vim: syntax=apache ts=4 sw=4 sts=4 sr noet {{tag>active software ormiret finzean infrastructure ID}}