diff --git a/docker/proxysql/Dockerfile.j2 b/docker/proxysql/Dockerfile.j2 index aadfae7b95..8e87a3c312 100644 --- a/docker/proxysql/Dockerfile.j2 +++ b/docker/proxysql/Dockerfile.j2 @@ -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 diff --git a/docker/proxysql/kolla_proxysql_config_sync b/docker/proxysql/kolla_proxysql_config_sync index 956f691886..d6d531f30e 100644 --- a/docker/proxysql/kolla_proxysql_config_sync +++ b/docker/proxysql/kolla_proxysql_config_sync @@ -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) diff --git a/docker/proxysql/kolla_proxysql_start b/docker/proxysql/kolla_proxysql_start deleted file mode 100644 index f24ee732a0..0000000000 --- a/docker/proxysql/kolla_proxysql_start +++ /dev/null @@ -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