GhostiFi — The server.create() function

Reilly Chase
Nov 19, 2018 · 3 min read


As promised in my initial blog post, I am continuing to publish the entire development process of GhostiFi, from concept, to sketch, to pseudocode, to actual code.

In this post (part 6), I will be sharing how I turned the server.create() pseudocode into actual Python:

8 “mini” functions

Rather than writing all the steps of server.create() into one function, I created 8 smaller, reusable chunks of code, and then ran them all within the server.create() function.

Making the OpenVPN install script

One of the more challenging parts of this function was figuring out how to automate the OpenVPN installation. I was able to find a popular OpenVPN installation Github repo here:

So I used that as a starting point.

The contributors had already optimized the security settings, so I left everything as they had recommended. I only modified the script to remove the need for user input, and change the default OpenVPN server port from 1194 to 443, in order to potentially help GhostiFi users get around some of the more restrictive firewalls out there.

When finished, I uploaded it to a GhostiFi public Github repo: New GhostiFi servers will pull the latest version from there when they are built.


Output of function building a new server
OVPN file copied from VPS back to GhostiFi webserver
Info stored back to the database after server is created
VPS VPN setup complete notification email

At this point, after a user purchases a GhostiFi subscription, the VPS will be built, OpenVPN installed, and info stored back to the database.

There is no user dashboard/frontend yet, and no way to rebuild or destroy servers. Lot of work to be done still, but this is a big milestone!

Closing thoughts

I hope this was helpful for anyone who is an aspiring programmer or entrepreneur to see my thought process in how I went about turning a sketched design of a user interface for my product idea into a step-by-step process that any programmer might be able to understand and turn into code.

If you have any feedback on how I could improve this design 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 if you are interested.

If you want to know when I release another post about building GhostiFi, you can follow me on Twitter: @_rchase_ or Medium: Reilly Chase





Reilly Chase

Written by

I help IT providers with Ubiquiti server hosting ➡️