mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-02-03 01:28:39 +08:00
add backup
This commit is contained in:
parent
12c4f81694
commit
6b00bf1f05
20
appmanage/config/config.json
Normal file
20
appmanage/config/config.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"PORTAINER": {
|
||||||
|
"AUTH_URL": "/portainer/api/auth",
|
||||||
|
"HOME_PAGE": "/portainer",
|
||||||
|
"USERNAME": "admin",
|
||||||
|
"PASSWORD": "websoft9@2023"
|
||||||
|
},
|
||||||
|
"NGINXPROXYMANAGER": {
|
||||||
|
"AUTH_URL": "/nginxproxymanager/api/tokens",
|
||||||
|
"HOME_PAGE": "/nginxproxymanager",
|
||||||
|
"USERNAME": "help@websoft9.com",
|
||||||
|
"PASSWORD": "changeme123",
|
||||||
|
"NICKNAME": "Admin"
|
||||||
|
},
|
||||||
|
"KOPIA": {
|
||||||
|
"HOME_PAGE": "/kopia",
|
||||||
|
"USERNAME": "admin",
|
||||||
|
"PASSWORD": "admin"
|
||||||
|
}
|
||||||
|
}
|
@ -43,7 +43,6 @@ server {
|
|||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
location /nginxproxymanager/ {
|
location /nginxproxymanager/ {
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Forwarded-Scheme $scheme;
|
proxy_set_header X-Forwarded-Scheme $scheme;
|
||||||
@ -78,6 +77,39 @@ server {
|
|||||||
sub_filter_once off;
|
sub_filter_once off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location ^~ /kopia {
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Scheme $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Prefix /kopia;
|
||||||
|
proxy_pass http://kopia:51515/;
|
||||||
|
rewrite ^/kopia/(.*)$ /$1 break;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
proxy_set_header Connection $http_connection;
|
||||||
|
proxy_cache_bypass $http_secret_header;
|
||||||
|
proxy_set_header Accept-Encoding "";
|
||||||
|
add_header Pragma "no-cache";
|
||||||
|
add_header Cache-Control "no-cache";
|
||||||
|
# source changes
|
||||||
|
sub_filter 'href="/' 'href="/kopia/';
|
||||||
|
sub_filter 'src="/' 'src="/kopia/';
|
||||||
|
sub_filter '/api' '/kopia/api';
|
||||||
|
sub_filter '/assets' '/kopia/assets';
|
||||||
|
sub_filter '/static/' '/kopia/static/';
|
||||||
|
# script changes
|
||||||
|
sub_filter 'e.runningTaskCount;return(0,k.jsx)(Qr,{' 'e.runningTaskCount;return(0,k.jsx)(Qr,{basename: "/kopia",';
|
||||||
|
sub_filter 'window.location.replace("/' 'window.location.replace("/kopia/';
|
||||||
|
sub_filter '"/kopia-flat.svg"' '"/kopia/kopia-flat.svg"';
|
||||||
|
sub_filter 'href:"/"' 'href:"/kopia/"';
|
||||||
|
sub_filter_types text/css text/javascript application/javascript;
|
||||||
|
sub_filter_once off;
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection $http_connection;
|
proxy_set_header Connection $http_connection;
|
||||||
|
@ -260,6 +260,7 @@ sudo sed -i 's/ListenStream=9090/ListenStream=9000/' /lib/systemd/system/cockpit
|
|||||||
mkdir -p /usr/share/cockpit/appstore
|
mkdir -p /usr/share/cockpit/appstore
|
||||||
mkdir -p /usr/share/cockpit/container
|
mkdir -p /usr/share/cockpit/container
|
||||||
mkdir -p /usr/share/cockpit/nginx
|
mkdir -p /usr/share/cockpit/nginx
|
||||||
|
mkdir -p /usr/share/cockpit/backup
|
||||||
|
|
||||||
# install web
|
# install web
|
||||||
cp -r /data/apps/stackhub/appmanage/static/images /data/stackhubweb/src/apps/build/static
|
cp -r /data/apps/stackhub/appmanage/static/images /data/stackhubweb/src/apps/build/static
|
||||||
@ -267,6 +268,7 @@ cp -r /data/stackhubweb/src/apps/build/* /usr/share/cockpit/appstore
|
|||||||
## install container
|
## install container
|
||||||
cp -r /data/stackhubweb/plugins/portainer/build/* /usr/share/cockpit/container
|
cp -r /data/stackhubweb/plugins/portainer/build/* /usr/share/cockpit/container
|
||||||
cp -r /data/stackhubweb/plugins/nginxproxymanager/build/* /usr/share/cockpit/nginx
|
cp -r /data/stackhubweb/plugins/nginxproxymanager/build/* /usr/share/cockpit/nginx
|
||||||
|
cp -r /data/stackhubweb/plugins/kopia/build/* /usr/share/cockpit/backup
|
||||||
|
|
||||||
# install navigator
|
# install navigator
|
||||||
if [ "$os_type" == 'Ubuntu' ] || [ "$os_type" == 'Debian' ] ;then
|
if [ "$os_type" == 'Ubuntu' ] || [ "$os_type" == 'Debian' ] ;then
|
||||||
@ -289,7 +291,6 @@ if [ "${os_type}" == 'CentOS' ] || [ "$os_type" == 'OracleLinux' ] ;then
|
|||||||
sudo yum install cockpit-navigator -y 1>/dev/null 2>&1
|
sudo yum install cockpit-navigator -y 1>/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# uninstall plugins
|
# uninstall plugins
|
||||||
rm -rf /usr/share/cockpit/apps /usr/share/cockpit/selinux /usr/share/cockpit/kdump /usr/share/cockpit/sosreport /usr/share/cockpit/packagekit
|
rm -rf /usr/share/cockpit/apps /usr/share/cockpit/selinux /usr/share/cockpit/kdump /usr/share/cockpit/sosreport /usr/share/cockpit/packagekit
|
||||||
|
|
||||||
@ -368,11 +369,24 @@ cd /data/apps/stackhub/docker/w9portainer && sudo docker compose up -d
|
|||||||
docker pull backplane/pwgen
|
docker pull backplane/pwgen
|
||||||
new_password=$(docker run --name pwgen backplane/pwgen 15)!
|
new_password=$(docker run --name pwgen backplane/pwgen 15)!
|
||||||
docker rm -f pwgen
|
docker rm -f pwgen
|
||||||
sudo sed -i 's/"PORTAINER_USERNAME": ".*"/"PORTAINER_USERNAME": "admin"/g' /usr/share/cockpit/container/config.json
|
sudo sed -i 's/"PORTAINER_USERNAME": ".*"/"PORTAINER_USERNAME": "admin"/g' /usr/share/cockpit/appstore/config.json
|
||||||
sudo sed -i 's/"PORTAINER_PASSWORD": ".*"/"PORTAINER_PASSWORD": "'$new_password'"/g' /usr/share/cockpit/container/config.json
|
sudo sed -i 's/"PORTAINER_PASSWORD": ".*"/"PORTAINER_PASSWORD": "'$new_password'"/g' /usr/share/cockpit/appstore/config.json
|
||||||
curl -X POST -H "Content-Type: application/json" -d '{"username":"admin", "Password":"'$new_password'"}' http://127.0.0.1:9091/api/users/admin/init
|
curl -X POST -H "Content-Type: application/json" -d '{"username":"admin", "Password":"'$new_password'"}' http://127.0.0.1:9091/api/users/admin/init
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StartKopia(){
|
||||||
|
|
||||||
|
echo "Start Kopia ..."
|
||||||
|
docker pull backplane/pwgen
|
||||||
|
new_password=$(docker run --name pwgen backplane/pwgen 15)!
|
||||||
|
docker rm -f pwgen
|
||||||
|
sudo sed -i 's/POWER_PASSWORD=.*/POWER_PASSWORD="'$new_password'"/g' /data/apps/stackhub/docker/w9kopia/.env
|
||||||
|
cd /data/apps/stackhub/docker/w9kopia && sudo docker compose up -d
|
||||||
|
|
||||||
|
sudo sed -i 's/"KOPIA_USERNAME": ".*"/"KOPIA_USERNAME": "admin"/g' /usr/share/cockpit/appstore/config.json
|
||||||
|
sudo sed -i 's/"KOPIA_PASSWORD": ".*"/"KOPIA_PASSWORD": "'$new_password'"/g' /usr/share/cockpit/appstore/config.json
|
||||||
|
}
|
||||||
|
|
||||||
InstallNginx(){
|
InstallNginx(){
|
||||||
|
|
||||||
echo "Install nginxproxymanager ..."
|
echo "Install nginxproxymanager ..."
|
||||||
@ -387,9 +401,9 @@ docker rm -f pwgen
|
|||||||
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{"email": "help@websoft9.com", "nickname": "admin", "is_disabled": false, "roles": ["admin"]}' http://127.0.0.1:9092/api/users/1
|
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{"email": "help@websoft9.com", "nickname": "admin", "is_disabled": false, "roles": ["admin"]}' http://127.0.0.1:9092/api/users/1
|
||||||
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{"type":"password","current":"changeme","secret":"'$new_password'"}' http://127.0.0.1:9092/api/users/1/auth
|
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{"type":"password","current":"changeme","secret":"'$new_password'"}' http://127.0.0.1:9092/api/users/1/auth
|
||||||
sleep 3
|
sleep 3
|
||||||
sudo sed -i 's/"NGINXPROXYMANAGER_USERNAME": ".*"/"NGINXPROXYMANAGER_USERNAME": "help@websoft9.com"/g' /usr/share/cockpit/nginx/config.json
|
sudo sed -i 's/"NGINXPROXYMANAGER_USERNAME": ".*"/"NGINXPROXYMANAGER_USERNAME": "help@websoft9.com"/g' /usr/share/cockpit/appstore/config.json
|
||||||
sudo sed -i 's/"NGINXPROXYMANAGER_PASSWORD": ".*"/"NGINXPROXYMANAGER_PASSWORD": "'$new_password'"/g' /usr/share/cockpit/nginx/config.json
|
sudo sed -i 's/"NGINXPROXYMANAGER_PASSWORD": ".*"/"NGINXPROXYMANAGER_PASSWORD": "'$new_password'"/g' /usr/share/cockpit/appstore/config.json
|
||||||
sudo sed -i 's/"NGINXPROXYMANAGER_NIKENAME": ".*"/"NGINXPROXYMANAGER_NIKENAME": "admin"/g' /usr/share/cockpit/nginx/config.json
|
sudo sed -i 's/"NGINXPROXYMANAGER_NIKENAME": ".*"/"NGINXPROXYMANAGER_NIKENAME": "admin"/g' /usr/share/cockpit/nginx/appstore.json
|
||||||
echo "edit password success ..."
|
echo "edit password success ..."
|
||||||
while [ ! -d "/var/lib/docker/volumes/w9nginxproxymanager_nginx_data/_data/nginx/proxy_host" ]; do
|
while [ ! -d "/var/lib/docker/volumes/w9nginxproxymanager_nginx_data/_data/nginx/proxy_host" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -409,4 +423,5 @@ ParpareStaticFiles
|
|||||||
InstallCockpit
|
InstallCockpit
|
||||||
StartAppMng
|
StartAppMng
|
||||||
StartPortainer
|
StartPortainer
|
||||||
|
StartKopia
|
||||||
InstallNginx
|
InstallNginx
|
||||||
|
Loading…
Reference in New Issue
Block a user