From 8680c3a85c56c8a685923041319a29443288cffe Mon Sep 17 00:00:00 2001 From: Andrey Ivanov Date: Thu, 3 Dec 2020 09:01:52 -0500 Subject: [PATCH] HW15 WIP --- hw12_13_14_15_calendar/Makefile | 7 ++++++- hw12_13_14_15_calendar/cicd/calendar/Dockerfile | 2 +- hw12_13_14_15_calendar/cicd/docker-compose.yml | 6 +++--- hw12_13_14_15_calendar/cicd/scheduler/Dockerfile | 2 +- hw12_13_14_15_calendar/cicd/sender/Dockerfile | 2 +- hw12_13_14_15_calendar/configs/calendar.conf | 2 +- hw12_13_14_15_calendar/configs/scheduler.conf | 2 +- hw12_13_14_15_calendar/configs/sender.conf | 2 +- .../{20200924000000_init.sql => 20201203000000_init.sql} | 0 9 files changed, 15 insertions(+), 10 deletions(-) rename hw12_13_14_15_calendar/migrations/{20200924000000_init.sql => 20201203000000_init.sql} (100%) diff --git a/hw12_13_14_15_calendar/Makefile b/hw12_13_14_15_calendar/Makefile index a5cfb81..bdc5ae9 100644 --- a/hw12_13_14_15_calendar/Makefile +++ b/hw12_13_14_15_calendar/Makefile @@ -31,9 +31,14 @@ compose-build: up: sudo -S docker-compose -f ./cicd/docker-compose.yml up -d --build -down: +down: shutdown clean + +shutdown: sudo -S docker-compose -f ./cicd/docker-compose.yml down +clean: + sudo docker rmi $(sudo docker images | grep '' | awk '{print $3}') + calendar-start: nohup ./bin/calendar -config ./configs/calendar.conf > /dev/null 2>&1 & calendar-stop: diff --git a/hw12_13_14_15_calendar/cicd/calendar/Dockerfile b/hw12_13_14_15_calendar/cicd/calendar/Dockerfile index 1c4afea..7bed24d 100644 --- a/hw12_13_14_15_calendar/cicd/calendar/Dockerfile +++ b/hw12_13_14_15_calendar/cicd/calendar/Dockerfile @@ -12,7 +12,7 @@ ENV APP_HTTP_ADDRESS=0.0.0.0 ENV APP_HTTP_PORT=8888 ENV APP_API_ADDRESS=0.0.0.0 ENV APP_API_PORT=50053 -ENV APP_LOGGER_FILE=/calendar.log +ENV APP_LOGGER_FILE=/logs/calendar.log ENV APP_LOGGER_LEVEL=INFO ENV APP_STORAGE_INMEMORY=false ENV APP_STORAGE_SQLHOST=psql diff --git a/hw12_13_14_15_calendar/cicd/docker-compose.yml b/hw12_13_14_15_calendar/cicd/docker-compose.yml index 924ba16..7dc2b00 100644 --- a/hw12_13_14_15_calendar/cicd/docker-compose.yml +++ b/hw12_13_14_15_calendar/cicd/docker-compose.yml @@ -5,7 +5,7 @@ services: context: .. dockerfile: ./cicd/calendar/Dockerfile volumes: - - ../calendar.log:/calendar.log + - ../logs:/logs ports: - "8888:8888" - "50051:50051" @@ -23,7 +23,7 @@ services: context: .. dockerfile: ./cicd/scheduler/Dockerfile volumes: - - ../calendar.log:/calendar.log + - ../logs:/logs depends_on: - rabbitmq - calendar @@ -34,7 +34,7 @@ services: context: .. dockerfile: ./cicd/sender/Dockerfile volumes: - - ../calendar.log:/calendar.log + - ../logs:/logs depends_on: - rabbitmq restart: on-failure diff --git a/hw12_13_14_15_calendar/cicd/scheduler/Dockerfile b/hw12_13_14_15_calendar/cicd/scheduler/Dockerfile index 170b415..c5366c9 100644 --- a/hw12_13_14_15_calendar/cicd/scheduler/Dockerfile +++ b/hw12_13_14_15_calendar/cicd/scheduler/Dockerfile @@ -15,7 +15,7 @@ ENV APP_RABBITMQ_QUEUE=notifications ENV APP_RABBITMQ_KEY=events ENV APP_API_ADDRESS=calendar ENV APP_API_PORT=50053 -ENV APP_LOGGER_FILE=/calendar.log +ENV APP_LOGGER_FILE=/logs/calendar.log ENV APP_LOGGER_LEVEL=INFO WORKDIR / COPY --from=builder /app/scheduler ./sbin diff --git a/hw12_13_14_15_calendar/cicd/sender/Dockerfile b/hw12_13_14_15_calendar/cicd/sender/Dockerfile index 4b8cb5d..fa9d145 100644 --- a/hw12_13_14_15_calendar/cicd/sender/Dockerfile +++ b/hw12_13_14_15_calendar/cicd/sender/Dockerfile @@ -13,7 +13,7 @@ ENV APP_RABBITMQ_PASS=rabbit ENV APP_RABBITMQ_EXCHANGE=calendar ENV APP_RABBITMQ_QUEUE=notifications ENV APP_RABBITMQ_KEY=events -ENV APP_LOGGER_FILE=/calendar.log +ENV APP_LOGGER_FILE=/logs/calendar.log ENV APP_LOGGER_LEVEL=INFO WORKDIR / COPY --from=builder /app/sender ./sbin diff --git a/hw12_13_14_15_calendar/configs/calendar.conf b/hw12_13_14_15_calendar/configs/calendar.conf index e787d79..3518edc 100644 --- a/hw12_13_14_15_calendar/configs/calendar.conf +++ b/hw12_13_14_15_calendar/configs/calendar.conf @@ -11,7 +11,7 @@ Address = "localhost" Port = "50053" [Logger] -File = "./calendar.log" +File = "./logs/calendar.log" Level = "INFO" [Storage] diff --git a/hw12_13_14_15_calendar/configs/scheduler.conf b/hw12_13_14_15_calendar/configs/scheduler.conf index 2ea7915..da6ef69 100644 --- a/hw12_13_14_15_calendar/configs/scheduler.conf +++ b/hw12_13_14_15_calendar/configs/scheduler.conf @@ -8,7 +8,7 @@ Queue = "notifications" Key = "events" [Logger] -File = "./calendar.log" +File = "./logs/calendar.log" Level = "INFO" [API] diff --git a/hw12_13_14_15_calendar/configs/sender.conf b/hw12_13_14_15_calendar/configs/sender.conf index cbfd27d..2e6ebcc 100644 --- a/hw12_13_14_15_calendar/configs/sender.conf +++ b/hw12_13_14_15_calendar/configs/sender.conf @@ -8,5 +8,5 @@ Queue = "notifications" Key = "events" [Logger] -File = "./calendar.log" +File = "./logs/calendar.log" Level = "INFO" \ No newline at end of file diff --git a/hw12_13_14_15_calendar/migrations/20200924000000_init.sql b/hw12_13_14_15_calendar/migrations/20201203000000_init.sql similarity index 100% rename from hw12_13_14_15_calendar/migrations/20200924000000_init.sql rename to hw12_13_14_15_calendar/migrations/20201203000000_init.sql