diff --git a/.gitignore b/.gitignore index a68b3d1..d00675a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ packer/variables.json *.retry **/roles/jdauphantnginx/* jdauphant.nginx +docker/.env diff --git a/src/.env.example b/docker/.env.example similarity index 100% rename from src/.env.example rename to docker/.env.example diff --git a/src/docker-compose.override.yml b/docker/docker-compose.override.yml similarity index 84% rename from src/docker-compose.override.yml rename to docker/docker-compose.override.yml index 79c5fa1..743529d 100644 --- a/src/docker-compose.override.yml +++ b/docker/docker-compose.override.yml @@ -10,33 +10,30 @@ services: ui: container_name: ui - build: ./ui image: ${USERNAME:-baykanurov}/ui:${UI_IMAGE_TAG:-1.0} command: ["puma", "--debug", "-w 2"] ports: - ${UI_PORT:-9292}:9292/tcp volumes: - - ./ui:/app:consistent + - ../src/ui:/app:consistent networks: - front_net post: container_name: post - build: ./post-py image: ${USERNAME:-baykanurov}/post:${POST_IMAGE_TAG:-1.0} volumes: - - ./post-py:/app:consistent + - ../src/post-py:/app:consistent networks: - back_net - front_net comment: container_name: comment - build: ./comment image: ${USERNAME:-baykanurov}/comment:${COMMENT_IMAGE_TAG:-1.0} command: ["puma", "--debug", "-w 2"] volumes: - - ./comment:/app:consistent + - ../src/comment:/app:consistent networks: - back_net - front_net diff --git a/src/docker-compose.yml b/docker/docker-compose.yml similarity index 66% rename from src/docker-compose.yml rename to docker/docker-compose.yml index a4f44fc..bdc5c89 100644 --- a/src/docker-compose.yml +++ b/docker/docker-compose.yml @@ -7,11 +7,9 @@ services: - post_db:/data/db networks: - back_net - - front_net ui: container_name: ui - build: ./ui image: ${USERNAME}/ui:${UI_IMAGE_TAG} ports: - ${UI_PORT}:9292/tcp @@ -20,7 +18,6 @@ services: post: container_name: post - build: ./post-py image: ${USERNAME}/post:${POST_IMAGE_TAG} networks: - back_net @@ -28,14 +25,28 @@ services: comment: container_name: comment - build: ./comment image: ${USERNAME}/comment:${COMMENT_IMAGE_TAG} networks: - back_net - front_net + prometheus: + image: ${USERNAME}/prometheus + ports: + - '9090:9090' + volumes: + - prometheus_data:/prometheus + command: + - '--config.file=/etc/prometheus/prometheus.yml' + - '--storage.tsdb.path=/prometheus' + - '--storage.tsdb.retention=1d' + networks: + - back_net + - front_net + volumes: post_db: + prometheus_data: networks: back_net: diff --git a/docker-monolith/Dockerfile b/docker/docker-monolith/Dockerfile similarity index 100% rename from docker-monolith/Dockerfile rename to docker/docker-monolith/Dockerfile diff --git a/docker-monolith/db_config b/docker/docker-monolith/db_config similarity index 100% rename from docker-monolith/db_config rename to docker/docker-monolith/db_config diff --git a/docker-monolith/docker-1.log b/docker/docker-monolith/docker-1.log similarity index 100% rename from docker-monolith/docker-1.log rename to docker/docker-monolith/docker-1.log diff --git a/docker-monolith/mongod.conf b/docker/docker-monolith/mongod.conf similarity index 100% rename from docker-monolith/mongod.conf rename to docker/docker-monolith/mongod.conf diff --git a/docker-monolith/start.sh b/docker/docker-monolith/start.sh similarity index 100% rename from docker-monolith/start.sh rename to docker/docker-monolith/start.sh diff --git a/monitoring/prometheus/Dockerfile b/monitoring/prometheus/Dockerfile new file mode 100644 index 0000000..22c9319 --- /dev/null +++ b/monitoring/prometheus/Dockerfile @@ -0,0 +1,2 @@ +FROM prom/prometheus:v2.1.0 +ADD prometheus.yml /etc/prometheus/ diff --git a/monitoring/prometheus/prometheus.yml b/monitoring/prometheus/prometheus.yml new file mode 100644 index 0000000..6c6d878 --- /dev/null +++ b/monitoring/prometheus/prometheus.yml @@ -0,0 +1,19 @@ +--- +global: + scrape_interval: '5s' + +scrape_configs: + - job_name: 'prometheus' + static_configs: + - targets: + - 'localhost:9090' + + - job_name: 'ui' + static_configs: + - targets: + - 'ui:9292' + + - job_name: 'comment' + static_configs: + - targets: + - 'comment:9292' diff --git a/src/.gitignore b/src/.gitignore index 5f651ab..5052201 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,6 +1,5 @@ build_info.txt prometheus/ -.env ## python specific *.pyc