Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Credentials #38

Merged
merged 3 commits into from
Aug 15, 2023
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
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ endif
# Turn project on
.PHONY:up
up:docker/docker-compose.yaml
$(DOCKER_COMPOSE) compose --file $(DOCKER_COMPOSE_YAML) up -d
$(DOCKER_COMPOSE) compose --profile standalone --file $(DOCKER_COMPOSE_YAML) up -d

# Rebuild all containers and turn project on
.PHONY:up-rebuild
up-rebuild:$(DOCKER_COMPOSE_YAML)
$(DOCKER_COMPOSE) compose --file $(DOCKER_COMPOSE_YAML) up --build -d
$(DOCKER_COMPOSE) compose --profile standalone --file $(DOCKER_COMPOSE_YAML) up --build -d

# Rebuild the docker image from scratch
.PHONY:up-rebuild
.PHONY:force-rebuild
force-rebuild:$(DOCKER_COMPOSE_YAML)
$(DOCKER_COMPOSE) compose --file $(DOCKER_COMPOSE_YAML) build --no-cache

# Turn project off
.PHONY:down
down:$(DOCKER_COMPOSE_YAML)
$(DOCKER_COMPOSE) compose --file $(DOCKER_COMPOSE_YAML) down
$(DOCKER_COMPOSE) compose --profile standalone --file $(DOCKER_COMPOSE_YAML) down

# Restart project
.PHONY:restart
Expand Down
4 changes: 3 additions & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ services:
depends_on:
- redis
- api
- rabbitmq
networks:
- data-api
- pyciemss
rabbitmq:
container_name: rabbitmq
profiles: ["standalone"]
hostname: rabbitmq
image: 'rabbitmq:3'
healthcheck:
Expand All @@ -57,10 +57,12 @@ services:
retries: 5
ports:
- "5672:5672"
- "15672:15672"
networks:
- pyciemss
rabbitmq-mock-consumer:
container_name: rabbitmq-mock-consumer
profiles: ["standalone"]
build:
context: ..
dockerfile: docker/Dockerfile.api
Expand Down
2 changes: 2 additions & 0 deletions env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ REDIS_HOST=redis
REDIS_PORT=6379
RABBITMQ_HOST=rabbitmq.pyciemss
RABBITMQ_PORT=5672
RABBITMQ_USERNAME=guest
RABBITMQ_PASSWORD=guest
2 changes: 2 additions & 0 deletions service/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Settings(BaseSettings):
REDIS_PORT: int = 6379
RABBITMQ_HOST: str = "rabbitmq.pyciemss"
RABBITMQ_PORT: int = 5672
RABBITMQ_USERNAME: str = "guest"
RABBITMQ_PASSWORD: str = "guest"


settings = Settings()
7 changes: 5 additions & 2 deletions service/utils/rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

from settings import settings

creds = pika.PlainCredentials(settings.RABBITMQ_USERNAME, settings.RABBITMQ_PASSWORD)
conn_config = pika.ConnectionParameters(
host=settings.RABBITMQ_HOST, port=settings.RABBITMQ_PORT
host=settings.RABBITMQ_HOST, port=settings.RABBITMQ_PORT, credentials=creds
)


Expand All @@ -33,7 +34,9 @@ def callback(ch, method, properties, body):


def gen_rabbitmq_hook(job_id):
connection = pika.BlockingConnection(conn_config)
connection = pika.BlockingConnection(
conn_config,
)
channel = connection.channel()

def hook(progress):
Expand Down