Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only use root_domain variable for local dev #66

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ Once you know these:
### Run draft

```
draft start-helper-sidecar --identity <identity> --root_domain example.com --config_path config
draft start-helper-sidecar --identity <identity> --helper_domain helper.example.com --sidecar_domain sidecar.example.com --config_path config
```

This will start the sidecar in the background. To confirm, visit `example.com/status`.
This will start the sidecar in the background. To confirm, visit `sidecar.example.com/status`.


## Local Dev
Expand Down
1 change: 0 additions & 1 deletion ansible/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
source .venv/bin/activate &&
draft start-helper-sidecar
--identity {{ identity }}
--root_domain {{ root_domain }}
--helper_domain {{ helper_domain }}
--sidecar_domain {{ sidecar_domain }}
--config_path {{ ansible_env.HOME }}/draft/config
Expand Down
1 change: 0 additions & 1 deletion ansible/inventory.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ ipa-2 identity=2 helper_domain=helper2.ipa-helper.dev sidecar_
ipa-3 identity=3 helper_domain=helper3.ipa-helper.dev sidecar_domain=sidecar3.ipa-helper.dev
[myhosts:vars]
ansible_python_interpreter=/usr/bin/python3
root_domain=ipa-helper.dev
1 change: 0 additions & 1 deletion ansible/provision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
source .venv/bin/activate &&
draft start-helper-sidecar
--identity {{ identity }}
--root_domain {{ root_domain }}
--helper_domain {{ helper_domain }}
--sidecar_domain {{ sidecar_domain }}
--config_path {{ ansible_env.HOME }}/draft/config
Expand Down
13 changes: 6 additions & 7 deletions etc/start_helper_sidecar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ fi

config_path=$1
root_path=$2
root_domain=$3
helper_domain=$4
sidecar_domain=$5
helper_port=$6
sidecar_port=$7
identity=$8
helper_domain=$3
sidecar_domain=$4
helper_port=$5
sidecar_port=$6
identity=$7

nohup draft run-helper-sidecar --config_path "$config_path" --root_path "$root_path" --root_domain "$root_domain" --helper_domain "$helper_domain" --sidecar_domain "$sidecar_domain" --helper_port "$helper_port" --sidecar_port "$sidecar_port" --identity "$identity" > .draft/logs/helper_sidecar.log 2>&1 & echo $! > $pid_file
nohup draft run-helper-sidecar --config_path "$config_path" --root_path "$root_path" --helper_domain "$helper_domain" --sidecar_domain "$sidecar_domain" --helper_port "$helper_port" --sidecar_port "$sidecar_port" --identity "$identity" > .draft/logs/helper_sidecar.log 2>&1 & echo $! > $pid_file
30 changes: 12 additions & 18 deletions sidecar/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,11 @@ def start_helper_sidecar_command(
# pylint: disable=too-many-arguments
def start_traefik_command(
config_path: Path,
root_domain: str,
helper_domain: str | None,
sidecar_domain: str | None,
helper_domain: str,
sidecar_domain: str,
helper_port: int,
sidecar_port: int,
):
sidecar_domain = sidecar_domain or f"sidecar.{root_domain}"
helper_domain = helper_domain or f"helper.{root_domain}"
env = {
**os.environ,
"SIDECAR_DOMAIN": sidecar_domain,
Expand Down Expand Up @@ -136,18 +133,16 @@ def start_traefik_local_command(
show_default=True,
)
@click.option("--root_path", type=click_pathlib.Path(), default=None)
@click.option("--root_domain", type=str, default="ipa-helper.dev")
@click.option("--helper_domain", type=str, default=None)
@click.option("--sidecar_domain", type=str, default=None)
@click.option("--helper_domain", required=True, type=str)
@click.option("--sidecar_domain", required=True, type=str)
@click.option("--helper_port", type=int, default=7430)
@click.option("--sidecar_port", type=int, default=17430)
@click.option("--identity", required=True, type=int)
def run_helper_sidecar(
config_path: Path,
root_path: Path,
root_domain: str,
helper_domain: str | None,
sidecar_domain: str | None,
helper_domain: str,
sidecar_domain: str,
helper_port: int,
sidecar_port: int,
identity: int,
Expand All @@ -161,7 +156,6 @@ def run_helper_sidecar(
)
traefik_command = start_traefik_command(
config_path=config_path,
root_domain=root_domain,
helper_domain=helper_domain,
sidecar_domain=sidecar_domain,
helper_port=helper_port,
Expand All @@ -179,16 +173,14 @@ def run_helper_sidecar(
show_default=True,
)
@click.option("--root_path", type=click_pathlib.Path(), default=Path("."))
@click.option("--root_domain", type=str, default="ipa-helper.dev")
@click.option("--helper_domain", type=str, default="")
@click.option("--sidecar_domain", type=str, default="")
@click.option("--helper_domain", required=True, type=str)
@click.option("--sidecar_domain", required=True, type=str)
@click.option("--helper_port", type=int, default=7430)
@click.option("--sidecar_port", type=int, default=17430)
@click.option("--identity", required=True, type=int)
def start_helper_sidecar(
config_path: Path,
root_path: Path,
root_domain: str,
helper_domain: str,
sidecar_domain: str,
helper_port: int,
Expand All @@ -205,8 +197,10 @@ def start_helper_sidecar(
script_path = root_path / Path("etc/start_helper_sidecar.sh")

start_command = Command(
cmd=f"{script_path} {config_path} {root_path} {root_domain} "
f"{helper_domain} {sidecar_domain} {helper_port} {sidecar_port} {identity}",
cmd=(
f"{script_path} {config_path} {root_path} {helper_domain} {sidecar_domain} "
f"{helper_port} {sidecar_port} {identity}"
),
)
start_command.run_blocking_no_output_capture()
print("draft helper_sidecar started")
Expand Down
Loading