Skip to content
London Hackspace web site
PHP HTML Python Ruby CSS JavaScript Other
Branch: master
Clone or download
Michael Cullen
Michael Cullen Don't assume database is on localhost
It would be nice to be able to run the site in docker for development. In order to do
that sensibly, the database needs to be in a separate container.

This commit adds an optional config variable for DB_HOST. Existing users shouldn't notice
the difference.
Latest commit 3c2b2f2 Sep 14, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Looks like this is now done by the python stuff (This script is not i… Jan 12, 2019
etc Don't assume database is on localhost Sep 14, 2019
lhs stuff from the live site Oct 1, 2018
lhsauth Add base template and trivial implementation Aug 19, 2017
lib Don't assume database is on localhost Sep 14, 2019 cost of hacking: fix error due to optional variable Sep 14, 2019
resources Latest sticker SVG Apr 24, 2013
ruby-lib CRLF conversion... Feb 13, 2010
shared Refactor and polish the London site. Mar 30, 2009
test Correct FITID for test OFX Jul 5, 2012
.gitignore Add vagrant-env to gitignore Jul 25, 2019
.gitmodules Correct gocardless repo Jul 9, 2017 Update README to fix missing Jul 25, 2019
Vagrantfile Merge remote-tracking branch 'origin/master' into python Jul 5, 2017 Ensure the var/session directory is made Jul 25, 2019 stuff from the live site Oct 1, 2018 Update README Aug 4, 2017
requirements.txt make newer django versions possible Jan 6, 2019

This is the source code for the London Hackspace web site

Getting Started

We use Vagrant to deploy a consistent development environment. To get your development environment set up:

  • Clone this repo
  • Fetch libraries: git submodule update --init
  • Create config file (the defaults are fine): cp etc/config.php.example etc/config.php
  • Create production settings file (the defaults are fine): cp lhs/ lhs/
  • Install Vagrant and Virtualbox
  • Run vagrant up in this directory. This will create and configure a virtual machine.

You should now be able to connect to http://localhost:8000 to view your development site. Changes you make on your machine will be reflected on the VM.

If you need to log into the VM for any reason, you can just run vagrant ssh. To access the postgres database, run psql hackspace from the SSH shell.

Making yourself an admin

In the postgres shell:

hackspace=# update users set subscribed=True;
hackspace=# update users set admin=True;

to make yourself a member and an admin

letting apache add ldap users (!)

use visudo to add this:

www-data ALL=(www-data:ldapadmin) NOPASSWD:NOSETENV: /var/www/hackspace-foundation-sites/bin/, /var/www/hackspace-foundation-sites/bin/

and then:

groupadd ldapadmin
chgrp ldapadmin /etc/smbldap-tools/smbldap_bind.conf
chmod 0640 /etc/smbldap-tools/smbldap_bind.conf

Enabling Calendar management

  1. Enable the Calendar API at
  2. Create a service account for OAuth at
  3. Put the OAuth certificate in ./var, and correct the service_account_name and key_file_location in lib/calendar.php
  4. Go to the Hackspace calendar on Google and share it with the same service_account_name address

API documentation

Upgrading from PHP

Add to cron:

0 4 * * *  www-data  /var/www/hackspace-foundation-sites/ clearsessions

After setting the credentials appropriately and taking a backup, run:

env/bin/python migrate main 0001 --fake-initial
env/bin/python migrate sites
env/bin/python migrate

And then run in the following SQL files:

  • etc/create-flourish-tables.sql
  • etc/restore-column-defaults.sql
  • etc/restore-multicolumn-pks.sql

And don't forget to run:

env/bin/python collectstatic

after each deployment.

You can’t perform that action at this time.