Run proxysql with proxysql user

This patch is switching root user to
proxysql user and provides some
necessary changes to work.

Change-Id: Id603cc1e9c084eac8afc4c6d2ddde9a1f4fe6728
This commit is contained in:
Michal Arbet 2022-07-21 16:11:45 +02:00
parent 9f25aac18a
commit e5fe2a33b9
3 changed files with 11 additions and 14 deletions

View File

@ -26,10 +26,16 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{{ macros.configure_user(name='proxysql') }}
{{ macros.install_packages(proxysql_packages | customizable("packages")) }}
COPY kolla_proxysql_start kolla_proxysql_config_sync kolla_extend_start /usr/local/bin/
RUN chmod 755 /usr/local/bin/kolla_proxysql_start \
&& chmod 755 /usr/local/bin/kolla_proxysql_config_sync \
COPY kolla_proxysql_config_sync kolla_extend_start /usr/local/bin/
RUN chmod 755 /usr/local/bin/kolla_proxysql_config_sync \
&& chmod 644 /usr/local/bin/kolla_extend_start
RUN install -g proxysql -o proxysql -m 770 -d /var/lib/kolla/proxysql \
&& touch /etc/proxysql.cnf \
&& chown proxysql:proxysql /etc/proxysql.cnf \
&& chmod 600 /etc/proxysql.cnf
{% block proxysql_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER proxysql

View File

@ -136,8 +136,8 @@ class ProxySQLConfig:
def write_config(self):
LOG.info("Writing config to {}".format(self.conf_file))
if os.path.exists(self.conf_file):
os.remove(self.conf_file)
with open(self.conf_file, 'wb') as f:
pass
for k, v in self.config.items():
if isinstance(v, dict):
self._write_dict(k, v)

View File

@ -1,9 +0,0 @@
#!/bin/bash
PROXYSQL_LOG_FILE="/var/log/kolla/proxysql/proxysql.log"
proxysql \
--exit-on-error \
--idle-threads \
--no-version-check \
-f -D /var/lib/proxysql -c /etc/proxysql.cnf >> ${PROXYSQL_LOG_FILE} 2>&1