My problem is that I need to set the port via an environment variable inside the application.properties. The port is known on startup and not before. Unfortunately I am not so familiar with Python.
I am wondering if somebody already tried to install it on PaaS like Cloud Foundry and has maybe some hints.
Create following files for Cloud Foundry to detect the right buildpack:
runtime.txt just containing: python-3.2.0
requirements.txt leaving blank
Create a start.sh file with following content.
echo Port:$PORT
sed -i 's/server_port: 8080/server_port: '"$PORT"'/g' distribution/application.properties
sed -i 's/server_url: localhost:8080/server_url: app-name.yourdomain.com:80/g' distribution/plugins.properties
python3.2 distribution/application.py
The start.sh script is doing the following:
It is replacing the port in the application.properties with the right one used by Cloud Foundry on startup. It replaces the server_url where liveblog searches for javascript resources with the application url. It starts the application.
The application can be pushed to Cloud Foundry by using:
cf push app-name -c "sh start.sh"
This instruction is without warranty because I did not test all functionality.
Furthermore the production way of installing liveblog is described by using mongrel2. I am not sure this will be possible on Cloud Foundry.
Post edited by Alexander Blotny at 2015-02-17 11:36:22
By the way, I want to inform you what in upcoming Liveblog 3.0 we already have configuration by environment variables and in general more common workflow (like using already mentioned requirements.txt and upraising in popularity Dockerfile-s)