Skip to content

Commit

Permalink
Fix bugs in deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogsilva committed Apr 22, 2024
1 parent ead8f9c commit 47860a3
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions deployments/staging/hook-scripts/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,12 @@ def handle(self) -> None:
@dataclasses.dataclass
class _PullImage:
images: tuple[str]
env_file: Path
compose_files_fragment: str
name: str = "pull new docker images from container registry"

def handle(self) -> None:
print("Pulling updated docker images...")
run(
shlex.split(
f"docker compose {self.compose_files_fragment} "
f"pull {' '.join(self.images)}"
),
env={
**os.environ,
"ARPAV_PPCV_DEPLOYMENT_ENV_FILE": self.env_file
},
shlex.split(f"docker pull {' '.join(self.images)}"),
check=True
)

Expand Down Expand Up @@ -173,6 +164,7 @@ def handle(self) -> None:
@dataclasses.dataclass
class _RunMigrations:
webapp_service_name: str
name: str = "run DB migrations"

def handle(self) -> None:
print("Upgrading database...")
Expand All @@ -188,6 +180,7 @@ def handle(self) -> None:
@dataclasses.dataclass
class _RunLegacyMigrations:
webapp_service_name: str
name: str = "run legacy DB migrations"

def handle(self) -> None:
print("Upgrading legacy database...")
Expand All @@ -203,6 +196,7 @@ def handle(self) -> None:
@dataclasses.dataclass
class _CollectLegacyStaticFiles:
webapp_service_name: str
name: str = "collect legacy static files"

def handle(self) -> None:
print("Collecting legacy static files...")
Expand Down Expand Up @@ -243,11 +237,7 @@ def perform_deployment(
_StopCompose(docker_dir=docker_dir, compose_files_fragment=compose_files),
_CloneRepo(clone_destination=clone_destination),
_ReplaceDockerDir(repo_dir=clone_destination, docker_dir=docker_dir),
_PullImage(
images=relevant_images,
env_file=deployment_env_file,
compose_files_fragment=compose_files
),
_PullImage(images=relevant_images),
_StartCompose(
env_file=deployment_env_file, compose_files_fragment=compose_files),
# _RunMigrations(webapp_service_name=webapp_service_name),
Expand Down

0 comments on commit 47860a3

Please sign in to comment.