It configures module to be run for a specified city and starts them automatically
This command accepts a list of modules to add like ./add_module "Bolivia-Cochabamba" otp tileserver
or add otp tileserver
- Command:
add_module <name of city> <module name> [<module name>]
- Example:
add_module "Bolivia-Cochabamba" otp
- Example (using
workon
script):add otp
For each module specified on the command line, add_module
will execute ./server <name of city> up <module name>
in order to start the added module. You don't have to do that in a separate step. But you will need to inform nginx
about this. We do so by executing ./server reload nginx
which causes nginx to reload its configuration without restarting.
This script iterates through the list of modules given on the command line and configures them for the specified city. Each iteration contains the following steps:
- Compile compose (if a compose file at
modules/<name of module>/<name of city>.yml
does not exist already) or activate it. - Configure NGINX so the services of the module can be accessed from the interweb
- Prepare the logging infrastructure for NGINX request logging which will be done per domain (ideally per city if you give each city an own domain)
- Configure NGINX so the services of the module can be fully accessed from the intraweb (for sysadmins only)
- Calling plugins (if any)
- Execute
./server <name of city> up <name of module>
if the compiled compose file at modules/<name of module>/<name of city>.yml
does not exist then it will compile it. Compiling means that variables specified in the compose will be expanded if their have been defined in the city environment configuration.
If the compiled compose file exists then this step will activate it.
If the module to configure for the specified city has a nginx.conf
then this step will be executed further otherwise skipped and interweb access therefore left unconfigured (this is useful for modules providing internal services for other modules e.g. database management systems). An existing nginx.conf
will be load into memory and variables inside expanded. Following variables will be expanded:
- All variables defined in the city environment file
$projectname
$city_normalize
which is the lowercase version of$city
$modulename
expanding to<name of module>
NGINX configuration folder for that city and the different files will be created if they don't exist so nothing already existing will be overwritten. This step operates inside ./data/nginx/interweb
.
Creates the folder ./data/logs/nginx/<name of domain>
up to its parents (if not existing). This is the folder where NGINX will save the log files into as configured by template files loaded and filled in the previous step.
Only if enabled in ./data/instance.conf
otherwise skipped.
NGINX configuration folder for that city and the different files will be created if they don't exist so nothing already existing will be overwritten. This step operates inside ./data/nginx/intraweb
.
Read Extending Trufi Multi-Instance Server - Extending 'add_module' script.