提交 038789ae9c330eb13df3724aec545c81e6a2257e
Merge branch 'master' of http://gitlab.ctune.cn/weijunh/DMapManager
正在显示
21 个修改的文件
包含
247 行增加
和
544 行删除
... | ... | @@ -11,6 +11,7 @@ from . import task_detail |
11 | 11 | from . import task_delete |
12 | 12 | from . import task_count |
13 | 13 | from . import task_kill |
14 | +from . import task_update | |
14 | 15 | from app.decorators.token_decorator import token_decorator |
15 | 16 | |
16 | 17 | |
... | ... | @@ -64,3 +65,13 @@ class DataManager(BlueprintApi): |
64 | 65 | 任务统计 |
65 | 66 | """ |
66 | 67 | return task_count.Api().result |
68 | + | |
69 | + | |
70 | + @staticmethod | |
71 | + @bp.route('/Update', methods=['POST']) | |
72 | + @swag_from(task_update.Api.api_doc) | |
73 | + def task_update(): | |
74 | + """ | |
75 | + 任务信息更新 | |
76 | + """ | |
77 | + return task_update.Api().result | |
\ No newline at end of file | ... | ... |
app/modules/data/task/task_update.py
0 → 100644
1 | +# coding=utf-8 | |
2 | +#author: 4N | |
3 | +#createtime: 2020/9/4 | |
4 | +#email: nheweijun@sina.com | |
5 | + | |
6 | +from ..models import db,Task,Process | |
7 | +from app.util.component.ApiTemplate import ApiTemplate | |
8 | +import datetime | |
9 | +import json | |
10 | +import uuid | |
11 | +class Api(ApiTemplate): | |
12 | + api_name = "任务更新" | |
13 | + def para_check(self): | |
14 | + if not self.para.get("task_guid"): | |
15 | + raise Exception("缺乏task_guid参数。") | |
16 | + | |
17 | + def process(self): | |
18 | + | |
19 | + res = {} | |
20 | + try: | |
21 | + task_guid = self.para.get("task_guid") | |
22 | + msg = self.para.get("msg") | |
23 | + task:Task = Task.query.filter_by(guid=task_guid) | |
24 | + task.update(json.loads(self.para.get("update"))) | |
25 | + | |
26 | + if msg: | |
27 | + message = "{} {}".format(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), msg) | |
28 | + task_process_guid = uuid.uuid1().__str__() | |
29 | + task_process = Process(guid=task_process_guid, message=message, time=datetime.datetime.now(), | |
30 | + task_guid=task_guid) | |
31 | + db.session.add(task_process) | |
32 | + db.session.commit() | |
33 | + except Exception as e: | |
34 | + raise e | |
35 | + return res | |
36 | + | |
37 | + api_doc={ | |
38 | + "tags":["任务接口"], | |
39 | + "parameters":[ | |
40 | + {"name": "task_guid", | |
41 | + "in": "formData", | |
42 | + "type": "string"}, | |
43 | + {"name": "update", | |
44 | + "in": "formData", | |
45 | + "type": "string"}, | |
46 | + {"name": "msg", | |
47 | + "in": "formData", | |
48 | + "type": "string"}, | |
49 | + | |
50 | + ], | |
51 | + "responses":{ | |
52 | + 200:{ | |
53 | + "schema":{ | |
54 | + "properties":{ | |
55 | + } | |
56 | + } | |
57 | + } | |
58 | + } | |
59 | + } | |
\ No newline at end of file | ... | ... |
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | |
6 | 6 | |
7 | 7 | from ..models import ServiceCatalog,db,Service,ServiceEngine |
8 | - | |
8 | +from app.util.component.StructurePrint import StructurePrint | |
9 | 9 | from app.util.component.ApiTemplate import ApiTemplate |
10 | 10 | from app.util.component.ModelVisitor import ModelVisitor |
11 | 11 | import requests |
... | ... | @@ -25,12 +25,15 @@ class Api(ApiTemplate): |
25 | 25 | image_engines = ServiceEngine.query.filter_by(type="ImageServer").all() |
26 | 26 | image_services = [] |
27 | 27 | for ie in image_engines: |
28 | - url = "{}/API/Service/List".format(ie.url) | |
29 | - response:requests.Response = requests.post(url,{"page_size":1000}) | |
30 | - if not response.json().get("result"): | |
31 | - raise Exception("获取影像服务List失败!") | |
32 | - else: | |
33 | - image_services.extend(response.json()["data"]["list"]) | |
28 | + try: | |
29 | + url = "{}/API/Service/List".format(ie.url) | |
30 | + response:requests.Response = requests.post(url,{"page_size":1000}) | |
31 | + if not response.json().get("result"): | |
32 | + raise Exception("获取影像服务List失败!") | |
33 | + else: | |
34 | + image_services.extend(response.json()["data"]["list"]) | |
35 | + except: | |
36 | + StructurePrint().print("{}访问失败".format(ie.url)) | |
34 | 37 | |
35 | 38 | for cata in catalogs: |
36 | 39 | catalog_guids = [c.guid for c in ServiceCatalog.query.filter(ServiceCatalog.path.like("%" + cata.guid + "%")).all()] | ... | ... |
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | from ..models import ServiceCatalog,Service,ServiceEngine |
8 | 8 | from app.util.component.ApiTemplate import ApiTemplate |
9 | 9 | import requests |
10 | - | |
10 | +from app.util.component.StructurePrint import StructurePrint | |
11 | 11 | class Api(ApiTemplate): |
12 | 12 | api_name = "目录树" |
13 | 13 | def process(self): |
... | ... | @@ -24,13 +24,15 @@ class Api(ApiTemplate): |
24 | 24 | image_engines = ServiceEngine.query.filter_by(type="ImageServer").all() |
25 | 25 | image_services = [] |
26 | 26 | for ie in image_engines: |
27 | - url = "{}/API/Service/List".format(ie.url) | |
28 | - response:requests.Response = requests.post(url,{"page_size":1000}) | |
29 | - if not response.json().get("result"): | |
30 | - raise Exception("获取影像服务List失败!") | |
31 | - else: | |
32 | - image_services.extend(response.json()["data"]["list"]) | |
33 | - | |
27 | + try: | |
28 | + url = "{}/API/Service/List".format(ie.url) | |
29 | + response:requests.Response = requests.post(url,{"page_size":1000}) | |
30 | + if not response.json().get("result"): | |
31 | + raise Exception("获取影像服务List失败!") | |
32 | + else: | |
33 | + image_services.extend(response.json()["data"]["list"]) | |
34 | + except: | |
35 | + StructurePrint().print("{}访问失败".format(ie.url)) | |
34 | 36 | tree_origin = [] |
35 | 37 | for cata in catalogs: |
36 | 38 | ... | ... |
... | ... | @@ -8,6 +8,7 @@ from ..models import Service,ServiceCatalog,db,ServiceEngine |
8 | 8 | import requests |
9 | 9 | |
10 | 10 | from app.util.component.ApiTemplate import ApiTemplate |
11 | +from app.util.component.StructurePrint import StructurePrint | |
11 | 12 | class Api(ApiTemplate): |
12 | 13 | api_name = "目录" |
13 | 14 | def process(self): |
... | ... | @@ -24,12 +25,15 @@ class Api(ApiTemplate): |
24 | 25 | image_engines = ServiceEngine.query.filter_by(type="ImageServer").all() |
25 | 26 | image_services = [] |
26 | 27 | for ie in image_engines: |
27 | - url = "{}/API/Service/List".format(ie.url) | |
28 | - response:requests.Response = requests.post(url,{"page_size":1000}) | |
29 | - if not response.json().get("result"): | |
30 | - raise Exception("获取影像服务List失败!") | |
31 | - else: | |
32 | - image_services.extend(response.json()["data"]["list"]) | |
28 | + try: | |
29 | + url = "{}/API/Service/List".format(ie.url) | |
30 | + response:requests.Response = requests.post(url,{"page_size":1000}) | |
31 | + if not response.json().get("result"): | |
32 | + raise Exception("获取影像服务List失败!") | |
33 | + else: | |
34 | + image_services.extend(response.json()["data"]["list"]) | |
35 | + except: | |
36 | + StructurePrint().print("{}访问失败".format(ie.url)) | |
33 | 37 | |
34 | 38 | for cata in catalogs: |
35 | 39 | catalog_guids = [c.guid for c in ServiceCatalog.query.filter(ServiceCatalog.path.like("%" + cata.guid + "%")).all()] | ... | ... |
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | #createtime: 2021/7/19 |
4 | 4 | #email: nheweijun@sina.com |
5 | 5 | |
6 | - | |
6 | +import configure | |
7 | 7 | from app.util.component.ApiTemplate import ApiTemplate |
8 | 8 | from app.util.component.StructurePrint import StructurePrint |
9 | 9 | from app.models import db |
... | ... | @@ -14,6 +14,7 @@ import datetime |
14 | 14 | import requests |
15 | 15 | from app.util.component.TaskController import TaskController |
16 | 16 | from app.util.component.TaskWriter import TaskWriter |
17 | + | |
17 | 18 | class Api(ApiTemplate): |
18 | 19 | |
19 | 20 | api_name = "创建影像金字塔" |
... | ... | @@ -29,14 +30,15 @@ class Api(ApiTemplate): |
29 | 30 | pyramid_process = multiprocessing.Process(target=self.task, args=(task_guid,self.para)) |
30 | 31 | pyramid_process.start() |
31 | 32 | |
33 | + | |
34 | + | |
32 | 35 | task = Task(guid=task_guid, |
33 | 36 | name="{}构建影像金字塔".format(self.para.get("alias")), |
34 | 37 | create_time=datetime.datetime.now(), |
35 | 38 | state=0, |
36 | 39 | task_type=5, |
37 | 40 | creator=self.para.get("creator"), |
38 | - process="影像创建金字塔中", | |
39 | - task_pid=pyramid_process.pid) | |
41 | + process="影像创建金字塔中") | |
40 | 42 | |
41 | 43 | db.session.add(task) |
42 | 44 | db.session.commit() |
... | ... | @@ -61,18 +63,21 @@ class Api(ApiTemplate): |
61 | 63 | task_writer.update_task({"state":2,"update_time":datetime.datetime.now(),"process" : "创建中"}) |
62 | 64 | task_writer.update_process("开始创建...") |
63 | 65 | |
64 | - url = "{}/API/Service/Image/BuildPyramid".format(para.get("url")) | |
65 | - response:requests.Response = requests.post(url,data=self.para) | |
66 | + url = "{}/API/Image/BuildPyramid".format(para.get("url")) | |
67 | + StructurePrint().print(url) | |
66 | 68 | |
67 | - if not response.json().get("result"): | |
68 | - raise Exception("由于{},影像服务修改失败!".format(response.json().get("msg"))) | |
69 | + self.para["from"] = configure.deploy_ip_host | |
70 | + self.para["task_guid"] = task_guid | |
69 | 71 | |
70 | - task_writer.update_task({"state":1,"update_time":datetime.datetime.now(),"process" : "创建完成"}) | |
71 | - task_writer.update_process("创建完成!") | |
72 | + response:requests.Response = requests.post(url,data=self.para) | |
72 | 73 | |
74 | + if not response.json().get("result"): | |
75 | + raise Exception("由于{},提交任务失败!".format(response.json().get("msg"))) | |
76 | + else: | |
77 | + task_writer.update_task({"task_pid": int(response.json().get("data"))}) | |
73 | 78 | except Exception as e: |
74 | 79 | try: |
75 | - task_writer.update_task({"state": -1,"update_time":datetime.datetime.now(),"process": "下载失败"}) | |
80 | + task_writer.update_task({"state": -1,"update_time":datetime.datetime.now(),"process": "创建失败"}) | |
76 | 81 | task_writer.update_process( e.__str__()) |
77 | 82 | task_writer.update_process("任务中止!") |
78 | 83 | except Exception as ee: |
... | ... | @@ -84,7 +89,6 @@ class Api(ApiTemplate): |
84 | 89 | except Exception as e: |
85 | 90 | StructurePrint().print(e.__str__()) |
86 | 91 | |
87 | - | |
88 | 92 | api_doc = { |
89 | 93 | "tags": ["影像服务接口"], |
90 | 94 | "parameters": [ | ... | ... |
1 | +# coding=utf-8 | |
2 | +#author: 4N | |
3 | +#createtime: 2021/7/19 | |
4 | +#email: nheweijun@sina.com | |
5 | + | |
6 | +import configure | |
7 | +from app.util.component.ApiTemplate import ApiTemplate | |
8 | +from app.util.component.StructurePrint import StructurePrint | |
9 | +from app.models import db | |
10 | +from app.modules.data.models import Task | |
11 | +import multiprocessing | |
12 | +import uuid | |
13 | +import datetime | |
14 | +import requests | |
15 | +from app.util.component.TaskController import TaskController | |
16 | +from app.util.component.TaskWriter import TaskWriter | |
17 | +class Api(ApiTemplate): | |
18 | + | |
19 | + api_name = "创建影像金字塔" | |
20 | + | |
21 | + def process(self): | |
22 | + | |
23 | + # 返回结果 | |
24 | + res = {} | |
25 | + try: | |
26 | + task_guid = uuid.uuid1().__str__() | |
27 | + | |
28 | + | |
29 | + pyramid_process = multiprocessing.Process(target=self.task, args=(task_guid,self.para)) | |
30 | + pyramid_process.start() | |
31 | + | |
32 | + task = Task(guid=task_guid, | |
33 | + name="{}构建影像金字塔".format(self.para.get("alias")), | |
34 | + create_time=datetime.datetime.now(), | |
35 | + state=0, | |
36 | + task_type=5, | |
37 | + creator=self.para.get("creator"), | |
38 | + process="影像创建金字塔中", | |
39 | + task_pid=pyramid_process.pid) | |
40 | + | |
41 | + db.session.add(task) | |
42 | + db.session.commit() | |
43 | + | |
44 | + res["data"] = "创建影像金字塔任务已提交!" | |
45 | + res["result"] = True | |
46 | + | |
47 | + except Exception as e: | |
48 | + raise Exception("数据库错误!") | |
49 | + | |
50 | + return res | |
51 | + | |
52 | + | |
53 | + def task(self,task_guid,para): | |
54 | + task_writer = None | |
55 | + try: | |
56 | + | |
57 | + #任务控制,等待执行 | |
58 | + TaskController.wait(task_guid) | |
59 | + task_writer = TaskWriter(task_guid) | |
60 | + | |
61 | + task_writer.update_task({"state":2,"update_time":datetime.datetime.now(),"process" : "创建中"}) | |
62 | + task_writer.update_process("开始创建...") | |
63 | + | |
64 | + url = "{}/API/Service/Image/BuildPyramid".format(para.get("url")) | |
65 | + | |
66 | + # s = requests.session() | |
67 | + # s.keep_alive = True | |
68 | + # s.post() | |
69 | + | |
70 | + self.para["from"] = configure.deploy_ip_host | |
71 | + | |
72 | + response:requests.Response = requests.post(url,data=self.para) | |
73 | + | |
74 | + if not response.json().get("result"): | |
75 | + raise Exception("由于{},影像服务修改失败!".format(response.json().get("msg"))) | |
76 | + | |
77 | + task_writer.update_task({"state":1,"update_time":datetime.datetime.now(),"process" : "创建完成"}) | |
78 | + task_writer.update_process("创建完成!") | |
79 | + | |
80 | + except Exception as e: | |
81 | + try: | |
82 | + task_writer.update_task({"state": -1,"update_time":datetime.datetime.now(),"process": "创建失败"}) | |
83 | + task_writer.update_process(e.__str__()) | |
84 | + task_writer.update_process("任务中止!") | |
85 | + except Exception as ee: | |
86 | + StructurePrint().print(ee.__str__()) | |
87 | + raise e | |
88 | + finally: | |
89 | + try: | |
90 | + task_writer.close() | |
91 | + except Exception as e: | |
92 | + StructurePrint().print(e.__str__()) | |
93 | + | |
94 | + | |
95 | + api_doc = { | |
96 | + "tags": ["影像服务接口"], | |
97 | + "parameters": [ | |
98 | + {"name": "guid", | |
99 | + "in": "formData", | |
100 | + "type": "string", | |
101 | + "description": "guid"}, | |
102 | + {"name": "url", | |
103 | + "in": "formData", | |
104 | + "type": "string", | |
105 | + "description": "url"}, | |
106 | + {"name": "alias", | |
107 | + "in": "formData", | |
108 | + "type": "string", | |
109 | + "description": "影像alias"}, | |
110 | + ], | |
111 | + "responses": { | |
112 | + 200: { | |
113 | + "schema": { | |
114 | + "properties": { | |
115 | + } | |
116 | + } | |
117 | + } | |
118 | + } | |
119 | + } | |
120 | + | ... | ... |
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | |
6 | 6 | |
7 | 7 | from app.util.component.ApiTemplate import ApiTemplate |
8 | +from app.util.component.StructurePrint import StructurePrint | |
8 | 9 | import requests |
9 | 10 | from app.util.component.UserCheck import UserCheck |
10 | 11 | |
... | ... | @@ -19,6 +20,7 @@ class Api(ApiTemplate): |
19 | 20 | |
20 | 21 | user_req: requests.Response = requests.post("{}/API/Service/Info".format(self.para.get("url")), |
21 | 22 | data={"guid":self.para.get("guid")}) |
23 | + | |
22 | 24 | if not user_req.json().get("result"): |
23 | 25 | raise Exception("服务不存在!") |
24 | 26 | # 验证权限 |
... | ... | @@ -26,6 +28,7 @@ class Api(ApiTemplate): |
26 | 28 | |
27 | 29 | url = "{}/API/Service/Delete".format(self.para.get("url")) |
28 | 30 | response:requests.Response = requests.post(url,data=self.para) |
31 | + | |
29 | 32 | if not response.json().get("result"): |
30 | 33 | raise Exception("由于{},影像地图删除失败!".format(response.json().get("msg"))) |
31 | 34 | res["result"] = True | ... | ... |
... | ... | @@ -49,7 +49,7 @@ class Api(ApiTemplate): |
49 | 49 | "capabilities":2, |
50 | 50 | "project":self.para.get("project")} |
51 | 51 | |
52 | - map_service_register_url = "{}/dmap/api/manager/regservice".format(configure.vector_engine) | |
52 | + map_service_register_url = "{}/dmap/api/manager/regservice".format(configure.dmap_engine) | |
53 | 53 | resp: requests.Response = requests.post(map_service_register_url,data=json.dumps(para), |
54 | 54 | headers={'Content-Type':'application/json'},timeout=3 |
55 | 55 | ) | ... | ... |
... | ... | @@ -34,7 +34,7 @@ class Api(ApiTemplate): |
34 | 34 | "capabilities":2, |
35 | 35 | "project":self.para.get("project")} |
36 | 36 | |
37 | - map_service_register_url = "{}/dmap/api/manager/regservice".format(configure.vector_engine) | |
37 | + map_service_register_url = "{}/dmap/api/manager/regservice".format(configure.dmap_engine) | |
38 | 38 | resp: requests.Response = requests.post(map_service_register_url,data=json.dumps(para), |
39 | 39 | headers={'Content-Type':'application/json'},timeout=3 |
40 | 40 | ) | ... | ... |
... | ... | @@ -35,13 +35,7 @@ class Api(ApiTemplate): |
35 | 35 | map_services = MapService.query.all() |
36 | 36 | for ms in map_services: |
37 | 37 | para = ModelVisitor.object_to_json(ms) |
38 | - para[""] | |
39 | - | |
40 | 38 | res["data"]["list"].append(para) |
41 | - | |
42 | - | |
43 | - | |
44 | - | |
45 | 39 | res["data"]["count"] = len(tile_services)+len(map_services) |
46 | 40 | res["result"] = True |
47 | 41 | except Exception as e: | ... | ... |
... | ... | @@ -60,7 +60,7 @@ class Api(ApiTemplate): |
60 | 60 | "type":"tileserver","capabilities":1 if tile_type == "WMTS" else 16,"project":project_file} |
61 | 61 | |
62 | 62 | |
63 | - tile_service_edit_url = "{}/dmap/api/manager/RegService".format(configure.tile_engine) | |
63 | + tile_service_edit_url = "{}/dmap/api/manager/RegService".format(configure.dmap_engine) | |
64 | 64 | |
65 | 65 | resp: Response = requests.post(tile_service_edit_url,data=json.dumps(para),headers={'Content-Type':'application/json'},timeout=3) |
66 | 66 | resp.encoding="utf-8" | ... | ... |
... | ... | @@ -37,7 +37,7 @@ class Api(ApiTemplate): |
37 | 37 | "capabilities":1 if self.para.get("tile_type") == "WMTS" else 16, |
38 | 38 | "project":project_file} |
39 | 39 | |
40 | - tile_service_register_url = "{}/dmap/api/manager/RegService".format(configure.tile_engine) | |
40 | + tile_service_register_url = "{}/dmap/api/manager/RegService".format(configure.dmap_engine) | |
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 | ) |
... | ... | @@ -93,7 +93,7 @@ class Api(ApiTemplate): |
93 | 93 | |
94 | 94 | scheme=self.para.get("scheme"), |
95 | 95 | service_guid = service_guid, |
96 | - metadata_url = "{}/DMap/Services/{}/MapServer/WMTSServer".format(configure.tile_engine,self.para.get("name")) | |
96 | + metadata_url = "{}/DMap/Services/{}/MapServer/WMTSServer".format(configure.dmap_engine,self.para.get("name")) | |
97 | 97 | ) |
98 | 98 | |
99 | 99 | service_function = ServiceFunction(guid=service_function_guid, | ... | ... |
... | ... | @@ -10,10 +10,8 @@ SQLALCHEMY_DATABASE_URI = "postgresql://postgres:chinadci@172.26.60.101:5432/dma |
10 | 10 | #VACUATE_DB_URI = None |
11 | 11 | VACUATE_DB_URI = SQLALCHEMY_DATABASE_URI |
12 | 12 | |
13 | -#切片引擎 | |
14 | -tile_engine = "http://172.26.99.160:8820" | |
15 | -#矢量引擎 | |
16 | -vector_engine = "http://172.26.99.160:8820" | |
13 | +#DMap引擎 | |
14 | +dmap_engine = "http://172.26.99.160:8820" | |
17 | 15 | |
18 | 16 | # 固定配置不需要修改 |
19 | 17 | ... | ... |
gun_conf.py
deleted
100644 → 0
httpd.conf
deleted
100644 → 0
1 | -# | |
2 | -# This is the main Apache HTTP server configuration file. It contains the | |
3 | -# configuration directives that give the server its instructions. | |
4 | -# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. | |
5 | -# In particular, see | |
6 | -# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> | |
7 | -# for a discussion of each configuration directive. | |
8 | -# | |
9 | -# Do NOT simply read the instructions in here without understanding | |
10 | -# what they do. They're here only as hints or reminders. If you are unsure | |
11 | -# consult the online docs. You have been warned. | |
12 | -# | |
13 | -# Configuration and logfile names: If the filenames you specify for many | |
14 | -# of the server's control files begin with "/" (or "drive:/" for Win32), the | |
15 | -# server will use that explicit path. If the filenames do *not* begin | |
16 | -# with "/", the value of ServerRoot is prepended -- so 'log/access_log' | |
17 | -# with ServerRoot set to '/www' will be interpreted by the | |
18 | -# server as '/www/log/access_log', where as '/log/access_log' will be | |
19 | -# interpreted as '/log/access_log'. | |
20 | - | |
21 | -# | |
22 | -# ServerRoot: The top of the directory tree under which the server's | |
23 | -# configuration, error, and log files are kept. | |
24 | -# | |
25 | -# Do not add a slash at the end of the directory path. If you point | |
26 | -# ServerRoot at a non-local disk, be sure to specify a local disk on the | |
27 | -# Mutex directive, if file-based mutexes are used. If you wish to share the | |
28 | -# same ServerRoot for multiple httpd daemons, you will need to change at | |
29 | -# least PidFile. | |
30 | -# | |
31 | -ServerRoot "/etc/httpd" | |
32 | - | |
33 | -# | |
34 | -# Listen: Allows you to bind Apache to specific IP addresses and/or | |
35 | -# ports, instead of the default. See also the <VirtualHost> | |
36 | -# directive. | |
37 | -# | |
38 | -# Change this to Listen on specific IP addresses as shown below to | |
39 | -# prevent Apache from glomming onto all bound IP addresses. | |
40 | -# | |
41 | -#Listen 12.34.56.78:80 | |
42 | -Listen 80 | |
43 | -Listen 81 | |
44 | - | |
45 | -# | |
46 | -# Dynamic Shared Object (DSO) Support | |
47 | -# | |
48 | -# To be able to use the functionality of a module which was built as a DSO you | |
49 | -# have to place corresponding `LoadModule' lines at this location so the | |
50 | -# directives contained in it are actually available _before_ they are used. | |
51 | -# Statically compiled modules (those listed by `httpd -l') do not need | |
52 | -# to be loaded here. | |
53 | -# | |
54 | -# Example: | |
55 | -# LoadModule foo_module modules/mod_foo.so | |
56 | -# | |
57 | -Include conf.modules.d/*.conf | |
58 | - | |
59 | -# | |
60 | -# If you wish httpd to run as a different user or group, you must run | |
61 | -# httpd as root initially and it will switch. | |
62 | -# | |
63 | -# User/Group: The name (or #number) of the user/group to run httpd as. | |
64 | -# It is usually good practice to create a dedicated user and group for | |
65 | -# running httpd, as with most system services. | |
66 | -# | |
67 | -User apache | |
68 | -Group apache | |
69 | - | |
70 | -# 'Main' server configuration | |
71 | -# | |
72 | -# The directives in this section set up the values used by the 'main' | |
73 | -# server, which responds to any requests that aren't handled by a | |
74 | -# <VirtualHost> definition. These values also provide defaults for | |
75 | -# any <VirtualHost> containers you may define later in the file. | |
76 | -# | |
77 | -# All of these directives may appear inside <VirtualHost> containers, | |
78 | -# in which case these default settings will be overridden for the | |
79 | -# virtual host being defined. | |
80 | -# | |
81 | - | |
82 | -# | |
83 | -# ServerAdmin: Your address, where problems with the server should be | |
84 | -# e-mailed. This address appears on some server-generated pages, such | |
85 | -# as error documents. e.g. admin@your-domain.com | |
86 | -# | |
87 | -ServerAdmin root@localhost | |
88 | - | |
89 | -# | |
90 | -# ServerName gives the name and port that the server uses to identify itself. | |
91 | -# This can often be determined automatically, but we recommend you specify | |
92 | -# it explicitly to prevent problems during startup. | |
93 | -# | |
94 | -# If your host doesn't have a registered DNS name, enter its IP address here. | |
95 | -# | |
96 | -#ServerName www.example.com:80 | |
97 | - | |
98 | -# | |
99 | -# Deny access to the entirety of your server's filesystem. You must | |
100 | -# explicitly permit access to web content directories in other | |
101 | -# <Directory> blocks below. | |
102 | -# | |
103 | -<Directory /> | |
104 | - AllowOverride none | |
105 | - Require all denied | |
106 | -</Directory> | |
107 | - | |
108 | -# | |
109 | -# Note that from this point forward you must specifically allow | |
110 | -# particular features to be enabled - so if something's not working as | |
111 | -# you might expect, make sure that you have specifically enabled it | |
112 | -# below. | |
113 | -# | |
114 | - | |
115 | -# | |
116 | -# DocumentRoot: The directory out of which you will serve your | |
117 | -# documents. By default, all requests are taken from this directory, but | |
118 | -# symbolic links and aliases may be used to point to other locations. | |
119 | -# | |
120 | -DocumentRoot "/var/www/html" | |
121 | - | |
122 | -# | |
123 | -# Relax access to content within /var/www. | |
124 | -# | |
125 | -<Directory "/var/www"> | |
126 | - AllowOverride None | |
127 | - # Allow open access: | |
128 | - Require all granted | |
129 | -</Directory> | |
130 | - | |
131 | -# Further relax access to the default document root: | |
132 | -<Directory "/var/www/html"> | |
133 | - # | |
134 | - # Possible values for the Options directive are "None", "All", | |
135 | - # or any combination of: | |
136 | - # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews | |
137 | - # | |
138 | - # Note that "MultiViews" must be named *explicitly* --- "Options All" | |
139 | - # doesn't give it to you. | |
140 | - # | |
141 | - # The Options directive is both complicated and important. Please see | |
142 | - # http://httpd.apache.org/docs/2.4/mod/core.html#options | |
143 | - # for more information. | |
144 | - # | |
145 | - Options Indexes FollowSymLinks | |
146 | - | |
147 | - # | |
148 | - # AllowOverride controls what directives may be placed in .htaccess files. | |
149 | - # It can be "All", "None", or any combination of the keywords: | |
150 | - # Options FileInfo AuthConfig Limit | |
151 | - # | |
152 | - AllowOverride None | |
153 | - | |
154 | - # | |
155 | - # Controls who can get stuff from this server. | |
156 | - # | |
157 | - Require all granted | |
158 | -</Directory> | |
159 | - | |
160 | -# | |
161 | -# DirectoryIndex: sets the file that Apache will serve if a directory | |
162 | -# is requested. | |
163 | -# | |
164 | -<IfModule dir_module> | |
165 | - DirectoryIndex index.html | |
166 | -</IfModule> | |
167 | - | |
168 | -# | |
169 | -# The following lines prevent .htaccess and .htpasswd files from being | |
170 | -# viewed by Web clients. | |
171 | -# | |
172 | -<Files ".ht*"> | |
173 | - Require all denied | |
174 | -</Files> | |
175 | - | |
176 | -# | |
177 | -# ErrorLog: The location of the error log file. | |
178 | -# If you do not specify an ErrorLog directive within a <VirtualHost> | |
179 | -# container, error messages relating to that virtual host will be | |
180 | -# logged here. If you *do* define an error logfile for a <VirtualHost> | |
181 | -# container, that host's errors will be logged there and not here. | |
182 | -# | |
183 | -ErrorLog "logs/error_log" | |
184 | - | |
185 | -# | |
186 | -# LogLevel: Control the number of messages logged to the error_log. | |
187 | -# Possible values include: debug, info, notice, warn, error, crit, | |
188 | -# alert, emerg. | |
189 | -# | |
190 | -LogLevel warn | |
191 | - | |
192 | -<IfModule log_config_module> | |
193 | - # | |
194 | - # The following directives define some format nicknames for use with | |
195 | - # a CustomLog directive (see below). | |
196 | - # | |
197 | - LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined | |
198 | - LogFormat "%h %l %u %t \"%r\" %>s %b" common | |
199 | - | |
200 | - <IfModule logio_module> | |
201 | - # You need to enable mod_logio.c to use %I and %O | |
202 | - LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio | |
203 | - </IfModule> | |
204 | - | |
205 | - # | |
206 | - # The location and format of the access logfile (Common Logfile Format). | |
207 | - # If you do not define any access logfiles within a <VirtualHost> | |
208 | - # container, they will be logged here. Contrariwise, if you *do* | |
209 | - # define per-<VirtualHost> access logfiles, transactions will be | |
210 | - # logged therein and *not* in this file. | |
211 | - # | |
212 | - #CustomLog "logs/access_log" common | |
213 | - | |
214 | - # | |
215 | - # If you prefer a logfile with access, agent, and referer information | |
216 | - # (Combined Logfile Format) you can use the following directive. | |
217 | - # | |
218 | - CustomLog "logs/access_log" combined | |
219 | -</IfModule> | |
220 | - | |
221 | -<IfModule alias_module> | |
222 | - # | |
223 | - # Redirect: Allows you to tell clients about documents that used to | |
224 | - # exist in your server's namespace, but do not anymore. The client | |
225 | - # will make a new request for the document at its new location. | |
226 | - # Example: | |
227 | - # Redirect permanent /foo http://www.example.com/bar | |
228 | - | |
229 | - # | |
230 | - # Alias: Maps web paths into filesystem paths and is used to | |
231 | - # access content that does not live under the DocumentRoot. | |
232 | - # Example: | |
233 | - # Alias /webpath /full/filesystem/path | |
234 | - # | |
235 | - # If you include a trailing / on /webpath then the server will | |
236 | - # require it to be present in the URL. You will also likely | |
237 | - # need to provide a <Directory> section to allow access to | |
238 | - # the filesystem path. | |
239 | - | |
240 | - # | |
241 | - # ScriptAlias: This controls which directories contain server scripts. | |
242 | - # ScriptAliases are essentially the same as Aliases, except that | |
243 | - # documents in the target directory are treated as applications and | |
244 | - # run by the server when requested rather than as documents sent to the | |
245 | - # client. The same rules about trailing "/" apply to ScriptAlias | |
246 | - # directives as to Alias. | |
247 | - # | |
248 | - ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" | |
249 | - | |
250 | -</IfModule> | |
251 | - | |
252 | -# | |
253 | -# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased | |
254 | -# CGI directory exists, if you have that configured. | |
255 | -# | |
256 | -<Directory "/var/www/cgi-bin"> | |
257 | - AllowOverride None | |
258 | - Options None | |
259 | - Require all granted | |
260 | -</Directory> | |
261 | - | |
262 | -<IfModule mime_module> | |
263 | - # | |
264 | - # TypesConfig points to the file containing the list of mappings from | |
265 | - # filename extension to MIME-type. | |
266 | - # | |
267 | - TypesConfig /etc/mime.types | |
268 | - | |
269 | - # | |
270 | - # AddType allows you to add to or override the MIME configuration | |
271 | - # file specified in TypesConfig for specific file types. | |
272 | - # | |
273 | - #AddType application/x-gzip .tgz | |
274 | - # | |
275 | - # AddEncoding allows you to have certain browsers uncompress | |
276 | - # information on the fly. Note: Not all browsers support this. | |
277 | - # | |
278 | - #AddEncoding x-compress .Z | |
279 | - #AddEncoding x-gzip .gz .tgz | |
280 | - # | |
281 | - # If the AddEncoding directives above are commented-out, then you | |
282 | - # probably should define those extensions to indicate media types: | |
283 | - # | |
284 | - AddType application/x-compress .Z | |
285 | - AddType application/x-gzip .gz .tgz | |
286 | - | |
287 | - # | |
288 | - # AddHandler allows you to map certain file extensions to "handlers": | |
289 | - # actions unrelated to filetype. These can be either built into the server | |
290 | - # or added with the Action directive (see below) | |
291 | - # | |
292 | - # To use CGI scripts outside of ScriptAliased directories: | |
293 | - # (You will also need to add "ExecCGI" to the "Options" directive.) | |
294 | - # | |
295 | - #AddHandler cgi-script .cgi | |
296 | - | |
297 | - # For type maps (negotiated resources): | |
298 | - #AddHandler type-map var | |
299 | - | |
300 | - # | |
301 | - # Filters allow you to process content before it is sent to the client. | |
302 | - # | |
303 | - # To parse .shtml files for server-side includes (SSI): | |
304 | - # (You will also need to add "Includes" to the "Options" directive.) | |
305 | - # | |
306 | - AddType text/html .shtml | |
307 | - AddOutputFilter INCLUDES .shtml | |
308 | -</IfModule> | |
309 | - | |
310 | -# | |
311 | -# Specify a default charset for all content served; this enables | |
312 | -# interpretation of all content as UTF-8 by default. To use the | |
313 | -# default browser choice (ISO-8859-1), or to allow the META tags | |
314 | -# in HTML content to override this choice, comment out this | |
315 | -# directive: | |
316 | -# | |
317 | -AddDefaultCharset UTF-8 | |
318 | - | |
319 | -<IfModule mime_magic_module> | |
320 | - # | |
321 | - # The mod_mime_magic module allows the server to use various hints from the | |
322 | - # contents of the file itself to determine its type. The MIMEMagicFile | |
323 | - # directive tells the module where the hint definitions are located. | |
324 | - # | |
325 | - conf/magic | |
326 | -</IfModule> | |
327 | - | |
328 | -# | |
329 | -# Customizable error responses come in three flavors: | |
330 | -# 1) plain text 2) local redirects 3) external redirects | |
331 | -# | |
332 | -# Some examples: | |
333 | -#ErrorDocument 500 "The server made a boo boo." | |
334 | -#ErrorDocument 404 /missing.html | |
335 | -#ErrorDocument 404 "/cgi-bin/missing_handler.pl" | |
336 | -#ErrorDocument 402 http://www.example.com/subscription_info.html | |
337 | -# | |
338 | - | |
339 | -# | |
340 | -# EnableMMAP and EnableSendfile: On systems that support it, | |
341 | -# memory-mapping or the sendfile syscall may be used to deliver | |
342 | -# files. This usually improves server performance, but must | |
343 | -# be turned off when serving from networked-mounted | |
344 | -# filesystems or if support for these functions is otherwise | |
345 | -# broken on your system. | |
346 | -# Defaults if commented: EnableMMAP On, EnableSendfile Off | |
347 | -# | |
348 | -#EnableMMAP off | |
349 | -EnableSendfile on | |
350 | - | |
351 | -# Supplemental configuration | |
352 | -# | |
353 | -# Load config files in the "/etc/httpd/conf.d" directory, if any. | |
354 | - conf.d/*.conf | |
355 | - | |
356 | -LoadModule wsgi_module "/usr/lib64/httpd/modules/mod_wsgi-py37.cpython-37m-x86_64-linux-gnu.so" | |
357 | - "/var/gdal" | |
358 | - | |
359 | -<VirtualHost *:80> | |
360 | - dmapmanager processes=4 threads=16 display-name=%{GROUP} | |
361 | - dmapmanager | |
362 | - On | |
363 | - %{GLOBAL} | |
364 | - / /usr/src/app/run.wsgi | |
365 | - <Directory /usr/> | |
366 | - Require all granted | |
367 | - </Directory> | |
368 | -</VirtualHost> | |
369 | - | |
370 | -<VirtualHost *:81> | |
371 | - monitormanager processes=1 threads=8 display-name=%{GROUP} | |
372 | - monitormanager | |
373 | - %{GLOBAL} | |
374 | - / /usr/src/app/monitor.wsgi | |
375 | - <Directory /usr/> | |
376 | - Require all granted | |
377 | - </Directory> | |
378 | -</VirtualHost> | |
379 | - | |
380 | -<Directory /usr/> | |
381 | - Require all granted | |
382 | -</Directory> |
run.apache.sh
deleted
100644 → 0
1 | -#! /bin/sh | |
2 | -dn="dmapmanager" | |
3 | -#停止容器 | |
4 | -echo "正在关闭容器..." | |
5 | -docker stop $dn | |
6 | -docker rm $dn | |
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 | -port="8840" | |
18 | -echo "未设置端口,使用默认8840端口..." | |
19 | -else | |
20 | -port=$1 | |
21 | -echo "端口设置为$1 ..." | |
22 | -fi | |
23 | - | |
24 | -port2="" | |
25 | -if [ ! -n "$2" ] ;then | |
26 | -port="8841" | |
27 | -echo "未设置端口2,使用默认8840端口..." | |
28 | -else | |
29 | -port2=$2 | |
30 | -echo "端口2设置为$2 ..." | |
31 | -fi | |
32 | - | |
33 | - | |
34 | -#启动容器和apache | |
35 | -echo "正在启动容器..." | |
36 | -set="--privileged=true -e TZ="Asia/Shanghai" --restart=always -e ALLOW_IP_RANGE=0.0.0.0/0" | |
37 | -docker run -d --name $dn $set -p $port:80 -p $port2:81 -v $curPath/logs/apache.error:/var/log/httpd/error_log -v $curPath:/usr/src/app -v $curPath/httpd.conf:/etc/httpd/conf/httpd.conf dci/dmapmanager:4.1 /usr/sbin/init | |
38 | -docker exec -d $dn systemctl start httpd | |
39 | -sleep 5 | |
40 | -curl localhost:$port/release | |
41 | -curl localhost:$port2 |
run.gunicorn.sh
deleted
100644 → 0
1 | -#! /bin/bash | |
2 | -dn="dmapmanager" | |
3 | -#停止容器 | |
4 | -echo "正在关闭容器..." | |
5 | -docker stop $dn | |
6 | -docker rm $dn | |
7 | -curPath=$(readlink -f "$(dirname "$0")") | |
8 | -#设置端口 | |
9 | -port="" | |
10 | -if [ ! -n "$1" ] ;then | |
11 | - port="8840" | |
12 | - echo "未设置端口,使用默认8840端口..." | |
13 | -else | |
14 | - port=$1 | |
15 | - echo "端口设置为$1 ..." | |
16 | -fi | |
17 | -docker run -d --name $dn -e TZ="Asia/Shanghai" --restart=always -e ALLOW_IP_RANGE=0.0.0.0/0 -p $port:8840 -v $curPath:/usr/src/app -w /usr/src/app dci/dmapdms:4.0 gunicorn -c gun_conf.py run:app | |
18 | -# 清除未完成的任务任务 | |
19 | -sleep 5 | |
20 | -curl localhost:$port/release | |
\ No newline at end of file |
... | ... | @@ -16,7 +16,7 @@ else |
16 | 16 | echo "端口设置为$1 ..." |
17 | 17 | fi |
18 | 18 | |
19 | -docker run -d --name $dn -e TZ="Asia/Shanghai" --restart=always -e ALLOW_IP_RANGE=0.0.0.0/0 -p $port:8840 -v $curPath:/usr/src/app -w /usr/src/app dci/dmapserver:build python3 ./run.py | |
19 | +docker run -d --name $dn -e TZ="Asia/Shanghai" --restart=always -e ALLOW_IP_RANGE=0.0.0.0/0 -p $port:8840 -v $curPath:/usr/src/app -w /usr/src/app dci/dmapmanager:4.1 python3 ./run.py | |
20 | 20 | # 清除未完成的任务任务 |
21 | 21 | sleep 5 |
22 | 22 | curl localhost:$port/release |
\ No newline at end of file | ... | ... |
run.ubuntu.apache.sh
deleted
100644 → 0
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 | -port="8840" | |
18 | -echo "未设置端口,使用默认8840端口..." | |
19 | -else | |
20 | -port=$1 | |
21 | -echo "端口设置为$1 ..." | |
22 | -fi | |
23 | - | |
24 | -port2="" | |
25 | -if [ ! -n "$2" ] ;then | |
26 | -port="8841" | |
27 | -echo "未设置端口2,使用默认8840端口..." | |
28 | -else | |
29 | -port2=$2 | |
30 | -echo "端口2设置为$2 ..." | |
31 | -fi | |
32 | - | |
33 | - | |
34 | -#启动容器和apache | |
35 | -echo "正在启动容器..." | |
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}: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 | -docker exec -d $container_name service apache2 start | |
39 | -sleep 5 | |
40 | -curl localhost:$port/release | |
41 | -curl localhost:$port2 |
请
注册
或
登录
后发表评论