Webservices

From The Munich Maker Lab's Wiki
Jump to navigation Jump to search

We are operating an internal web host http://services.intern.munichmakerlab.de/, where we are hosting our internal web sites and tools in a central place. Every service is located in a subfolder (e.g. http://services.intern.munichmakerlab.de/kalendr/).

Technical Background

This central web service is a Docker Container which gets all websites from our Munichmakerlab github organization. Therefore, it pulls every five minutes all repositories which are tagged with webintern. They are available with their repository name as the subfolder, e.g. https://github.com/munichmakerlab/kalendr becomes http://services.intern.munichmakerlab.de/kalendr/

Adding a new services

To add a new web service, just add a new repository to our github organization. Choose the name wisely (see above) and tag the repository with webintern. Commit your code to the repo. (Make sure you tag your repo first and afterwards commit otherwise it won't be picked up).

Wait for five minutes and it should be available. It is best practice to add an index.html or index.php in the root folder of your repo.

Don't add any secure data in this repo (like passwords etc.) See the environment variable section on how you can overcome this.

Scripting

The docker container runs also PHP7.0 FPM, so you can add PHP code as usually, just add the .php extension to your files.

Environment Variables

The docker container injects common system settings like MQTT hosts, credentials etc. So if you want to access and use them in your PHP scripts, just use $_ENV["VARIABLE_NAME"]

This is a list of currently available variables:

Name Description
none :-(

If you need any new variable, ask JanS, Severin or Matthias in the #network channel of our flowdock chat to get it added.