Skip to content
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
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ ARG DEBIAN_FRONTEND=noninteractive
ARG OUTPUT_BASE_DIR=/data
ENV OUTPUT_BASE_DIR=${OUTPUT_BASE_DIR}
WORKDIR /app
ARG OPENTOFU_VERSION=1.10.6
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
curl \
git \
gnupg \
software-properties-common \
&& curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg \
&& gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint \
&& echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list \
&& apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
terraform \
unzip \
&& curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh \
&& chmod +x /tmp/install-opentofu.sh \
&& /tmp/install-opentofu.sh --install-method standalone --opentofu-version "${OPENTOFU_VERSION}" \
&& rm /tmp/install-opentofu.sh \
&& rm -rf /var/lib/apt/lists/*
COPY ./requirements/common.txt requirements/common.txt
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools \
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Cluster slug hosting the 'production' environment [main]:
Development environment complete URL [https://dev.my-project-name.com/]:
Staging environment complete URL [https://stage.my-project-name.com/]:
Production environment complete URL [https://www.my-project-name.com/]:
Do you want to configure Redis? [y/N]:
Do you want to configure Valkey? [y/N]:
Do you want to use GitLab? [Y/n]:
GitLab group slug [my-project-name]:
Make sure the GitLab "my-project-name" group exists before proceeding. Continue? [y/N]: y
Expand Down Expand Up @@ -174,14 +174,14 @@ If you don't want DigitalOcean DNS configuration the following args are required
`--project-url-stage=https://stage.project-domain.com`<br/>
`--project-url-prod=https://www.project-domain.com`

#### Redis
#### Valkey

For enabling redis integration the following arguments are needed:
For enabling valkey integration the following arguments are needed:

`--use-redis`
`--use-valkey`

Disabled args
`--no-redis`
`--no-valkey`

### 🦊 GitLab

Expand Down
16 changes: 8 additions & 8 deletions bootstrap/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Collector:
project_url_dev: str | None = None
project_url_stage: str | None = None
project_url_prod: str | None = None
use_redis: bool | None = None
use_valkey: bool | None = None
sentry_dsn: str | None = None
sentry_org: str | None = None
sentry_url: str | None = None
Expand All @@ -81,7 +81,7 @@ def collect(self):
self.set_service_slug()
self.set_project_dirname()
self.set_service_dir()
self.set_use_redis()
self.set_use_valkey()
self.set_terraform()
self.set_vault()
self.set_env_to_cluster()
Expand Down Expand Up @@ -126,11 +126,11 @@ def set_service_dir(self):
rmtree(service_dir)
self._service_dir = service_dir

def set_use_redis(self):
"""Set the use Redis option."""
if self.use_redis is None:
self.use_redis = click.confirm(
warning("Do you want to use Redis?"), default=False
def set_use_valkey(self):
"""Set the use Valkey option."""
if self.use_valkey is None:
self.use_valkey = click.confirm(
warning("Do you want to use Valkey?"), default=False
)

def set_terraform(self):
Expand Down Expand Up @@ -308,7 +308,7 @@ def get_runner(self):
sentry_dsn=self.sentry_dsn,
sentry_org=self.sentry_org,
sentry_url=self.sentry_url,
use_redis=self.use_redis,
use_valkey=self.use_valkey,
gitlab_url=self.gitlab_url,
gitlab_token=self.gitlab_token,
gitlab_namespace_path=self.gitlab_namespace_path,
Expand Down
19 changes: 11 additions & 8 deletions bootstrap/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Runner:
sentry_dsn: str | None = None
sentry_org: str | None = None
sentry_url: str | None = None
use_redis: bool = False
use_valkey: bool = False
gitlab_url: str | None = None
gitlab_namespace_path: str | None = None
gitlab_token: str | None = None
Expand Down Expand Up @@ -228,7 +228,7 @@ def init_service(self):
"terraform_backend": self.terraform_backend,
"terraform_cloud_organization": self.terraform_cloud_organization,
"tfvars": self.tfvars,
"use_redis": self.use_redis and "true" or "false",
"use_valkey": self.use_valkey and "true" or "false",
"use_vault": self.vault_url and "true" or "false",
"node_version": self.node_version,
"minos_service_image": self.minos_service_image,
Expand Down Expand Up @@ -264,6 +264,9 @@ def init_terraform_cloud(self):
"TF_VAR_project_slug": self.project_slug,
"TF_VAR_service_slug": self.service_slug,
"TF_VAR_terraform_cloud_token": self.terraform_cloud_token,
# Serialize workspace creation: tfe provider races on tfe_project readiness
# when creating multiple workspaces in parallel, returning sporadic 422s.
"TF_CLI_ARGS_apply": "-parallelism=1",
}
self.run_terraform("terraform-cloud", env)

Expand Down Expand Up @@ -300,8 +303,8 @@ def init_vault(self):
def get_terraform_module_params(self, module_name, env):
"""Return Terraform parameters for the given module."""
return (
Path(__file__).parent.parent / "terraform" / module_name,
self.logs_dir / self.service_slug / "terraform" / module_name,
Path(__file__).parent.parent / "tofu" / module_name,
self.logs_dir / self.service_slug / "tofu" / module_name,
terraform_dir := self.terraform_dir / self.service_slug / module_name,
{
**env,
Expand All @@ -318,7 +321,7 @@ def run_terraform_init(self, cwd, env, logs_dir, state_path):
init_stderr_path = logs_dir / "init-stderr.log"
init_process = subprocess.run(
[
"terraform",
"tofu",
"init",
"-backend-config",
f"path={state_path.resolve()}",
Expand Down Expand Up @@ -347,7 +350,7 @@ def run_terraform_apply(self, cwd, env, logs_dir):
apply_stdout_path = logs_dir / "apply-stdout.log"
apply_stderr_path = logs_dir / "apply-stderr.log"
apply_process = subprocess.run(
["terraform", "apply", "-auto-approve", "-input=false", "-no-color"],
["tofu", "apply", "-auto-approve", "-input=false", "-no-color"],
capture_output=True,
cwd=cwd,
env=dict(**env, TF_LOG_PATH=str(apply_log_path.resolve())),
Expand All @@ -372,7 +375,7 @@ def run_terraform_destroy(self, cwd, env, logs_dir):
destroy_stderr_path = logs_dir / "destroy-stderr.log"
destroy_process = subprocess.run(
[
"terraform",
"tofu",
"destroy",
"-auto-approve",
"-input=false",
Expand All @@ -398,7 +401,7 @@ def get_terraform_outputs(self, cwd, env, outputs):
"""Get Terraform outputs."""
return {
output_name: subprocess.run(
["terraform", "output", "-raw", output_name],
["tofu", "output", "-raw", output_name],
capture_output=True,
cwd=cwd,
env=env,
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"internal_service_port": "3000",
"terraform_backend": "gitlab",
"terraform_cloud_organization": null,
"use_redis": "false",
"use_valkey": "false",
"use_vault": "false",
"node_version": "24.14.0",
"minos_service_image": "registry.gitlab.com/20tab-open/minos/service:latest",
Expand Down
4 changes: 2 additions & 2 deletions requirements/common.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
click~=8.1.0
cookiecutter~=2.5.0
click~=8.3.0
cookiecutter~=2.6.0
pydantic~=1.10.0
python-slugify~=8.0.0
validators~=0.20.0
Loading
Loading