I finally took some time to cut out the private bits from my deploy script and open source it to the world.
This script allows you to deploy an IRC server, bouncer, web interface, bot and some custom modules to anything you can think of: VirtualBox, VPS, EC2, OpenStack, Docker…
The only things that are missing are the SSL certificates and services.
You can add your own certificates, generate self-signed ones, or disable SSL altogether:
The problem is explained and a solution proposed in the CSP book section 2.5, but using events rather than channels.
We worked on the problem dojo style, switching the driver seat every few minutes. But with no one really knowing the library very well, progress was slow, and by the end of the meetup we could make one philosopher eat.
One problem we ran into was that go blocks are lexical, so you can’t easily write helper functions that use <!
So this morning I sat down to make this thing work.
During the meetup we had a function that would do something silly to setup a vector with 5 forks represented by channels, which I replaced by some equally silly, until I just came up with this.
I use channels with a buffer of one and put a fork in that buffer. This makes sure a fork can but picked up and put down without blocking, but only once.