From 581e2b1b45213e6c3998d111370303cfd8d08364 Mon Sep 17 00:00:00 2001 From: daniwe4 Date: Wed, 7 Aug 2024 11:45:25 +0200 Subject: [PATCH] master startup:455 change path for minion_master.pub --- README.md | 2 +- app/src/App.php | 2 +- .../stack/states/base/startup/salt-startup.sh | 4 +-- setup/templates/mail/conf/salt-startup.sh | 8 +++++ setup/templates/proxy/conf/salt-startup.sh | 9 ++++++ setup/templates/proxy/conf/startup.conf | 6 ++++ setup/templates/proxy/docker-compose.yml | 6 ++++ setup/updates/update-20240807.sh | 30 +++++++++++++++++++ 8 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 setup/templates/proxy/conf/salt-startup.sh create mode 100644 setup/templates/proxy/conf/startup.conf create mode 100644 setup/updates/update-20240807.sh diff --git a/README.md b/README.md index 8578d376..2ead4a87 100644 --- a/README.md +++ b/README.md @@ -265,7 +265,7 @@ continues then there might be a problem with the public key of the salt main ser following steps: * `doil login ` -* `rm /var/lib/salt/pki/minion/minion_master.pub` +* `rm /etc/salt/pki/minion/minion_master.pub` * `exit` * `doil down ` * `doil up ` diff --git a/app/src/App.php b/app/src/App.php index 1ca2f28f..add20138 100644 --- a/app/src/App.php +++ b/app/src/App.php @@ -9,7 +9,7 @@ class App extends Application { - const NAME = "Doil Version 20240806 - build 2024-08-06"; + const NAME = "Doil Version 20240807 - build 2024-08-07"; public function __construct(Command ...$commands) { diff --git a/setup/stack/states/base/startup/salt-startup.sh b/setup/stack/states/base/startup/salt-startup.sh index 8f30fb33..c8d34563 100644 --- a/setup/stack/states/base/startup/salt-startup.sh +++ b/setup/stack/states/base/startup/salt-startup.sh @@ -6,9 +6,9 @@ service cron start # we need to remove the master pub key because the # startup of this machine invokes new not accepted # crypto stuff -if [ -f "/var/lib/salt/pki/minion/minion_master.pub" ] +if [ -f "/etc/salt/pki/minion/minion_master.pub" ] then - rm /var/lib/salt/pki/minion/minion_master.pub + rm /etc/salt/pki/minion/minion_master.pub fi diff --git a/setup/templates/mail/conf/salt-startup.sh b/setup/templates/mail/conf/salt-startup.sh index caf5e875..024843ca 100755 --- a/setup/templates/mail/conf/salt-startup.sh +++ b/setup/templates/mail/conf/salt-startup.sh @@ -1,4 +1,12 @@ #!/bin/bash +# we need to remove the master pub key because the +# startup of this machine invokes new not accepted +# crypto stuff +if [ -f "/etc/salt/pki/minion/minion_master.pub" ] +then + rm /etc/salt/pki/minion/minion_master.pub +fi + chown -R mysql:mysql /run/mysqld chown -R mysql:mysql /var/lib/mysql diff --git a/setup/templates/proxy/conf/salt-startup.sh b/setup/templates/proxy/conf/salt-startup.sh new file mode 100644 index 00000000..c9349a5f --- /dev/null +++ b/setup/templates/proxy/conf/salt-startup.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# we need to remove the master pub key because the +# startup of this machine invokes new not accepted +# crypto stuff +if [ -f "/etc/salt/pki/minion/minion_master.pub" ] +then + rm /etc/salt/pki/minion/minion_master.pub +fi \ No newline at end of file diff --git a/setup/templates/proxy/conf/startup.conf b/setup/templates/proxy/conf/startup.conf new file mode 100644 index 00000000..e2f3f272 --- /dev/null +++ b/setup/templates/proxy/conf/startup.conf @@ -0,0 +1,6 @@ +[program:startup] +command=./root/salt-startup.sh +autostart=true +autorestart=false +user=root +startsecs=0 \ No newline at end of file diff --git a/setup/templates/proxy/docker-compose.yml b/setup/templates/proxy/docker-compose.yml index bda23d75..d5ac1903 100755 --- a/setup/templates/proxy/docker-compose.yml +++ b/setup/templates/proxy/docker-compose.yml @@ -15,6 +15,12 @@ services: - "80:80" - "443:443" volumes: + - type: bind + source: ./conf/salt-startup.sh + target: /root/salt-startup.sh + - type: bind + source: ./conf/startup.conf + target: /etc/supervisor/conf.d/startup.conf - type: bind source: ./conf/localcerts/ target: /etc/ssl/localcerts/ diff --git a/setup/updates/update-20240807.sh b/setup/updates/update-20240807.sh new file mode 100644 index 00000000..e4be53c8 --- /dev/null +++ b/setup/updates/update-20240807.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +doil_update_20240807() { + cp ${SCRIPT_DIR}/../app/src/App.php /usr/local/lib/doil/app/src/ + cp -r ${SCRIPT_DIR}/../setup/stack/states/ /usr/local/share/doil/stack/states + + cp ${SCRIPT_DIR}/../setup/templates/mail/conf/salt-startup.sh /usr/local/lib/doil/server/mail/conf/ + + cp ${SCRIPT_DIR}/../setup/templates/proxy/conf/salt-startup.sh /usr/local/lib/doil/server/proxy/conf/ + cp ${SCRIPT_DIR}/../setup/templates/proxy/conf/startup.conf /usr/local/lib/doil/server/proxy/conf/ + cp ${SCRIPT_DIR}/../setup/templates/proxy/docker-compose.yml /usr/local/lib/doil/server/proxy/ + + chmod +x /usr/local/lib/doil/server/proxy/conf/salt-startup.sh + + if [ $(docker ps -a --filter "name=_local" --filter "name=_global" --format "{{.Names}}" | wc -l) -gt 0 ] + doil_status_send_message "Prepare existing instances to work with new doil" + then + for INSTANCE in $(docker ps -a --filter "name=_local" --filter "name=_global" --format "{{.Names}}") + do + docker start ${INSTANCE} &> /dev/null + sleep 5 + docker exec -it ${INSTANCE} /bin/bash -c "sed -i 's%/var/lib/salt/pki/minion/minion_master.pub%/etc/salt/pki/minion/minion_master.pub%g' /root/salt-startup.sh" &> /dev/null + docker commit ${INSTANCE} doil/${INSTANCE}:stable &> /dev/null + docker stop ${INSTANCE} &> /dev/null + done + doil_status_okay + fi + + return $? +} \ No newline at end of file