提交 a83e26c94873ee738ae6c92b464f447a4150f58d

作者 nheweijun
1 个父辈 20db8f73

2022.01.24 修复io模块的图层大小写问题

... ... @@ -169,7 +169,7 @@ Include ports.conf
169 169
170 170 <Directory /var/www/>
171 171 Options Indexes FollowSymLinks
172   - AllowOverride None
  172 + AllowOverride All
173 173 Require all granted
174 174 </Directory>
175 175
... ... @@ -180,8 +180,6 @@ Include ports.conf
180 180 #</Directory>
181 181
182 182
183   -
184   -
185 183 # AccessFileName: The name of the file to look for in each directory
186 184 # for additional configuration directives. See also the AllowOverride
187 185 # directive.
... ... @@ -225,4 +223,6 @@ IncludeOptional conf-enabled/*.conf
225 223 IncludeOptional sites-enabled/*.conf
226 224
227 225 LoadModule wsgi_module "/usr/lib/apache2/modules/mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so"
228   -WSGIPythonHome "/usr"
\ No newline at end of file
  226 +WSGIPythonHome "/usr"
  227 +
  228 +LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
\ No newline at end of file
... ...
... ... @@ -16,11 +16,7 @@ from app.util.component.StructuredPrint import StructurePrint
16 16 from app.util.component.PGUtil import PGUtil
17 17 import os
18 18 from app.modules.monitor.schedule import start_schedule
19   -import datetime
20   -
21   -
22   -
23   -
  19 +import requests
24 20
25 21 class JSONEncoder(_JSONEncoder):
26 22 """
... ... @@ -100,11 +96,6 @@ def create_app():
100 96 # 不检测https
101 97 os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
102 98
103   -
104   - @app.before_first_request
105   - def init_data():
106   - pass
107   -
108 99 # start_schedule()
109 100 return app
110 101
... ... @@ -122,7 +113,6 @@ def create_schedule():
122 113
123 114 # swagger设置
124 115 swagger_config = Swagger.DEFAULT_CONFIG
125   - swagger_config.update(configure.swagger_configure)
126 116 Swagger(monitor, config=swagger_config)
127 117
128 118 # 创建数据库
... ... @@ -143,4 +133,5 @@ def create_schedule():
143 133 # 不检测https
144 134 os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
145 135 start_schedule()
  136 +
146 137 return monitor
... ...
... ... @@ -10,7 +10,6 @@ from app.util.component.PGUtil import PGUtil
10 10 import configure
11 11 from osgeo.ogr import DataSource
12 12 from flask import current_app
13   -from authlib.integrations.flask_oauth2 import current_token
14 13 from app.util.component.UserCheck import UserCheck
15 14
16 15
... ...
... ... @@ -9,7 +9,6 @@ from sqlalchemy import create_engine
9 9 import datetime
10 10 from . import database_alias_check
11 11 from app.util.component.ApiTemplate import ApiTemplate
12   -from authlib.integrations.flask_oauth2 import current_token
13 12 from app.util.component.UserCheck import UserCheck
14 13 from app.util.component.PGUtil import PGUtil
15 14 class Api(ApiTemplate):
... ...
... ... @@ -54,10 +54,7 @@ class Api(ApiTemplate):
54 54
55 55 # 提示信息
56 56 res["msg"] = "下载格式为shp时,属性名长度超过10个字符将截取为10个字符,binary类型的属性将改成integer类型且值为0。"
57   - # table_names = self.para.get("table_name").split(",")
58   - #
59   - # for tn in table_names:
60   - # table = Table.query.filter_by()
  57 +
61 58
62 59 res["msg"] = ""
63 60 res["result"] = True
... ...
... ... @@ -55,17 +55,19 @@ class Api(ApiTemplate):
55 55
56 56 for meta in meta_list:
57 57 layers:dict = meta.get("layer")
  58 +
58 59 for layer_name_origin in layers.keys():
  60 +
59 61 layer_name = layers.get(layer_name_origin)
60 62 if pg_ds.GetLayerByName(layer_name) or InsertingLayerName.query.filter_by(name=layer_name).one_or_none():
61   - res["data"][layer_name_origin]=0
  63 + res["data"][layer_name]=0
62 64 res["result"] = False
63 65 # 判断特殊字符
64 66 elif re.search(r"\W",layer_name):
65   - res["data"][layer_name_origin]=-1
  67 + res["data"][layer_name]=-1
66 68 res["result"] = False
67 69 else :
68   - res["data"][layer_name_origin] = 1
  70 + res["data"][layer_name] = 1
69 71
70 72 if pg_ds:
71 73 try:
... ...
... ... @@ -34,7 +34,7 @@ class Api(ApiTemplate):
34 34 store_path = ZipUtil.unzip(self.para.get("data_path"),True)
35 35 spatial_files = FileProcess.get_spatial_file(store_path)
36 36
37   - elif self.para.get("data_path").endswith("shp"):
  37 + elif self.para.get("data_path").endswith("shp"):
38 38 data_path=self.para.get("data_path")
39 39 encoding_cpg_path = data_path.split(".shp")[0]+".cpg"
40 40 if not os.path.exists(encoding_cpg_path):
... ... @@ -96,7 +96,8 @@ class Api(ApiTemplate):
96 96 if not ds:
97 97 raise Exception("打开数据失败!")
98 98 layer: Layer = ds.GetLayer(0)
99   - layer_name[layer.GetName().lower()] = layer.GetName().lower()
  99 +
  100 + layer_name[layer.GetName()] = layer.GetName()
100 101
101 102 if data_path.endswith("gdb"):
102 103 info["type"] = "gdb"
... ... @@ -106,7 +107,9 @@ class Api(ApiTemplate):
106 107 raise Exception("打开数据失败!")
107 108 for i in range(ds.GetLayerCount()):
108 109 layer: Layer = ds.GetLayer(i)
109   - layer_name[layer.GetName().lower()] = layer.GetName().lower()
  110 +
  111 + layer_name[layer.GetName()] = layer.GetName()
  112 +
110 113 except Exception as e :
111 114 print(traceback.format_exc())
112 115 info={}
... ...
... ... @@ -28,7 +28,6 @@ class EntryDataVacuate:
28 28 try:
29 29 metas: list = parameter.get("meta")
30 30
31   -
32 31 # 总的入库是否成功
33 32 is_success=True
34 33
... ... @@ -41,7 +40,7 @@ class EntryDataVacuate:
41 40 for meta in metas:
42 41 #设置编码
43 42 encoding = parameter.get("encoding")
44   - if encoding:
  43 + if encoding and encoding in ["GBK","gbk","UTF-8","utf-8"]:
45 44 gdal.SetConfigOption("SHAPE_ENCODING",encoding)
46 45 else:
47 46 gdal.SetConfigOption("SHAPE_ENCODING", "GBK")
... ... @@ -148,7 +147,7 @@ class EntryDataVacuate:
148 147 for i in range(ds.GetLayerCount()):
149 148
150 149 layer: Layer = ds.GetLayer(i)
151   - if layer.GetName().lower() not in meta.get("layer").keys():
  150 + if layer.GetName() not in meta.get("layer").keys():
152 151 continue
153 152 is_success, new_layer_name = self.entry_one_layer(layer,this_task,meta)
154 153 new_layer_names.append(new_layer_name)
... ... @@ -176,18 +175,19 @@ class EntryDataVacuate:
176 175 overwrite = parameter.get("overwrite") if parameter.get("overwrite") is not None and parameter.get("overwrite")=="yes" else "no"
177 176 geom_name = parameter.get("geom_name") if parameter.get("geom_name") is not None else "geom"
178 177 fid = parameter.get("fid") if parameter.get("fid") is not None else "fid"
179   - options = ["OVERWRITE={}".format(overwrite), "FID={}".format(fid), "GEOMETRY_NAME={}".format(geom_name),"PRECISION=NO"]
180 178
  179 + options = ["OVERWRITE={}".format(overwrite), "FID={}".format(fid), "GEOMETRY_NAME={}".format(geom_name),"PRECISION=NO","LAUNDER=NO"]
181 180
182 181 # 将线/面转多线多面
183 182 geom_type = GeometryAdapter.change_geom_type(layer.GetGeomType())
184 183
185 184 # 更改图层名
186 185 change_name = False
187   - origin_name = layer.GetName().lower()
  186 + origin_name = layer.GetName()
188 187
189 188 # 新图层名
190 189 new_layer_name: str = meta.get("layer").get(origin_name)
  190 +
191 191 origin_name = new_layer_name
192 192 no = 1
193 193 while overwrite.__eq__("no") and this_task.pg_ds.GetLayerByName(new_layer_name) :
... ... @@ -248,7 +248,7 @@ class EntryDataVacuate:
248 248 else:
249 249 is_vacuate = 0
250 250
251   - this_task.register_table(pg_layer,new_layer_name,overwrite,parameter.get("creator"),is_vacuate,table_guid)
  251 + this_task.register_table(pg_layer,parameter.get("creator"),is_vacuate,table_guid)
252 252
253 253 # 注册抽稀表
254 254 if vacuate:
... ... @@ -312,7 +312,7 @@ class ThisTask:
312 312 self.process_session.add(task_process)
313 313 self.process_session.commit()
314 314
315   - def register_table(self, layer: Layer, new_layer_name, overwrite, creator,is_vacuate,table_guid):
  315 + def register_table(self, layer: Layer,creator,is_vacuate,table_guid):
316 316 '''
317 317 注册表
318 318 :param layer: 图层
... ... @@ -335,7 +335,9 @@ class ThisTask:
335 335 table = Table(guid=table_guid,
336 336 database_guid=self.database.guid,
337 337 creator=creator,
338   - name=new_layer_name, create_time=this_time, update_time=this_time,
  338 + # name=new_layer_name,
  339 + name=layer.GetName(),
  340 + create_time=this_time, update_time=this_time,
339 341 catalog_guid=self.catalog_guid, table_type=GeometryAdapter.get_table_type(geom_type),
340 342 extent=extent,
341 343 feature_count=layer.GetFeatureCount(),
... ... @@ -343,10 +345,10 @@ class ThisTask:
343 345 )
344 346 # 删除遗留业务数据
345 347 try:
346   - history_table = self.sys_session.query(Table).filter_by(name=new_layer_name,database_guid=self.database.guid).all()
  348 + history_table = self.sys_session.query(Table).filter_by(name=layer.GetName(),database_guid=self.database.guid).all()
347 349 except:
348 350 self.sys_session: Session = PGUtil.get_db_session(configure.SQLALCHEMY_DATABASE_URI)
349   - history_table = self.sys_session.query(Table).filter_by(name=new_layer_name,database_guid=self.database.guid).all()
  351 + history_table = self.sys_session.query(Table).filter_by(name=layer.GetName(),database_guid=self.database.guid).all()
350 352
351 353 if history_table:
352 354 for ht in history_table:
... ... @@ -357,7 +359,7 @@ class ThisTask:
357 359
358 360 for i in range(feature_defn.GetFieldCount()):
359 361 field_defn: FieldDefn = feature_defn.GetFieldDefn(i)
360   - field_name = field_defn.GetName().lower()
  362 + field_name = field_defn.GetName()
361 363 field_alias = field_name if field_defn.GetAlternativeName() is None or field_defn.GetAlternativeName().__eq__(
362 364 "") else field_defn.GetAlternativeName()
363 365 column = Columns(guid=uuid.uuid1().__str__(), table_guid=table_guid,
... ...
... ... @@ -6,7 +6,6 @@ from ..models import Columns
6 6 import datetime
7 7 from app.models import db
8 8 from app.util.component.ApiTemplate import ApiTemplate
9   -from authlib.integrations.flask_oauth2 import current_token
10 9 from app.util.component.UserCheck import UserCheck
11 10
12 11 class Api(ApiTemplate):
... ...
... ... @@ -9,7 +9,6 @@ from app.util.component.ApiTemplate import ApiTemplate
9 9 from app.util.component.PGUtil import PGUtil
10 10 import configure
11 11 from flask import current_app
12   -from authlib.integrations.flask_oauth2 import current_token
13 12 from app.util.component.UserCheck import UserCheck
14 13
15 14 class Api(ApiTemplate):
... ...
... ... @@ -3,7 +3,7 @@
3 3 #email: nheweijun@sina.com
4 4
5 5 import traceback
6   -from ..models import Table,Database,Columns,db,TableVacuate,Task,Process,DES
  6 +from ..models import Table,Database,Columns,db,TableVacuate,Task,DES
7 7 from osgeo.ogr import DataSource,FeatureDefn,FieldDefn,Layer
8 8 import datetime
9 9 import uuid
... ... @@ -17,7 +17,6 @@ from app.util.component.TaskController import TaskController
17 17 from app.util.component.TaskWriter import TaskWriter
18 18 import multiprocessing
19 19 import configure
20   -from authlib.integrations.flask_oauth2 import current_token
21 20 from app.util.component.UserCheck import UserCheck
22 21 class Api(ApiTemplate):
23 22 api_name = "数据刷新"
... ...
... ... @@ -5,7 +5,7 @@
5 5
6 6 import datetime
7 7 import traceback
8   -from ..models import Table, Database, DES,Task,db,TableVacuate,Process
  8 +from ..models import Table, Database, DES,Task,db,TableVacuate
9 9 from app.util.component.ApiTemplate import ApiTemplate
10 10 from app.util.component.PGUtil import PGUtil
11 11 from app.util.component.StructuredPrint import StructurePrint
... ... @@ -14,7 +14,6 @@ import uuid
14 14 import configure
15 15 from osgeo.ogr import DataSource,Layer,Geometry
16 16 from osgeo import ogr
17   -from authlib.integrations.flask_oauth2 import current_token
18 17 from app.util.component.UserCheck import UserCheck
19 18 from app.util.component.VacuateConf import VacuateConf
20 19 from app.util.component.TaskController import TaskController
... ...
... ... @@ -10,6 +10,9 @@ from app.util.component.ApiTemplate import ApiTemplate
10 10 from app.util.component.PGUtil import PGUtil
11 11 import json
12 12 import decimal
  13 +
  14 +
  15 +
13 16 class Api(ApiTemplate):
14 17 api_name = "数据浏览"
15 18 def process(self):
... ... @@ -56,6 +59,8 @@ class Api(ApiTemplate):
56 59 d[column] = value.strftime('%Y-%m-%d %H:%M:%S')
57 60 elif isinstance(value, decimal.Decimal):
58 61 d[column] = float(value)
  62 + elif isinstance(value,datetime.date):
  63 + d[column] = value.strftime('%Y-%m-%d %H:%M:%S')
59 64 else:
60 65 d[column]=value
61 66 pkey_dict.update(d)
... ... @@ -66,7 +71,7 @@ class Api(ApiTemplate):
66 71 finally:
67 72 if db_session:
68 73 db_session.close()
69   - return json.dumps(res)
  74 + return json.dumps(res,ensure_ascii=False)
70 75
71 76 api_doc={
72 77 "tags":["管理接口"],
... ...
... ... @@ -5,7 +5,6 @@
5 5
6 6 from ..models import db,Task
7 7 from app.util.component.ApiTemplate import ApiTemplate
8   -from authlib.integrations.flask_oauth2 import current_token
9 8 from app.util.component.UserCheck import UserCheck
10 9
11 10 class Api(ApiTemplate):
... ...
... ... @@ -4,17 +4,15 @@
4 4 #email: nheweijun@sina.com
5 5
6 6 from ..models import db,Task,Table,InsertingLayerName,Process
7   -
8 7 from app.util.component.ApiTemplate import ApiTemplate
9 8 from app.util.component.StructuredPrint import StructurePrint
10 9 import os
11 10 import signal
12 11 import platform
13   -import json
14 12 import datetime
15 13 import uuid
16   -from authlib.integrations.flask_oauth2 import current_token
17 14 from app.util.component.UserCheck import UserCheck
  15 +
18 16 class Api(ApiTemplate):
19 17 api_name = "停止任务"
20 18 def para_check(self):
... ...
... ... @@ -12,8 +12,7 @@ from app.util.component.StructuredPrint import StructurePrint
12 12 class Api(ApiTemplate):
13 13
14 14 def process(self):
15   - StructurePrint().print("test")
16   - return {"Name":socket.gethostname(),"Type":"DMapDMS"}
  15 + return {"Name":socket.gethostname(),"Type":"DMapManager"}
17 16
18 17 api_doc={
19 18 "tags":["Index接口"],
... ...
... ... @@ -6,7 +6,6 @@
6 6
7 7 from app.util.component.ApiTemplate import ApiTemplate
8 8 import requests
9   -from authlib.integrations.flask_oauth2 import current_token
10 9 from app.util.component.UserCheck import UserCheck
11 10
12 11 class Api(ApiTemplate):
... ...
... ... @@ -6,7 +6,6 @@
6 6
7 7 from app.util.component.ApiTemplate import ApiTemplate
8 8 import requests
9   -from authlib.integrations.flask_oauth2 import current_token
10 9 from app.util.component.UserCheck import UserCheck
11 10
12 11 class Api(ApiTemplate):
... ...
... ... @@ -11,7 +11,6 @@ import requests
11 11 import configure
12 12 import json
13 13 import datetime
14   -from authlib.integrations.flask_oauth2 import current_token
15 14 from app.util.component.UserCheck import UserCheck
16 15
17 16 class Api(ApiTemplate):
... ...
... ... @@ -8,7 +8,6 @@ from app.models import db
8 8 from app.modules.service.models import Service
9 9 from app.modules.service.models import TileService
10 10 from app.modules.service.models import MapService
11   -from authlib.integrations.flask_oauth2 import current_token
12 11 from app.util.component.UserCheck import UserCheck
13 12
14 13 class Api(ApiTemplate):
... ...
... ... @@ -5,7 +5,7 @@
5 5
6 6 from app.util.component.ApiTemplate import ApiTemplate
7 7 from app.modules.service.models import Service
8   -import requests
  8 +
9 9
10 10
11 11 class Api(ApiTemplate):
... ...
... ... @@ -70,7 +70,7 @@ class Api(ApiTemplate):
70 70 else:
71 71 raw_json = response.json()["data"]["list"]
72 72 if state:
73   - raw_json = [ service for service in raw_json if service["state"] == state]
  73 + raw_json = [ service for service in raw_json if service["state"] == int(state)]
74 74 if type:
75 75 raw_json = [service for service in raw_json if service["type"] == type]
76 76 if catalog_guid:
... ...
... ... @@ -6,9 +6,7 @@
6 6
7 7 from app.util.component.ApiTemplate import ApiTemplate
8 8 from .models import TileService,db,Service,MapService
9   -import configure
10 9 from app.util.component.ModelVisitor import ModelVisitor
11   -
12 10 from .tile_service.util.ProjectFile import ProjectFile
13 11
14 12
... ...
... ... @@ -3,11 +3,11 @@
3 3 #createtime: 2021/9/14
4 4 #email: nheweijun@sina.com
5 5
6   -
7   -
8   -
  6 +from app.util.component.UserCheck import UserCheck
9 7 from app.util.component.ApiTemplate import ApiTemplate
10 8 from .models import Service,db
  9 +import requests
  10 +
11 11 class Api(ApiTemplate):
12 12 api_name = "修改服务状态"
13 13 def process(self):
... ... @@ -17,10 +17,10 @@ class Api(ApiTemplate):
17 17 state = int(self.para.get("state"))
18 18 s_type = self.para.get("type")
19 19
20   -
21   - #删除本地服务
22 20 if s_type in ["切片服务","地图服务","地址匹配"]:
23 21 service = Service.query.filter_by(guid=guid).one_or_none()
  22 + # 验证权限
  23 + UserCheck.verify(service.creator)
24 24
25 25 if service:
26 26 service.state = state
... ... @@ -30,10 +30,18 @@ class Api(ApiTemplate):
30 30 raise Exception("服务不存在!")
31 31 # 删除影像服务
32 32 else:
33   - from app.modules.service.image_service.image_service_edit import Api as RealApi
34   - api = RealApi()
35   - api.para = self.para
36   - res = api.process()
  33 + user_req: requests.Response = requests.post("{}/API/Service/Info".format(self.para.get("url")),
  34 + data={"guid": self.para.get("guid")})
  35 + if not user_req.json().get("result"):
  36 + raise Exception("服务不存在!")
  37 + # 验证权限
  38 + UserCheck.verify(user_req.json().get("data").get("service").get("creator"))
  39 +
  40 + url = "{}/API/Service/State".format(self.para.get("url"))
  41 + response: requests.Response = requests.post(url, data=self.para)
  42 + if not response.json().get("result"):
  43 + raise Exception("由于{},影像服务修改失败!".format(response.json().get("msg")))
  44 + res["result"] = True
37 45
38 46 except Exception as e:
39 47 raise e
... ...
... ... @@ -14,7 +14,6 @@ from .util.ProjectFile import ProjectFile
14 14 import json
15 15 from requests import Response
16 16 import configure
17   -from authlib.integrations.flask_oauth2 import current_token
18 17 from app.util.component.UserCheck import UserCheck
19 18
20 19 class Api(ApiTemplate):
... ... @@ -29,7 +28,7 @@ class Api(ApiTemplate):
29 28 if not service:
30 29 raise Exception("服务不存在!")
31 30 #验证权限
32   - UserCheck.verify(service.creator)
  31 + UserCheck.verify(service.one_or_none().creator)
33 32
34 33 this_time = datetime.datetime.now()
35 34
... ...
... ... @@ -5,7 +5,7 @@
5 5
6 6
7 7 from app.util.component.ApiTemplate import ApiTemplate
8   -from app.util.component.ModelVisitor import ModelVisitor
  8 +from app.util.component.StructuredPrint import StructurePrint
9 9 import uuid
10 10 from ..models import TileService,Service,db,ServiceFunction,TileScheme
11 11
... ... @@ -41,8 +41,12 @@ class Api(ApiTemplate):
41 41 resp: Response = requests.post(tile_service_register_url,data=json.dumps(para),
42 42 headers={'Content-Type':'application/json'},timeout=3
43 43 )
  44 +
44 45 resp.encoding="utf-8"
45 46 resp_json = resp.json()
  47 + StructurePrint().print(para)
  48 + StructurePrint().print(resp_json)
  49 +
46 50 if not resp_json["status"]=="1":
47 51 raise Exception("调用切片服务的注册服务接口失败!")
48 52
... ... @@ -105,7 +109,7 @@ class Api(ApiTemplate):
105 109 res["result"] = True
106 110 except Exception as e:
107 111 db.session.rollback()
108   - raise Exception("数据库错误!")
  112 + raise e
109 113 return res
110 114
111 115
... ...
... ... @@ -30,7 +30,7 @@ class ModelVisitor:
30 30 continue
31 31 if isinstance(value, datetime.datetime):
32 32 value = value.strftime('%Y-%m-%d %H:%M:%S')
33   - elif isinstance(value, datetime.time):
  33 + elif isinstance(value, datetime.time) or isinstance(value, datetime.date):
34 34 value = value.strftime('%H:%M:%S')
35 35 yield k,value
36 36 return dict(generator())
... ...
... ... @@ -3,7 +3,7 @@ import logging
3 3 # 程序部署ip:host
4 4 deploy_ip_host = "172.26.40.105:8840"
5 5 # 系统数据库
6   -SQLALCHEMY_DATABASE_URI = "postgresql://postgres:chinadci@172.26.60.100:5432/dmap_manager"
  6 +SQLALCHEMY_DATABASE_URI = "postgresql://postgres:chinadci@172.26.60.101:5432/dmap_manager"
7 7
8 8 # 指定精华表所在位置(必须为空间库),设置为None则存放在各自的实体库中
9 9 #VACUATE_DB_URI = None
... ...
  1 +#! /bin/sh
  2 +container_name="dmapmanager"
  3 +#停止容器
  4 +echo "正在关闭容器..."
  5 +docker stop $container_name
  6 +docker rm $container_name
  7 +
  8 +curPath=$(readlink -f $(dirname $0))
  9 +
  10 +
  11 +#设置日志权限
  12 +chmod -R 777 $curPath
  13 +
  14 +#设置端口
  15 +port=""
  16 +if [ ! -n "$1" ] ;then
  17 +
  18 +port1="8830"
  19 +echo "未设置端口1,使用默认8830端口..."
  20 +else
  21 +port1=$1
  22 +echo "端口1设置为$1 ..."
  23 +fi
  24 +
  25 +port2=""
  26 +if [ ! -n "$2" ] ;then
  27 +port2="8840"
  28 +echo "未设置端口2,使用默认8840端口..."
  29 +else
  30 +port2=$2
  31 +echo "端口2设置为$2 ..."
  32 +fi
  33 +
  34 +port3=""
  35 +if [ ! -n "$3" ] ;then
  36 +port3="8841"
  37 +echo "未设置端口3,使用默认8841端口..."
  38 +else
  39 +port3=$3
  40 +echo "端口3设置为$3 ..."
  41 +fi
  42 +
  43 +#启动容器
  44 +echo "正在启动容器..."
  45 +
  46 +set="--restart=always -e ALLOW_IP_RANGE=0.0.0.0/0 -p $port1:80 -p $port2:81 -p $port3:82"
  47 +codeMap="-v ${curPath}:/usr/src/app -v ${curPath}/html:/var/www/html"
  48 +apacheMap="-v ${curPath}/apache2.conf:/etc/apache2/apache2.conf -v ${curPath}/dmapmanager.conf:/etc/apache2/sites-enabled/dmapmanager.conf -v ${curPath}/envvars:/etc/apache2/envvars"
  49 +
  50 +docker run -it -d --name ${container_name} ${set} ${codeMap} ${apacheMap} dci/dmapmanager:4.1
  51 +sleep 5
  52 +curl localhost:$port2/release
  53 +curl localhost:$port3
... ...
... ... @@ -34,7 +34,7 @@ fi
34 34 #启动容器和apache
35 35 echo "正在启动容器..."
36 36 set="--privileged=true -e TZ="Asia/Shanghai" --restart=always -e ALLOW_IP_RANGE=0.0.0.0/0 -e LAND=C.UTF-8"
37   -docker run -it -d --name ${container_name} ${set} -p ${port}:80 -p ${port2}:81 -v ${curPath}:/usr/src/app -v ${curPath}/apache2.conf:/etc/apache2/apache2.conf -v ${curPath}/dmapmanager.conf:/etc/apache2/sites-enabled/dmapmanager.conf -v ${curPath}/envvars:/etc/apache2/envvars dci/dmapserver:build
  37 +docker run -it -d --name ${container_name} ${set} -p ${port}:81 -p ${port2}:82 -v ${curPath}:/usr/src/app -v ${curPath}/apache2.conf:/etc/apache2/apache2.conf -v ${curPath}/dmapmanager.conf:/etc/apache2/sites-enabled/dmapmanager.conf -v ${curPath}/envvars:/etc/apache2/envvars dci/dmapserver:build
38 38 docker exec -d $container_name service apache2 start
39 39 sleep 5
40 40 curl localhost:$port/release
... ...
注册登录 后发表评论