Skip to content

Commit

Permalink
Merge pull request #195 from D10S0VSkY-OSS/hotfix/cache-server-host
Browse files Browse the repository at this point in the history
🐛fix: config cache server host
  • Loading branch information
D10S0VSkY-OSS authored Nov 26, 2023
2 parents 11dd039 + 5b66f2b commit 3df74b2
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/sld-api-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
- name: Build the Docker image with tag
working-directory: ./sld-api-backend
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-api:2.26.0
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-api:2.26.1

- name: Docker Push with tag
#if: github.event.pull_request.merged == true
run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-api:2.26.0
run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-api:2.26.1

- name: Build the Docker image
working-directory: ./sld-api-backend
Expand Down
2 changes: 1 addition & 1 deletion play-with-sld/kubernetes/k8s/sld-api-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
subdomain: primary
containers:
- name: api-backend
image: d10s0vsky/sld-api:2.26.0
image: d10s0vsky/sld-api:2.26.1
imagePullPolicy: Always
command: ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
ports:
Expand Down
2 changes: 1 addition & 1 deletion play-with-sld/kubernetes/k8s/sld-worker-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
subdomain: primary
containers:
- name: stack-deploy-worker-default
image: d10s0vsky/sld-api:2.26.0
image: d10s0vsky/sld-api:2.26.1
imagePullPolicy: Always
env:
- name: TF_WARN_OUTPUT_ERRORS
Expand Down
2 changes: 1 addition & 1 deletion play-with-sld/kubernetes/k8s/sld-worker-squad1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
subdomain: primary
containers:
- name: stack-deploy-worker-squad1
image: d10s0vsky/sld-api:2.26.0
image: d10s0vsky/sld-api:2.26.1
imagePullPolicy: Always
env:
- name: TF_WARN_OUTPUT_ERRORS
Expand Down
2 changes: 1 addition & 1 deletion play-with-sld/kubernetes/k8s/sld-worker-squad2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
subdomain: primary
containers:
- name: stack-deploy-worker-squad2
image: d10s0vsky/sld-api:2.26.0
image: d10s0vsky/sld-api:2.26.1
imagePullPolicy: Always
env:
- name: TF_WARN_OUTPUT_ERRORS
Expand Down
3 changes: 3 additions & 0 deletions sld-api-backend/config/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class Settings(BaseSettings):
BACKEND_USER: str = os.getenv("BACKEND_USER", "")
BACKEND_PASSWD: str = os.getenv("BACKEND_PASSWD", "")
BACKEND_SERVER: str = os.getenv("BACKEND_SERVER", "redis")
CACHE_USER: str = os.getenv("SLD_CACHE_USER", "")
CACHE_PASSWD: str = os.getenv("SLD_CACHE_PASSWD", "")
CACHE_SERVER: str = os.getenv("SLD_CACHE_SERVER", "redis")
# init user
INIT_USER: dict = {
"username": os.getenv("SLD_INIT_USER_NAME", "admin"),
Expand Down
2 changes: 1 addition & 1 deletion sld-api-backend/src/shared/helpers/get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from src.users.infrastructure import repositories as crud_users

r = redis.Redis(
host=settings.BACKEND_SERVER,
host=settings.CACHE_SERVER,
port=6379,
db=2,
charset="utf-8",
Expand Down
5 changes: 4 additions & 1 deletion sld-api-backend/src/worker/domain/services/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from src.worker.domain.services.provider import ProviderActions, ProviderGetVars, ProviderRequirements
import redis
from config.api import settings
import logging


r = redis.Redis(
host=settings.BACKEND_SERVER,
host=settings.CACHE_SERVER,
port=6379,
db=2,
charset="utf-8",
Expand Down Expand Up @@ -140,6 +141,8 @@ class Pipeline:
def __init__(self, params: DeployParams):
self.params = params
def locked_task(self):
logging.info(f"Checking if task {self.params.name}-{self.params.squad}-{self.params.environment} is locked in cache server {settings.CACHE_SERVER}")
logging.info(f"Locking task {self.params.name}-{self.params.squad}-{self.params.environment}")
r.set(f"{self.params.name}-{self.params.squad}-{self.params.environment}", "Locked")
r.expire(f"{self.params.name}-{self.params.squad}-{self.params.environment}", settings.TASK_LOCKED_EXPIRED)

Expand Down
2 changes: 1 addition & 1 deletion sld-api-backend/src/worker/tasks/terraform_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from src.worker.tasks.helpers.schedule import request_url

r = redis.Redis(
host=settings.BACKEND_SERVER,
host=settings.CACHE_SERVER,
port=6379,
db=2,
charset="utf-8",
Expand Down

0 comments on commit 3df74b2

Please sign in to comment.