Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | {{/* |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */}} |
| 16 | |
| 17 | set -ex |
| 18 | COMMAND="${@:-start}" |
| 19 | |
| 20 | function start () { |
| 21 | |
| 22 | {{- if .Values.manifests.certificates }} |
| 23 | for WSGI_SCRIPT in heat-wsgi-api; do |
| 24 | cp -a $(type -p ${WSGI_SCRIPT}) /var/www/cgi-bin/heat/ |
| 25 | done |
| 26 | |
| 27 | if [ -f /etc/apache2/envvars ]; then |
| 28 | # Loading Apache2 ENV variables |
| 29 | source /etc/apache2/envvars |
| 30 | mkdir -p ${APACHE_RUN_DIR} |
| 31 | fi |
| 32 | |
| 33 | {{- if .Values.conf.software.apache2.a2enmod }} |
| 34 | {{- range .Values.conf.software.apache2.a2enmod }} |
| 35 | a2enmod {{ . }} |
| 36 | {{- end }} |
| 37 | {{- end }} |
| 38 | |
| 39 | {{- if .Values.conf.software.apache2.a2dismod }} |
| 40 | {{- range .Values.conf.software.apache2.a2dismod }} |
| 41 | a2dismod {{ . }} |
| 42 | {{- end }} |
| 43 | {{- end }} |
| 44 | |
| 45 | if [ -f /var/run/apache2/apache2.pid ]; then |
| 46 | # Remove the stale pid for debian/ubuntu images |
| 47 | rm -f /var/run/apache2/apache2.pid |
| 48 | fi |
| 49 | # Starts Apache2 |
| 50 | exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }} |
| 51 | {{- else }} |
Oleksandr Kozachenko | 92a39f1 | 2023-10-03 15:25:15 +0200 | [diff] [blame] | 52 | exec uwsgi --ini /etc/heat/heat-api-uwsgi.ini |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 53 | {{- end }} |
| 54 | } |
| 55 | |
| 56 | function stop () { |
| 57 | {{- if .Values.manifests.certificates }} |
| 58 | {{ .Values.conf.software.apache2.binary }} -k graceful-stop |
| 59 | {{- else }} |
| 60 | kill -TERM 1 |
| 61 | {{- end }} |
| 62 | } |
| 63 | |
| 64 | $COMMAND |