~ 5 Minute Read.
The most challenging project I worked on since quite a while was the WebVR game Vhite Rabbit built for the Virtuleap Competition. With multiplayer being one of the features we wanted to have for it, a whole new set of skills had to be acquired.
I had written a bit of net code before (with pyromania), but I never realized deploying and setting up the server and all the infrastructure around it would be such a task. It turned out to be those 80% of the time you spend on the 20% of work!
We originally wanted to run the server on Uberspace, which currently runs CentOS 6, though, with GCC 4.4.7 (early 2012)—not great for modern C++ code and not supported by Magnum. Also, CMake 22.214.171.124 runs there, which is just sufficient for Magnum on the other hand, but insufficient for POCO.
“Just build everything myself!”, I thought. Thankfully I got advice against that; probably preventing a huge number of problems with all of that. Instead, I found out that Uberspace is upgrading to CentOS 7! Way more acceptable environment there, but they’re in beta with that and the feature to open a port to the outside is not available yet… 1
Finally, I ended up on digital ocean! 2 Boy that was exciting. First of all I felt really “professional” being on such a powerful cloud platform—very important :P—and second of all I had a blank canvas of CentOS 7 now, which allowed me to transfer all the work I had done for running the multiplayer server on Uberspace before I found out that that port opening feature was missing there.
First, I learnt about some SSH stuff that was not yet fully developed in my brain yet, then that git-bash has an ssh-client I now prefer over putty on Windows. I went on to realize what sudo is actually about and that it’s not just equivalent to “run as administrator” on Windows. I learnt how to setup a service using systemd and hardened some unix knowledge.
Good that I already knew how to quit vim. 3
Building happens through Gitlab CI, not on the server. After the building is done on a custom CentOS docker container, which builds a greater CMake version and prebuilds some dependencies to speed up the builds, the binaries are uploaded to the server using scp.
Obviously the server needs to be stopped before copying and then started again once the copy finished. While in this moment I realize that this downs the server should the copy ever fail, but apart from that it works very well! To allow Gitlab CI to do this via ssh, I use sudo to make exactly those commands available to the user I created for it.
We will be hosting our WebVR game on an SSL encrypted web page (hence,
https://). Turns out if you do that,
you can no longer use the insecure WebSocket protocol for connecting to the multiplayer server. You use
You don’t want to know how much time I had to spend learning about how SSL generally works and why the hell it wasn’t sufficient to grab a certificate from letsencrypt.org and be happy.
The server needs to support the https protocol (obviously now, but I didn’t realize at first) for the encrypted WebSocket handshake. That requires you to configure POCO with the correct keys you retrieved from the CA (certificate authority, in this case letsencrypt.org) and have it initialize OpenSSL in the correct way. Did you know that there is not just one way to SSL? SSL has many “cyphers” and different protocols and respective versions.
Now I’m stuck trying to get Chrome and my server to find overlapping cyphers, which I believe I found the solution for already (Edit 2018-07-11: I didn’t). And even if that is not the solution, I will push through. Like with all of those other problems I had.
Do a project you really want to happen and your passion will make you run through walls and learn an astounding amount of new things in the process.
- Also, changing the webserver is not possible yet, otherwise I could have tried to find a solution misusing web ports.
- They accept paypal, which was great! AWS for example just takes a credit/debit card even for their free plan and I do not own such a thing. Therefore was happy to pay the 5$ in a way I could. Also, that’s a referal link. Use it to get 10$ to start off with.
- I’ve been using vim for over two years on a day-to-day basis, at least 8 hours per day. I’m writing this in vim.
Written in 50 minutes, edited in 5 minutes.