Micro-SaaS #2, GhostiFi server_check.py
In this post I am sharing how I’ve integrated a WordPress SaaS subscription frontend with my Python backend for GhostiFi, a VPS VPN service that I am building. I query the database from Python once every minute on a cron and then compare the server table and wp_edd_subscriptions table in order to determine when to trigger a server create, rebuild, or destroy function/method.
This is part 4 of a series of posts that I am writing about developing my second SaaS business. I launched my first SaaS, a UniFi hosting platform, in May of this year and now have over 100 paying customers on that service.
In part 2, I wrote a step-by-step pseudo code overview of how the entire application would work. In this post, I share the actual code for this section of it.
Here is what that looks like in Python.
This is a much better approach than how I wrote HostiFi’s code because I made some fancier SQL statements with joins. Last time I wrote 2 different queries for each (one for subscriptions, one for servers) and looped over them, which was less efficient but worked the same.
If you have any feedback on how I could improve this, please let me know in the comments section!
I am also looking for feedback on the concept itself, as well as beta testers. Please sign up for the newsletter at https://ghostifi.net if you are interested.