Skip to content

Commit

Permalink
fix: acquire lock files on deployer init
Browse files Browse the repository at this point in the history
  • Loading branch information
tushar5526 committed Jan 20, 2024
1 parent 28e01d5 commit f393160
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions server/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ def __init__(self, config: DeploymentConfig):
f"{self._deployment_namespace}.lock",
)
self._lock = filelock.FileLock(self._lock_file_path)

self._project_path: typing.Final[str] = os.path.join(
self._DEPLOYMENTS_MOUNT_DIR, self._deployment_namespace
)

if config.rest_action != "DELETE":
self._setup_project()
with self._lock:
if config.rest_action != "DELETE":
self._setup_project()

self._compose_helper = ComposeHelper(
os.path.join(self._project_path, config.compose_file_location),
config.rest_action != "DELETE",
)
self._secrets_helper = SecretsHelper(
self._config.project_name, self._config.branch_name, self._project_path
)
self._outer_proxy_conf_location = (
os.environ.get("NGINX_PROXY_CONF_LOCATION") or "/etc/nginx/conf.d"
)
self._nginx_helper = NginxHelper(
config, self._outer_proxy_conf_location, self._project_path
)
self._compose_helper = ComposeHelper(
os.path.join(self._project_path, config.compose_file_location),
config.rest_action != "DELETE",
)
self._secrets_helper = SecretsHelper(
self._config.project_name, self._config.branch_name, self._project_path
)
self._outer_proxy_conf_location = (
os.environ.get("NGINX_PROXY_CONF_LOCATION") or "/etc/nginx/conf.d"
)
self._nginx_helper = NginxHelper(
config, self._outer_proxy_conf_location, self._project_path
)

def _clone_project(self):
process = subprocess.Popen(
Expand Down

0 comments on commit f393160

Please sign in to comment.