Cutting GitHub out of the loop

The recent curtailing of the popular BitBucket repository service* made me re-think my method of code deployment. Instead of using GitHub Actions or other proprietary service as my sole method of pushing code to my own server, I am cutting GitHub out of the loop and going direct.

*Bitbucket used to have no storage limit – now it’s 1GB for the free version. I had 14GB already on there!! GitHub will do this too at some point, no doubt..

SSH to the rescue

It turns out that pushing directly to your own VPS via ssh is not only supported by git, it is easy, fast and effective. I made my server re-load the web based code automatically (for me Flask) whenever I push. Here are the commands.

1. Set up bare git repository on VPS

mkdir -p /srv/git/myproject.git
cd /srv/git/myproject.git
git init --bare

2. Set up automatic update

create hooks/post-receive:

#!/bin/bash
GIT_WORK_TREE=/var/www/myproject git checkout -f main

make hooks/post-receive executable:

chmod +x /srv/git/myproject.git/hooks/post-receive

3. Add server as a remote

on your local machine:

git remote add server username@your-server-ip:/srv/git/myproject.git

(origin is still set to github, for backup)

4. Push code

git push server main

That’s it! Simple

Now I push main to the server and it deploys. There is much more to look at – the hooks are pretty powerful, you can do a bunch of stuff like update database, re-start web service and more whenever post is received.

Note: Permissions

/srv/git I gave user ownership of:

sudo chown -R username:username /srv/git

Bonus: restarting services with sudo

Allow your command to run as root in the /etc/sudoers file:

visudo
# add a line to the file
username ALL=(ALL) NOPASSWD: /usr/sbin/service myproject restart

Add restart command to hooks/post-receive file:

#!/bin/bash
GIT_WORK_TREE=/var/www/myproject git checkout -f main
echo "Restarting myproject service"
/usr/bin/sudo /usr/sbin/service myproject restart

Now when you push to server the service will automatically restart (and you get a message in the terminal).

It’s time to talk about PRICE

Hey Magic Poi fans.

Brett from EnterAction just ordered enough S3 dev boards to build all of our remaining poi!

Also, we had a meeting – regarding pricing. The “back of the envelope” calculation brings the introductory retail price to US $570 (estimate, subject to change) – that’s for a pair of 120px poi with charger.

The discounted price for PAID Patreon Subscribers will be approximately US $450. That’s an estimate, we have not made them all yet and there could be pricing changes, but I am mentioning the rough estimate now because I have to ask: are you going to buy a pair?

Right now not everything is ready, but next week I am putting the magicpoi.com site up LIVE for anyone to see. Poi #1 is done, we are testing the battery, controls, charging, and especially the durability (it all looks great so far, more details soon). Poi #2 or 3 is going to be flown over from Australia to South Africa in the next couple of months, at which point I will be tightening up the firmware, so I can use them in my shows of course. Poi #4 is then going to be FOR SALE. We are making a WEB STORE to sell them to the public – but the people who have been following along with development come first. That means YOU. We have 7 extra pairs of poi to make in this first “Alpha” batch.

This is not KickStarter by the way – I am not asking for money for something we didn’t make yet. WE ARE BUILDING THE POI RIGHT NOW.

So who wants a pair of Magic Poi? Is US $570 (plus postage) too much to pay? Are you waiting until we have the upgrade with 200px and live DJ sync? Should we try to cut costs by shaving a few pixels? Or are you just happy with building your own “SmartPoi” for now? Let me know! email tom at circusscientist.com or tom at devsoft.co.za