Bug fixes and additional checks

This commit is contained in:
DomySh
2022-06-14 08:31:25 +02:00
parent 4abb7e2746
commit 8eb077efa2
9 changed files with 57 additions and 40 deletions

43
start.py Executable file
View File

@@ -0,0 +1,43 @@
import argparse, sys, platform
parser = argparse.ArgumentParser()
parser.add_argument('port', type=int, help='Port where open the web service of the firewall')
args = parser.parse_args()
with open("docker-compose.yml","wt") as compose:
if "linux" in sys.platform and not 'microsoft-standard' in platform.uname().release: #Check if not is a wsl also
compose.write(f"""
version: '3.9'
services:
firewall:
restart: unless-stopped
build: .
network_mode: "host"
environment:
- NGINX_PORT={args.port}
volumes:
- /execute/db
""")
print("Done! You can start firegex with docker-compose up -d --build")
else:
print("-----------------------------------")
print("You are not in a linux machine, due to docker limitation on other platform, the firewall will not work in this machine. You will only see the interface of firegex.")
print("-----------------------------------")
compose.write(f"""
version: '3.9'
services:
firewall:
restart: unless-stopped
build: .
ports:
- {args.port}:{args.port}
environment:
- NGINX_PORT={args.port}
volumes:
- /execute/db
""")
print("Done! You can start firegex with docker-compose up -d --build")