2022-07-11 14:03:55 +08:00
|
|
|
#!/bin/bash
|
|
|
|
# support special char [!"`$%()[]{},.*+-:;<=>?_~/|]
|
|
|
|
new_password=$(pwgen -ncCs 14 1)!
|
|
|
|
sudo sleep 10s
|
|
|
|
sudo sh -c 'echo "init-password started at" $(date -d now) 1>> /tmp/init_debug.txt'
|
|
|
|
|
2022-07-11 14:40:24 +08:00
|
|
|
#1 init for applist of .env
|
|
|
|
{% for app_name in applist.stdout_lines %}
|
2022-07-11 15:29:11 +08:00
|
|
|
sudo docker compose -f /data/apps/{{app_name}}/docker-compose.yml down -v
|
2022-07-11 16:25:18 +08:00
|
|
|
sudo sed -i "s/APP_PASSWORD=.*/APP_PASSWORD=$new_password/g" /data/apps/{{app_name}}/.env
|
2022-07-11 15:29:11 +08:00
|
|
|
sudo docker compose -f /data/apps/{{app_name}}/docker-compose.yml up -d --no-recreate
|
2022-07-11 14:03:55 +08:00
|
|
|
{% endfor %}
|
|
|
|
|
2022-07-11 15:29:11 +08:00
|
|
|
#2 init for applist of special
|
|
|
|
|
|
|
|
sudo sh -c 'echo "init docker ended at" $(date -d now) 1>> /tmp/init_debug.txt'
|