Migrating RPGist apps to the cloud
The LFG has just been migrated to Google Cloud, and it has a new face!
This post is technical, for tech guys who are interested in what happens behind the scenes in the RPGist.
The LFG and the D&D 5e Spellcaster Helper were the first RPGist projects, both initially hosted on Heroku. As access to the apps grew, it became necessary to pay for both Hobby Dynos for each of the apps as for their database, which exceeded the limits of records for their free versions. Heroku charges in dollars, and with the dollar going up in the recent times, those costs started to weigh more and more.
Looking for a way to reduce the weight of these costs on me, even if unwillingly, I added an advertising program (Adversal, because Google Adsense did not want to accept me at all) and a Monero mining program (CoinIMP) - configured to use as little as possible of your CPUs, more details here - both of which are turned off for donors, by the way.
Many thanks to all the wonderful RPGists who donate through https://donate.rpgist.net. Your help is greatly appreciated!
Unfortunately, none of these two tactics has made a significant difference (yet), I still pay 99% of the costs from my own pocket (with the help of donations), so I looked for a way to actually cut costs.
Solution: Migrate applications to the cloud, more specifically to Google Cloud, because a standard simple VM there is cheaper than in AWS or Azure, for example.
Problem: I had never managed a production environment before.
When I made the decision to do this migration, however, I was already in the middle the development of the new version of LFG, built with NativeScript + Angular 7, to be able to generate an Android app with the same codebase as the web version, which is practically ready and should be out there soon (when I am able to).
At the same time I was also developing a new RPGist Single Sign-On (SSO) service, the Accounts (which is still pretty crude, I will improve it over time), whose purpose was to solve the problem of every RPGist application having to manage session and user data individually, and to finally get rid of the dependencies to Facebook (which was the only LFG login mechanism by the time), which caused the apps to stop working multiple times by cutting off access to user information, from which applications depended, due to the scandals that involved the social network.
Another thing that Facebook cut off in this period was the possibility of non-SSL / HTTPS websites using the login with Facebook feature. The RPGist donation system, the Donate, was one of such cases, so it became impossible for donors to use the form on the site to notify me of their donations. I get direct notifications from Paypal when I receive donations, so this did not harm anyone, but I had to fix this feature. Including SSL on the Donate was not an attractive solution because, as the application was also hosted on Heroku, I would need to pay for another Hobby dyno. The goal was to reduce costs with Donate, not increase them. I therefore decided to integrate it with Accounts as well, as only Accounts would need to have SSL, since it would be the only one actually integrating with Facebook (though I found out later that I could create SSL certificates for free from Let's Encrypt).
Anyway, I finished the development of LFG and Accounts, I integrated Donate with Accounts and decided that I would launch these new versions of the applications on Google Cloud. Therefore I started studying how I would do this...
I had to learn how to configure a Nginx in a Docker container serving applications that are running on other container, how to use Google Cloud Compute Engines, how to generate SSL certificates and configure them into Nginx, etc., etc.
Long story short: I studied, I tumbled, tried som things, tumbled again, learned how to do and voilà! It's alive!
LFG, Accounts, Donate and their respective databases are all currently running in a single VM on the Google Cloud, with of them with SSL (for freeeeee), and the VM costs less than 3 Hobby Dynos and 2 paid databases that I needed on Heroku. At this point, I am no longer paying for the dyno and the database for LFG on Heroku. The D&D 5e Spellcaster Helper is still there though.
And that's what I have for today. See you in the next post!