-
Notifications
You must be signed in to change notification settings - Fork 8
/
start.py
executable file
·83 lines (76 loc) · 2.46 KB
/
start.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python
"""Initialize a web project Django service based on a template."""
from pathlib import Path
import click
from bootstrap.collector import Collector
from bootstrap.constants import (
DEPLOYMENT_TYPE_CHOICES,
ENVIRONMENTS_DISTRIBUTION_CHOICES,
GITLAB_TOKEN_ENV_VAR,
MEDIA_STORAGE_CHOICES,
VAULT_TOKEN_ENV_VAR,
)
from bootstrap.exceptions import BootstrapError
from bootstrap.helpers import slugify_option
@click.command()
@click.option("--uid", type=int)
@click.option("--gid", type=int)
@click.option(
"--output-dir",
default=".",
envvar="OUTPUT_BASE_DIR",
type=click.Path(
exists=True, path_type=Path, file_okay=False, readable=True, writable=True
),
)
@click.option("--project-name", prompt=True)
@click.option("--project-slug", callback=slugify_option)
@click.option("--project-dirname")
@click.option("--service-slug", callback=slugify_option)
@click.option("--internal-service-port", default=8000, type=int)
@click.option(
"--deployment-type",
type=click.Choice(DEPLOYMENT_TYPE_CHOICES, case_sensitive=False),
)
@click.option("--terraform-backend")
@click.option("--terraform-cloud-hostname")
@click.option("--terraform-cloud-token")
@click.option("--terraform-cloud-organization")
@click.option(
"--terraform-cloud-organization-create/--terraform-cloud-organization-create-skip",
is_flag=True,
default=None,
)
@click.option("--terraform-cloud-admin-email")
@click.option("--vault-token", envvar=VAULT_TOKEN_ENV_VAR)
@click.option("--vault-url")
@click.option(
"--environments-distribution", type=click.Choice(ENVIRONMENTS_DISTRIBUTION_CHOICES)
)
@click.option("--project-url-dev")
@click.option("--project-url-stage")
@click.option("--project-url-prod")
@click.option("--sentry-dsn")
@click.option("--sentry-org")
@click.option("--sentry-url")
@click.option(
"--media-storage",
type=click.Choice(MEDIA_STORAGE_CHOICES, case_sensitive=False),
)
@click.option("--use-redis/--no-redis", is_flag=True, default=None)
@click.option("--gitlab-url")
@click.option("--gitlab-token", envvar=GITLAB_TOKEN_ENV_VAR)
@click.option("--gitlab-namespace-path")
@click.option("--terraform-dir")
@click.option("--logs-dir")
@click.option("--quiet", is_flag=True)
def main(**options):
"""Run the setup."""
try:
collector = Collector(**options)
collector.collect()
collector.launch_runner()
except BootstrapError as e:
raise click.Abort() from e
if __name__ == "__main__":
main()