Skip to content

Commit

Permalink
🐛fix: worker error not output
Browse files Browse the repository at this point in the history
  • Loading branch information
D10S0VSkY-OSS committed Nov 28, 2023
1 parent decad67 commit df47a5e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 35 deletions.
36 changes: 8 additions & 28 deletions play-with-sld/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: "3.7"

services:
# Mysql database
db:
hostname: db
image: mysql:latest
Expand All @@ -12,7 +11,6 @@ services:
restart: always
ports:
- 3306:3306
# command: --init-file init.sql
environment:
MYSQL_ROOT_PASSWORD: 123
MYSQL_DATABASE: restapi
Expand All @@ -31,17 +29,6 @@ services:
- 6379:6379


# RabbitMQ - queue
rabbit:
hostname: rabbit
image: rabbitmq:3.8-management
environment:
- RABBITMQ_DEFAULT_USER=admin
- RABBITMQ_DEFAULT_PASS=admin
ports:
- "5672:5672"
- "15672:15672" # here, we can access rabbitmq management plugin

mongodb:
image: mongo
hostname: mongodb
Expand All @@ -62,6 +49,7 @@ services:
environment:
SLD_STORAGE_BACKEND: mongodb
SLD_MONGODB_URL: "mongodb:27017/"
PATH: "/home/sld/.asdf/shims:/home/sld/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ports:
- "8080:8080"

Expand All @@ -78,18 +66,15 @@ services:
- redis
- remote-state
- worker
- rabbit


# Celery worker
worker:
image: d10s0vsky/sld-api:latest
entrypoint: ["celery", "--app", "src.worker.tasks.terraform_worker", "worker", "--loglevel=info", "-c", "8", "-E", "-Q", "any,squad,squad1,squad2"]
entrypoint: ["python", "-m", "celery", "--app", "src.worker.tasks.terraform_worker", "worker", "--loglevel=info", "-c", "8", "-E", "-Q", "any,squad,squad1,squad2"]
environment:
BROKER_USER: admin
BROKER_PASSWD: admin
PATH: "/home/sld/.asdf/shims:/home/sld/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
depends_on:
- rabbit
- redis
- db
- remote-state
Expand All @@ -98,19 +83,18 @@ services:
sld-dashboard:
image: d10s0vsky/sld-dashboard:latest
hostname: sld-dashboard
entrypoint: gunicorn --config gunicorn-cfg.py run:app
environment:
PATH: "/home/sld/.asdf/shims:/home/sld/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
entrypoint: python -m gunicorn --config gunicorn-cfg.py run:app
restart: always
env_file: ../../sld-dashboard/.env
ports:
- "5000:5000"
depends_on:
# - api-backend
- api-backend
- db
- redis
- remote-state
# - worker
- rabbit
#- schedule



Expand All @@ -124,14 +108,10 @@ services:
environment:
MYSQL_USER: adm
MYSQL_PASSWORD: 123
BROKER_USER: admin
BROKER_PASSWD: admin
PATH: "/home/sld/.asdf/shims:/home/sld/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
depends_on:
- db
- redis
- remote-state
- worker
- rabbit

volumes:
sld-db:
Expand Down
14 changes: 7 additions & 7 deletions play-with-sld/docker/play.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
check_docker () {
/usr/bin/which docker-compose >/dev/null
/usr/bin/which docker >/dev/null
if [ $? = 0 ];then
echo "docker-compse ok"
echo "docker compse ok"
else
echo "Docker Compose not installed"
echo "Run this command to download the current stable release of Docker Compose:"
Expand All @@ -22,20 +22,20 @@ check_docker () {
}


start_db_redis_rabbit() {
docker-compose up -d db redis rabbit mongodb
start_db_redis() {
docker compose up -d db redis mongodb
sleep 15
}


start_backend() {
docker-compose up -d --remove-orphan api-backend worker remote-state
docker compose up -d api-backend worker remote-state
sleep 10
}


start_frontend() {
docker-compose up -d --remove-orphan sld-dashboard schedule
docker compose up -d sld-dashboard schedule
}


Expand Down Expand Up @@ -80,7 +80,7 @@ start_init_credentials() {
case "$1" in

start) echo "Starting SLD for play"
start_db_redis_rabbit
start_db_redis
start_backend
start_frontend
;;
Expand Down
1 change: 1 addition & 0 deletions sld-api-backend/src/worker/providers/hashicorp/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Actions(StructBase):
project_path: str
task_id: str
subprocess_handler: command = command
output = ""

def execute_terraform_command(self, action: str) -> dict:
channel = self.task_id
Expand Down

0 comments on commit df47a5e

Please sign in to comment.