root 2 years ago
parent
commit
0249d1bd36
7 changed files with 91 additions and 69 deletions
  1. 32 10
      deploy.sh
  2. 0 0
      deploy_server
  3. 3 3
      edge/docker-compose.yaml
  4. 0 0
      edge/edgeframe-server/config.docker.yaml
  5. 25 25
      edge/nginx/my.conf
  6. 31 31
      edge/nginx/nginx.conf
  7. BIN
      yum/edge.zip

+ 32 - 10
deploy.sh

@@ -3,22 +3,44 @@
 # 指定目录
 export directory="$PWD"
 
+echo $directory
 
-export APP_PATH= "$directory"/php/app/
+ 
 
 
-export docker_compose_dir="$directory"/edge/
+export docker_compose_dir="$directory/edge/"
 
-APP_PATH_escaped_dir=$(echo "$APP_PATH" | sed 's/\//\\\//g')
-docker_compose_escaped_dir=$(echo "$docker_compose_dir" | sed 's/\//\\\//g')
-
-# 切换到目录
-cd "$directory"/edge || exit 1
 
+if [ -d "$directory/php/app/" ]; then
+    echo "目录存在"
+else
+    echo "目录不存在"
+    mkdir -p "$directory/php/app/"
+fi
 
-# 替换.env中的admin = master为admin = ADMIN_HOST
+export APP_PATH= "$directory/php/app/"
 
-sed -i "s/${APP_DIR}/{$APP_PATH_escaped_dir}/g" .env
-sed -i "s/${docker_compose_dir}/{$docker_compose_escaped_dir}/g" .env
+# 切换到目录
+cd "$directory/edge" || exit 1
+ls -l
+
+
+# export envPath=.env
+# if [ -e "$envPath" ]; then
+#     echo "文件已存在"
+# else
+#     echo "文件不存在,创建文件..."
+ 
+# env_file=".env"
+# echo $APP_PATH
+# # 创建 .env 文件并写入内容
+# echo "APP_DIR=\"$APP_PATH\"  # 源码目录" > "$env_file"
+# echo "docker_compose_dir=\"$docker_compose_dir\"" >> "$env_file"
+#     echo "文件已创建"
+# fi
+# # 替换.env中的admin = master为admin = ADMIN_HOST
+
+ 
+ 
 #启动服务
 docker run -d -v /var/run/docker.sock:/var/run/docker.sock -v "$directory"/edge:/www/docker/edge --name edge-upgrade-service registry.cn-hangzhou.aliyuncs.com/minong/edge-upgrade-service:v22

+ 0 - 0
deploy_server


+ 3 - 3
edge/docker-compose.yaml

@@ -29,9 +29,9 @@ services:
     restart: always
     volumes:
       #   - /www/script/script.sh:/script.sh
-      - /www/wwwroot/git-test2:/var/www/html
+      - ${APP_DIR}:/var/www/html
     environment:
-      ADMIN_HOST: "edge6"
+      ADMIN_HOST: "20.0.14.29"
       RemoteURL: "ssh://git@git.7in6.com:11022/wuwenqiang/fastadmin-edge.git"
     #   DIR: "/var/www/html"
     depends_on:
@@ -131,7 +131,7 @@ services:
       network:
         ipv4_address: 177.2.0.5
   mongodb:
-    image: mongo:latest # 虚拟机中用mongo:4.4.0,实体机中用 mongo:latest
+    image: mongo:4.4.0 # 虚拟机中用mongo:4.4.0,实体机中用 mongo:latest
     ports:
       - "27017:27017"
     volumes:

+ 0 - 0
edge/edgeframe-server/config.docker.yaml


+ 25 - 25
edge/nginx/my.conf

@@ -1,26 +1,26 @@
-server {
-    listen       8080;
-    server_name localhost;
-
-    #charset koi8-r;
-    #access_log  logs/host.access.log  main;
-
-    location / {
-        root /usr/share/nginx/html;
-        add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
-        try_files $uri $uri/ /index.html;
-    }
-
-    location /api {
-        proxy_set_header Host $http_host;
-        proxy_set_header  X-Real-IP $remote_addr;
-        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-        proxy_set_header X-Forwarded-Proto $scheme;
-        rewrite ^/api/(.*)$ /$1 break;  #重写
-        proxy_pass http://local-sync-server:8888; # 设置代理服务器的协议和地址
-     }
-
-    location /api/swagger/index.html {
-        proxy_pass http://local-sync-server:8888/swagger/index.html;
-     }
+server {
+    listen       8080;
+    server_name localhost;
+
+    #charset koi8-r;
+    #access_log  logs/host.access.log  main;
+
+    location / {
+        root /usr/share/nginx/html;
+        add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
+        try_files $uri $uri/ /index.html;
+    }
+
+    location /api {
+        proxy_set_header Host $http_host;
+        proxy_set_header  X-Real-IP $remote_addr;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+        proxy_set_header X-Forwarded-Proto $scheme;
+        rewrite ^/api/(.*)$ /$1 break;  #重写
+        proxy_pass http://local-sync-server:8888; # 设置代理服务器的协议和地址
+     }
+
+    location /api/swagger/index.html {
+        proxy_pass http://local-sync-server:8888/swagger/index.html;
+     }
  }

+ 31 - 31
edge/nginx/nginx.conf

@@ -1,31 +1,31 @@
-server {
-    listen 80;
-
-    index index.php;
-    server_name localhost;
-    root /var/www/html/public;
-
-    location / {
-        # try_files $uri $uri/ /index.php?$query_string;
-    	if (!-e $request_filename){
-    # 		rewrite  ^(.*)$  /FTjJZpQbzx.php?s=$1  last;   break;
-            rewrite  ^(.*)$  /index.php?s=$1  last;   break;
-    	}
-    }
-
-    location ~ \.php$ {
-        fastcgi_pass php74:9000;
-        fastcgi_index index.php;
-        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-        include fastcgi_params;
-    }
-    
-    location /sync-api {
-             proxy_set_header Host $http_host;
-             proxy_set_header  X-Real-IP $remote_addr;
-             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-             proxy_set_header X-Forwarded-Proto $scheme;
-             rewrite ^/sync-api/(.*)$ /$1 break;  #重写
-             proxy_pass http://local-sync-server:8888; # 设置代理服务器的协议和地址
-    }
-}
+server {
+    listen 80;
+
+    index index.php;
+    server_name localhost;
+    root /var/www/html/public;
+
+    location / {
+        # try_files $uri $uri/ /index.php?$query_string;
+    	if (!-e $request_filename){
+    # 		rewrite  ^(.*)$  /FTjJZpQbzx.php?s=$1  last;   break;
+            rewrite  ^(.*)$  /index.php?s=$1  last;   break;
+    	}
+    }
+
+    location ~ \.php$ {
+        fastcgi_pass php74:9000;
+        fastcgi_index index.php;
+        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+        include fastcgi_params;
+    }
+    
+    location /sync-api {
+             proxy_set_header Host $http_host;
+             proxy_set_header  X-Real-IP $remote_addr;
+             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+             proxy_set_header X-Forwarded-Proto $scheme;
+             rewrite ^/sync-api/(.*)$ /$1 break;  #重写
+             proxy_pass http://local-sync-server:8888; # 设置代理服务器的协议和地址
+    }
+}

BIN
yum/edge.zip