actually call caddyfile script
This commit is contained in:
2
Makefile
2
Makefile
@@ -5,7 +5,7 @@ build:
|
|||||||
python -m venv venv; \
|
python -m venv venv; \
|
||||||
fi; \
|
fi; \
|
||||||
venv/bin/pip install -r requirements.txt
|
venv/bin/pip install -r requirements.txt
|
||||||
|
venv/bin/python caddy.py
|
||||||
|
|
||||||
start:
|
start:
|
||||||
sudo venv/bin/waitress-serve --host 0.0.0.0 --port $(PORT) listen:app
|
sudo venv/bin/waitress-serve --host 0.0.0.0 --port $(PORT) listen:app
|
||||||
|
|||||||
18
caddy.py
Normal file
18
caddy.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from operator import itemgetter
|
||||||
|
from textwrap import dedent
|
||||||
|
from deploy import by_branch
|
||||||
|
|
||||||
|
|
||||||
|
def build_caddyfile():
|
||||||
|
excluded = {"deployer"}
|
||||||
|
with open("Caddyfile", "w+") as file:
|
||||||
|
for domain, port in map(itemgetter("domain", "port"), by_branch.values()):
|
||||||
|
if domain in excluded:
|
||||||
|
continue
|
||||||
|
|
||||||
|
entry = f"""
|
||||||
|
{domain}.drm.dev {{
|
||||||
|
reverse_proxy localhost:{port}
|
||||||
|
}}
|
||||||
|
"""
|
||||||
|
file.write(dedent(entry))
|
||||||
15
deploy.py
15
deploy.py
@@ -27,21 +27,6 @@ by_branch = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def build_caddyfile():
|
|
||||||
excluded = {"deployer"}
|
|
||||||
with open("Caddyfile", "w+") as file:
|
|
||||||
for domain, port in map(itemgetter("domain", "port"), by_branch.values()):
|
|
||||||
if domain in excluded:
|
|
||||||
continue
|
|
||||||
|
|
||||||
entry = f"""
|
|
||||||
{domain}.drm.dev {{
|
|
||||||
reverse_proxy localhost:{port}
|
|
||||||
}}
|
|
||||||
"""
|
|
||||||
file.write(dedent(entry))
|
|
||||||
|
|
||||||
|
|
||||||
def handle_request(rq: DeployerRequest):
|
def handle_request(rq: DeployerRequest):
|
||||||
if (rq.user, rq.repo, rq.branch) not in by_branch:
|
if (rq.user, rq.repo, rq.branch) not in by_branch:
|
||||||
print(
|
print(
|
||||||
|
|||||||
Reference in New Issue
Block a user