blob: 73ae5718452e629b45f2471ab23292d467c0c7a7 [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{{- if .Values.manifests.certificates }}
22 for WSGI_SCRIPT in cinder-wsgi; do
23 cp -a $(type -p ${WSGI_SCRIPT}) /var/www/cgi-bin/cinder/
24 done
25
26 if [ -f /etc/apache2/envvars ]; then
27 # Loading Apache2 ENV variables
28 source /etc/apache2/envvars
29 mkdir -p ${APACHE_RUN_DIR}
30 fi
31
32{{- if .Values.conf.software.apache2.a2enmod }}
33 {{- range .Values.conf.software.apache2.a2enmod }}
34 a2enmod {{ . }}
35 {{- end }}
36{{- end }}
37
38{{- if .Values.conf.software.apache2.a2dismod }}
39 {{- range .Values.conf.software.apache2.a2dismod }}
40 a2dismod {{ . }}
41 {{- end }}
42{{- end }}
43
44 if [ -f /var/run/apache2/apache2.pid ]; then
45 # Remove the stale pid for debian/ubuntu images
46 rm -f /var/run/apache2/apache2.pid
47 fi
48 # Starts Apache2
49 exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }}
50{{- else }}
Rico Lin5aa4a902023-11-02 01:30:08 +080051 exec uwsgi --ini /etc/cinder/cinder-api-uwsgi.ini
Mohammed Naserf3f59a72023-01-15 21:02:04 -050052{{- end }}
53}
54
55function stop () {
56{{- if .Values.manifests.certificates }}
57 if [ -f /etc/apache2/envvars ]; then
58 # Loading Apache2 ENV variables
59 source /etc/apache2/envvars
60 mkdir -p ${APACHE_RUN_DIR}
61 fi
62 {{ .Values.conf.software.apache2.binary }} -k graceful-stop
63{{- else }}
64 kill -TERM 1
65{{- end }}
66}
67
68$COMMAND