blob: 35afabcbf30faf2fa341809657ff1900e9dd27db [file] [log] [blame]
Mohammed Naserf3f59a72023-01-15 21:02:04 -05001#!/bin/bash
2
3{{/*
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17set -ex
18COMMAND="${@:-start}"
19
20function 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 Kozachenko92a39f12023-10-03 15:25:15 +020052 exec uwsgi --ini /etc/heat/heat-api-uwsgi.ini
Mohammed Naserf3f59a72023-01-15 21:02:04 -050053{{- end }}
54}
55
56function 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