BotBot.me is a logging IRC bot. Scaleway provides bare-metal ARM servers for €3/mo. Can we combine them? We can!
Cribbed from the real install instructions, with extensions as necessary.
- Instantiate a new server based on the Ubuntu Wily (15.10) image
- Install botbot.me dependencies:
apt-get install postgresql-contrib-9.4 postgresql-server-dev-9.4 python-dev virtualenv golang-go redis-server git build-essential
- Install node.js:
curl -sL https://deb.nodesource.com/setup_5.x | bash - && apt-get install -y nodejs
- Create a botbot user with
adduser botbot --disabled-password
- Create a botbot postgres user with
sudo -iu postgres createuser -dP botbot
and assign a secure password (considerpwgen 24 1
). You do need to configure password authentication because of how botbot interacts with lib/pg. - Switch to the botbot user with
su botbot
, change to the home directory withcd
virtualenv botbot && source botbot/bin/activate
pip install -e git+https://github.com/BotBotMe/botbot-web.git#egg=botbot
cd $VIRTUAL_ENV/src/botbot
make -j4 dependencies NPM_BIN=/usr/bin/npm
- Edit
.env
; set SECRET_KEY and WEB_SECRET_KEY to good random strings (considerpwgen 24 2
). SetSTORAGE_URL
toSTORAGE_URL='postgres://botbot:YOUR_PSQL_PASSWORD@localhost/botbot'
. SetWEB_PORT='0.0.0.0:8000'
or set up appropriate SSH forwarding. Comment outPUSH_STREAM_URL
. - Export .env with
export $(cat .env | grep -v ^# | xargs)
createdb botbot
- As root:
echo "create extension hstore" | sudo -iu postgres psql botbot
- As botbot again:
manage.py migrate
manage.py createsuperuser
honcho start
It’s alive! Proceed to the setup instructions. Note that your bot will not connect to Freenode until you reload the configuration in “add a channel” step 7.
To use a real web server, set up nginx and uwsgi. Install uwsgi into your virtualenv and apt-get install nginx
. It will fail; this is fine. Edit /etc/nginx/sites-available/default
and comment out listen [::]:80 default_server;
. Run apt-get install -f
to make dpkg happy.
Add to sites-enabled:
Edit the Procfile to launch the web job like uwsgi --socket localhost:8000 --module botbot.wsgi
. Run manage.py collectstatic
to collect the static files. Run honcho start
again and you should be in business!
Ideally, this is where you write systemd configuration files to launch the bot at startup… or you could run it in tmux
like me. #devops
Someone tell me how to do this and I’ll thank you.