Skip to content
Alex Kersten edited this page Sep 24, 2013 · 23 revisions

Welcome to the enlight-webfront wiki! The server software is mostly meant for running on our own server which is tied to an actual physical fountain, so these instructions are catered to members curious as to the set-up process (or disaster recovery if the server bites the dust - no worries, just re-download the source)! This wiki won't do much justice by way of explaining what Enlight actually is - for that, you should check out our blog - this is simply a down and dirty overview of the Webfront code.

Getting Started

Webfront is a PHP-driven, web-based interface to the C++ end of the fountain, which means in order to run it (for either production or testing purposes), you'll need an environment with a webserver and PHP evaluator, as well as a MySQL database. Once you've downloaded the code (hopefully by cloning it locally), you need to put it somewhere where your PHP service can see it (so you can test it by going to http://localhost/someDirectory). This is usually /var/www/someDirectory in many Unix distributions, assuming a standard Apache installation (which should come with PHP capabilities). If there's a directory called htdocs you'll want to put someDirectory inside of that. If you're using Windows, I suggest using XAMPP (it's a pretty sketchy looking site but it's legit), which will place its web directory in C:/xampp/htdocs. You'll also need to run a MySQL server, and import the most recent database file from the project's /sql directory (this contains schema and any dummy/test values).

The preprocessor directives should take care of compiling on Windows vs Unix (assuming someone actually gets around to writing a Windows UDP listener), although I can't guarantee I didn't miss any spots that would cause issues. I know that it works fine under Windows with Cygwin, as well as Debian, with GCC 3.4.4+.

Bird's Eye View

Graphical overview of the fountain network

Programming Conventions and How-To's

There are some common things that we will want to do with the Webfront, so these documents should outline how to go about doing those in the conventional/best manner.

Interacting via API

See the API Detail page.

Testing vs. Production

An important distinction to make is between the testing environment and the distribution environment. Despite how amazing open-source is, certain things do need to be kept private (our site-wide salt value, the production database connection password, etc.) and as such any source files here on GitHub will contain dummy values for use in testing. In particular, here are the dummy values used with their respective files:

Site-wide salt (for user passwords) - in /SHADOW/SALT: lVZZ`F}x(`,6/GHi*##$67$]c.w=dm:pR3c10u5AnDfR4g113tH1ng5n3Ed5p3c141H4nD1InG:kr*>M@v|pkL{P)50?V}QMf+yKg=vz6eX3L

MySQL database password - in /php/startDatabase.php: ydvCN3q8z7qUFc7X

Again, these are the values that you need to change before deploying to production. These values are fine though for testing, which is why they're here by default.

Another small thing that may need to change before production is the MySQL database host (the default is localhost) which is stored in /php/session.php.

Fore more information about that, see the page on the MySQL configuration.

Finally, the internal communication between enlight-webfront and enlight-backend might need to be configured - the default assumes they're both running on the same machine and communicate over ports 11211 (backend listen) and 11911 (webfront listen). These assumptions are reflected in the following files: api.php, main.cpp

The Service Master Key, which is the string without which the backend will not fulfill requests, must be changed from its default value of AF1993ADFE944E38FE8CED6E490D1BB16C6A20F7F36237753A2EAF5BF2503536. It is a 64-character long key that is prefixed to every request the Webfront makes to the backend, and must match between them, otherwise the backend will not respect the request.