Skip to content

Commit

Permalink
✨ feat: add docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjinhub committed Jan 28, 2023
1 parent 94f37dd commit 1fd89a2
Show file tree
Hide file tree
Showing 35 changed files with 490 additions and 364 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
docker
.git
.gitignore
LICENSE
images
README.md
.idea
.DS_Store
docker-compose.yml
.dockerignore
Dockerfile
!docker/supervisord.conf
7 changes: 7 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,10 @@ dmypy.json

# Pyre type checker
.pyre/

docker/apps
docker/mysql_db
docker/redis_db
docker/logs
docker/config.ini
test.py
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM amd64/python:3.8.2
MAINTAINER SanJin<[email protected]>
WORKDIR /w5
COPY requirements.txt requirements.txt
RUN pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple \
&& pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
COPY ./docker/supervisord.conf /etc/supervisord.conf
COPY . .
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
2 changes: 1 addition & 1 deletion core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from core.view import Decorator
from flask import (Flask, send_from_directory)

version = "0.6.2"
version = "0.6.3"

db = Orator()
redis = FlaskRedis()
Expand Down
Binary file modified core/auto/linux/core.so
Binary file not shown.
Binary file modified core/auto/windows/core.pyd
Binary file not shown.
2 changes: 1 addition & 1 deletion core/view/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import rpyc
import shutil
import socket
import asyncio
import requests
import platform
Expand All @@ -26,5 +27,4 @@
elif platform.system() == 'Linux':
from core.auto.linux.core import auto_execute, ManageTimer
elif platform.system() == "Darwin":
# from core.auto.mac.core import auto_execute, ManageTimer
print("Mac platform is not supported.")
21 changes: 13 additions & 8 deletions core/view/system/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,20 @@ def setting():
manage_timer = ManageTimer()
manage_timer.start()

s = ThreadedServer(service=manage_timer, port=53124, auto_register=False)
s.start()
rpc = ThreadedServer(service=manage_timer, port=53124, auto_register=False)
rpc.start()

result = redis.set("manage_timer_lock", 1, nx=True, ex=8)

if result:
t = threading.Thread(target=setting)
t.setDaemon(True)
t.start()
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 53124))
s.shutdown(2)
except:
result = redis.set("manage_timer_lock", 1, nx=True, ex=8)

if result:
t = threading.Thread(target=setting)
t.setDaemon(True)
t.start()


def init_async():
Expand Down
2 changes: 1 addition & 1 deletion core/web/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" type=image/x-icon href=static/favicon.ico><title>W5 SOAR - 无需编写代码的安全自动化平台</title><link href=./static/css/app.186fc1eea961a4c56a0c89051cd69d28.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.ace2bb1f3403ad812fdf.js></script><script type=text/javascript src=./static/js/vendor.4c57ac819e0c732d9433.js></script><script type=text/javascript src=./static/js/app.a88c99f2131ac93e53c7.js></script></body></html>
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" type=image/x-icon href=static/favicon.ico><title>W5 SOAR - 无需编写代码的安全自动化平台</title><link href=./static/css/app.186fc1eea961a4c56a0c89051cd69d28.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.7711172e16e9b7d37021.js></script><script type=text/javascript src=./static/js/vendor.4c57ac819e0c732d9433.js></script><script type=text/javascript src=./static/js/app.b79b120c866a3a31548e.js></script></body></html>
2 changes: 1 addition & 1 deletion core/web/static/js/0.75fee1a50e1202fcb49e.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/1.dd89b837ea426853fb0c.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/10.91f57ae8399e74c3145a.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/11.048747144dc7f6422999.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/12.4b8241c86c0c2fd2cc28.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/13.58c2c9e1c5cb4ae487db.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/16.d5fc721bb537576012aa.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/17.1c1b280ebe10200470b7.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/2.9ab5d22ca3941c0a1b98.js

Large diffs are not rendered by default.

282 changes: 282 additions & 0 deletions core/web/static/js/3.30acff2d4a5bd3febfa9.js

Large diffs are not rendered by default.

282 changes: 0 additions & 282 deletions core/web/static/js/3.79b49356edf1011014a3.js

This file was deleted.

2 changes: 1 addition & 1 deletion core/web/static/js/4.9489c62e34f13b342ec4.js

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions core/web/static/js/5.730b81524870c4f0c20a.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/6.c08715cda3b6f6005513.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/7.cb3391ddd7191d390028.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/8.44c6241906883f765274.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/web/static/js/9.f321d440c2516f3cb3eb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion core/web/static/js/app.a88c99f2131ac93e53c7.js

This file was deleted.

1 change: 1 addition & 0 deletions core/web/static/js/app.b79b120c866a3a31548e.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/web/static/js/manifest.7711172e16e9b7d37021.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion core/web/static/js/manifest.ace2bb1f3403ad812fdf.js

This file was deleted.

8 changes: 4 additions & 4 deletions core/web/static/js/vendor.4c57ac819e0c732d9433.js

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
version: '3'
services:
web:
build: .
restart: always
container_name: w5_web
platform: "linux/amd64"
ports:
- "8888:8888"
depends_on:
- mysql
- redis
environment:
MYSQL_HOST: "mysql"
MYSQL_PORT: 3306
MYSQL_DATABASE: "w5_db"
MYSQL_USER: "root"
MYSQL_PASSWORD: "w5_12345678"
REDIS_HOST: "redis"
REDIS_PORT: 6379
REDIS_DATABASE: 0
REDIS_PASSWORD: ""
volumes:
- ./docker/config.ini:/w5/config.ini
- ./docker/apps:/w5/apps
- ./docker/logs:/opt
networks:
- w5Net

mysql:
image: mysql
restart: always
container_name: w5_mysql
ports:
- "3307:3306"
volumes:
- ./docker/sql:/docker-entrypoint-initdb.d
- ./docker/conf.d:/etc/mysql/conf.d
- ./docker/mysql_db:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: "w5_12345678"
TZ: Asia/Shanghai
command:
--max_connections=1000
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--default-authentication-plugin=mysql_native_password
networks:
- w5Net

redis:
image: redis:alpine
restart: always
container_name: w5_redis
environment:
REDIS_PASSWORD: ""
volumes:
- ./docker/redis_db:/data
networks:
- w5Net

networks:
w5Net:
driver: bridge
Loading

0 comments on commit 1fd89a2

Please sign in to comment.