Explorar o código

plugin update

qiaofeng1227 %!s(int64=2) %!d(string=hai) anos
pai
achega
1a11fdf031
Modificáronse 4 ficheiros con 33 adicións e 65 borrados
  1. 0 49
      .github/workflows/logo.yml
  2. 1 1
      appmanage/Dockerfile
  3. 6 4
      appmanage/api/service/manage.py
  4. 26 11
      install/install.sh

+ 0 - 49
.github/workflows/logo.yml

@@ -1,49 +0,0 @@
-name: logo timely update
-
-on: 
-  workflow_dispatch:
-  
-jobs:
-  build:
-    runs-on: ubuntu-latest
-
-    steps:
-    - uses: actions/checkout@master
-      name: Check out code  
-    
-    - name: update logo
-      run: |   
-        # 获取contentful中所有url
-        entry=$(curl --include \
-             --request GET \
-             --header 'Authorization: Bearer ${{secrets.CONTENTFUL_TOKEN}}' \
-             https://api.contentful.com/spaces/ffrhttfighww/environments/master/entries?content_type=media\&select=fields.slug |tail -n 1)
-        echo $entry
-        applist=$(echo $entry | sed 's/en-US/en/g' | jq -r '.items[] | .fields.slug.en')
-        echo $applist
-        
-        for app in ${applist};do
-          if [ "$app" = null ];then
-            continue
-          fi
-          item=$(curl --include \
-                     --request GET \
-                     --header 'Authorization: Bearer ${{secrets.CONTENTFUL_TOKEN}}' \
-                     https://api.contentful.com/spaces/ffrhttfighww/environments/master/entries?content_type=media\&fields.slug=${app}\&select=fields.imageurl\&locale=en-US | tail -n 1)
-          echo $item
-          url=$(echo $item | sed 's/en-US/en/' | jq -r '.items[0].fields.imageurl.en')
-          echo $url
-          file=$(echo appmanage/static/images/${url##*/})
-          echo $file
-          if [[ -f ${file} ]];then
-            echo "存在此文件,跳过"
-            continue
-          fi
-          echo "执行wget"
-          wget --timeout=3 -q -P appmanage/static/images "$url"
-        done
-        
-    - name: push logo
-      uses: stefanzweifel/git-auto-commit-action@v4
-      with:
-        commit_message: update logo

+ 1 - 1
appmanage/Dockerfile

@@ -10,7 +10,7 @@ COPY static ./static
 COPY requirements.txt main.py  ./
 RUN apt update
 
-# Install supervisord
+# Install supervisords
 RUN apt install -y supervisor
 COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
 COPY config/cmd.sh /cmd.sh

+ 6 - 4
appmanage/api/service/manage.py

@@ -35,7 +35,9 @@ q = Queue(connection=redis_conn, default_timeout=3600)
 
 def auto_update():
     myLogger.info_logger("auto update")
-    shell_execute.execute_command_output_all("wget https://websoft9.github.io/StackHub/install/update_appstore.sh && bash update_appstore.sh 1>/dev/null 2>&1")
+    shell_execute.execute_command_output_all("rm -rf /tmp/update_appstore.sh")
+    shell_execute.execute_command_output_all("cd /tmp && wget https://websoft9.github.io/websoft9/install/update_appstore.sh")
+    shell_execute.execute_command_output_all("bash /tmp/update_appstore.sh 1>/dev/null 2>&1")
 
 scheduler = BackgroundScheduler()
 scheduler.add_job(auto_update, 'cron', hour=1)
@@ -89,7 +91,7 @@ def AppStoreUpdate():
             if change != '':
                 content.append(change)
         shell_execute.execute_command_output_all("rm -rf /tmp/update_appstore.sh")
-        shell_execute.execute_command_output_all("cd /tmp && wget https://websoft9.github.io/StackHub/install/update_appstore.sh")
+        shell_execute.execute_command_output_all("cd /tmp && wget https://websoft9.github.io/websoft9/install/update_appstore.sh")
         shell_execute.execute_command_output_all("bash /tmp/update_appstore.sh 1>/dev/null 2>&1")
         
         return content
@@ -98,8 +100,8 @@ def AppStoreUpdate():
 
 # 获取 update info
 def get_update_list():
-    local_path = '/data/apps/stackhub/install/version.json'
-    repo = 'StackHub'
+    local_path = '/data/apps/websoft9/install/version.json'
+    repo = 'websoft9'
     local_version = "0"
     try:
         op = shell_execute.execute_command_output_all("cat " + local_path)['result']

+ 26 - 11
install/install.sh

@@ -10,7 +10,6 @@ trap 'error_exit "Please push issue to: https://github.com/Websoft9/StackHub/iss
 
 urls=(
     https://github.com
-    https://gitee.com
     https://ghproxy.com/https://github.com
 )
 
@@ -275,22 +274,35 @@ fi
 echo "Set cockpit port to 9000 ..." 
 sudo sed -i 's/ListenStream=9090/ListenStream=9000/' /lib/systemd/system/cockpit.socket
 
+clone_repo $fasturl/Websoft9/plugin-appstore /data/apps/plugin-appstore
+clone_repo $fasturl/Websoft9/plugin-myapps /data/apps/plugin-myapps
+clone_repo $fasturl/Websoft9/plugin-portainer /data/apps/plugin-portainer
+clone_repo $fasturl/Websoft9/plugin-settings /data/apps/plugin-settings
+clone_repo $fasturl/Websoft9/plugin-nginx /data/apps/plugin-nginx
+
 # install plugins
 # install appstore
 mkdir /usr/share/cockpit/appstore
-cp -r /data/apps/stackhub-web/plugins/appstore/build/* /usr/share/cockpit/appstore
+cp -r /data/apps/plugin-appstore/build/* /usr/share/cockpit/appstore
+cp -r /data/apps/plugin-appstore/data /usr/share/cockpit/appstore/static/
+
 # install portainer
 mkdir /usr/share/cockpit/container
-cp -r /data/apps/stackhub-web/plugins/portainer/build/* /usr/share/cockpit/container
+cp -r /data/apps/plugin-portainer/build/* /usr/share/cockpit/container
+
 ## install nginx
 mkdir /usr/share/cockpit/nginx
-cp -r /data/apps/stackhub-web/plugins/nginxproxymanager/build/* /usr/share/cockpit/nginx
+cp -r /data/apps/plugin-nginx/build/* /usr/share/cockpit/nginx
+
 ## install settings
 mkdir /usr/share/cockpit/settings
-cp -r /data/apps/stackhub-web/plugins/settings/build/* /usr/share/cockpit/settings
+cp -r /data/apps/plugin-settings/build/* /usr/share/cockpit/settings
+
 ## install myapps
 mkdir /usr/share/cockpit/myapps
-cp -r /data/apps/stackhub-web/plugins/myapps/build/* /usr/share/cockpit/myapps
+cp -r /data/apps/plugin-myapps/build/* /usr/share/cockpit/myapps
+cp -r /data/apps/plugin-appstore/logos /usr/share/cockpit/appstore/static/
+rm -rf /data/apps/plugin-*
 
 # install navigator
 if [ "$os_type" == 'Ubuntu' ] || [ "$os_type" == 'Debian' ] ;then
@@ -317,7 +329,7 @@ fi
 rm -rf /usr/share/cockpit/apps /usr/share/cockpit/selinux /usr/share/cockpit/kdump /usr/share/cockpit/sosreport /usr/share/cockpit/packagekit
 
 # configure cockpit
-cp /data/apps/stackhub/cockpit/cockpit.conf /etc/cockpit/cockpit.conf
+cp /data/apps/websoft9/cockpit/cockpit.conf /etc/cockpit/cockpit.conf
 
 sudo systemctl daemon-reload
 sudo systemctl enable --now cockpit
@@ -377,9 +389,13 @@ echo "fast url is: "$fasturl
 # download apps
 mkdir -p /data/apps
 clone_repo $fasturl/Websoft9/docker-library /data/library
-clone_repo $fasturl/Websoft9/StackHub /data/apps/stackhub
-clone_repo $fasturl/Websoft9/stackhub-web /data/apps/stackhub-web
-cp -r /data/apps/stackhub/docker  /data/apps/w9services
+clone_repo $fasturl/Websoft9/websoft9 /data/apps/websoft9
+clone_repo $fasturl/Websoft9/plugin-appstore /data/apps/plugin-appstore
+clone_repo $fasturl/Websoft9/plugin-myapps /data/apps/plugin-myapps
+clone_repo $fasturl/Websoft9/plugin-portainer /data/apps/plugin-portainer
+clone_repo $fasturl/Websoft9/plugin-settings /data/apps/plugin-settings
+clone_repo $fasturl/Websoft9/plugin-nginx /data/apps/plugin-nginx
+cp -r /data/apps/websoft9/docker  /data/apps/w9services
 }
 
 StartAppMng(){
@@ -503,6 +519,5 @@ PrepareStaticFiles
 InstallCockpit
 StartAppMng
 StartPortainer
-#StartKopia
 InstallNginx
 EditMenu