This commit is contained in:
qiaofeng1227 2023-10-12 14:31:06 +08:00
parent 73d772889a
commit 0bfa2d4043
2 changed files with 8 additions and 5 deletions

View file

@ -8,8 +8,8 @@ cockpit_port="9000"
# 监控文件发生变动时需要做的事情
on_change() {
set +e
# TODO 从配置文件中获取端口号 apphub need add getconfig cli
cockpit_port =$(docker exec -it websoft9-apphub apphub getconfig cockpit port)
# 从配置文件中获取端口号
cockpit_port=$(sudo docker exec -i websoft9-apphub apphub getconfig --section cockpit --key port)
sudo sed -i "s/ListenStream=[0-9]*/ListenStream=${cockpit_port}/" /lib/systemd/system/cockpit.socket
sudo systemctl daemon-reload
sudo systemctl restart cockpit

View file

@ -4,6 +4,7 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
deployment_username="admin"
credential_path="/var/websoft9/credential"
containers=("websoft9-git" "websoft9-deployment" "websoft9-proxy")
sections=("gitea" "portainer" "nginx_proxy_manager")
max_retries=20
declare -A usernames passwords
@ -56,10 +57,12 @@ done
set -e # Stop ignoring errors
# Set credentials to config.ini
for container in ${containers[@]}; do
length=${#containers[@]}
for ((i=0; i<$length; i++)); do
container=${containers[$i]}
section=${sections[$i]}
echo "$container:"
echo "Username: ${usernames[$container]}"
echo "Password: ${passwords[$container]}"
docker exec -it websoft9-apphub apphub getconfig cockpit port
sudo docker exec -i websoft9-apphub apphub setconfig --section $section --key ${usernames[$container]} --value ${passwords[$container]}
done