Skip to content

Instantly share code, notes, and snippets.

@RobertCNelson
Last active June 3, 2021 21:31
Show Gist options
  • Select an option

  • Save RobertCNelson/442b4aacd7eea2cbe0c93d8dfff3972d to your computer and use it in GitHub Desktop.

Select an option

Save RobertCNelson/442b4aacd7eea2cbe0c93d8dfff3972d to your computer and use it in GitHub Desktop.
weblabdeusto hacks
#https://weblabdeusto.readthedocs.io/en/latest/installation.html
#Fresh Debian 10 install
apt update ;\
apt upgrade ;\
apt install etckeeper
#user:
adduser rcnee
adduser rcnee sudo
su rcnee
ssh-keygen -b 4096
ssh-copy-id [email protected]
ssh [email protected]
sudo apt update ;\
sudo apt install git python2.7 python-pip python-setuptools virtualenv \
virtualenvwrapper apache2 redis-server build-essential python-dev libsasl2-dev \
libsasl2-dev libssl-dev libxml2-dev libxslt1-dev libldap2-dev supervisor libmaxminddb-dev \
libyaml-dev certbot python-certbot-apache fail2ban
sudo certbot --apache
#mkvirtualenv
sudo reboot
sudo mkdir /opt/weblab/ ;\
sudo chown -R rcnee:rcnee /opt/weblab/
cd /opt/weblab/ ;\
git clone https://github.com/weblabdeusto/weblabdeusto.git .
pip --version ;\
virtualenv --version ;\
mkvirtualenv --version
virtualenv weblab_env
. ./weblab_env/bin/activate
pip install --upgrade setuptools ;\
pip install --upgrade pip
pip install -r server/src/requirements.txt ;\
python setup.py install
weblab-admin create example --entity-link='https://hamsterboard.org/' \
--admin-user=RobertCNelson --admin-name='Robert Nelson' \
--admin-password=secret --admin-mail='[email protected]'
#Apache:
sudo nano /etc/apache2/conf-available/weblab.conf
Include "/opt/weblab/example/httpd/apache_weblab_generic.conf"
sudo a2enconf weblab ;\
sudo a2enmod proxy proxy_balancer proxy_http headers ;\
sudo a2enmod lbmethod_bybusyness ;\
sudo /etc/init.d/apache2 restart
sudo mkdir /var/log/weblab/
sudo nano weblab-wrapper.sh
#!/bin/bash
_term() {
kill -TERM "$child" 2>/dev/null
}
# When SIGTERM is sent, send it to weblab-admin
trap _term SIGTERM
source /opt/weblab/weblab_env/bin/activate
weblab-admin $@ &
child=$!
wait "$child"
sudo chmod +x weblab-wrapper.sh
sudo nano /etc/supervisor/conf.d/example.conf
[program:example]
command=/opt/weblab/weblab-wrapper.sh start example
directory=/opt/weblab/
user=rcnee
stdout_logfile=/var/log/weblab/stdout.log
stderr_logfile=/var/log/weblab/stderr.log
killasgroup=true
sudo supervisorctl update
sudo supervisorctl status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment