Created
January 27, 2016 11:57
-
-
Save mmahut/15334456875e47154ab5 to your computer and use it in GitHub Desktop.
How to run our own apache configuration from a python cartridge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### First of all, we create app.py that will execute our own custom script | |
[python-mmahut.rhcloud.com repo]\> cat app.py | |
import subprocess | |
process = subprocess.Popen("/tmp/start_apache.sh", stdout=subprocess.PIPE, shell=True) | |
output = process.communicate()[0] | |
[python-mmahut.rhcloud.com repo]\> | |
### start_apache is just an example, better location would suit it more | |
### please note /tmp/my_own_customer_httpd.conf | |
[python-mmahut.rhcloud.com repo]\> cat /tmp/start_apache.sh | |
#!/bin/bash | |
nohup /usr/sbin/httpd -C 'Include /var/lib/openshift/56a8a10c89f5cfbbef00006b/python/etc/conf.d/*.conf' -f /var/lib/openshift/56a8a10c89f5cfbbef00006b/python/etc/conf/httpd_nolog.conf -c 'Include /etc/openshift/cart.conf.d/httpd/*.conf' -c 'Include /tmp/my_own_customer_httpd.conf' -c 'Include /etc/openshift/cart.conf.d/httpd/python/*.conf' -DFOREGROUND |& /usr/bin/logshifter -tag python & | |
[python-mmahut.rhcloud.com repo]\> | |
### let's try to run it from the control script | |
[python-mmahut.rhcloud.com repo]\> pgrep httpd |wc -l | |
0 | |
[python-mmahut.rhcloud.com repo]\> control start | |
Starting Python 3.3 cartridge (app.py server) | |
[python-mmahut.rhcloud.com repo]\> pgrep httpd |wc -l | |
4 | |
[python-mmahut.rhcloud.com repo]\> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment