Skip to content
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,6 @@ cython_debug/
.pypirc
terraform/yandex_cloud/key.json
terraform/yandex_cloud/terraform.rc
ansible/roles/web_app/vars/main.yml
ansible/ansible.builtin.env
terraform/yandex_cloud/authorized_key.json
Empty file.
2 changes: 1 addition & 1 deletion app_go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ USER $ADMIN_USER
RUN go build -o randomizer main.go

# Explicitly specify port
EXPOSE 3000
EXPOSE 5500

CMD ["./randomizer"]
2 changes: 1 addition & 1 deletion app_go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

var tpl = template.Must(template.ParseFiles("static/index.html"))

const PORT = "3000"
const PORT = "5500"

func indexHandler(w http.ResponseWriter, r *http.Request) {
// Handler calls template to show index.html
Expand Down
Binary file added app_go/randomizer
Binary file not shown.
2 changes: 1 addition & 1 deletion app_python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ RUN adduser --system $ADMIN_USER
USER $ADMIN_USER

# Explicitly specify port
EXPOSE 5000
EXPOSE 5005

CMD ["python", "moscow_app.py"]
4 changes: 3 additions & 1 deletion app_python/moscow_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

app = Flask(__name__)
MOSCOW = timezone(timedelta(hours=3), "Moscow")
HOST = "0.0.0.0"
PORT = 5005

@app.route("/")
def index():
Expand All @@ -21,4 +23,4 @@ def index():


if __name__ == "__main__":
app.run()
app.run(HOST, PORT)
65 changes: 65 additions & 0 deletions monitoring/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
version: "3.3"

networks:
loki:

services:
loki:
image: grafana/loki:latest
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml
networks:
- loki

promtail:
image: grafana/promtail:latest
volumes:
- /var/log:/var/log
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/containers:/var/lib/docker/containers
- ./promtail.yml:/etc/promtail/config.yml
command: -config.file=/etc/promtail/config.yml
networks:
- loki

grafana:
environment:
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_FEATURE_TOGGLES_ENABLE=alertingSimplifiedRouting,alertingQueryAndExpressionsStepMode
entrypoint:
- sh
- -euc
- |
mkdir -p /etc/grafana/provisioning/datasources
cat <<EOF > /etc/grafana/provisioning/datasources/ds.yaml
apiVersion: 1
datasources:
- name: Loki
type: loki
access: proxy
orgId: 1
url: http://loki:3100
basicAuth: false
isDefault: true
version: 1
editable: false
EOF
/run.sh
image: grafana/grafana:latest
ports:
- "3000:3000"
networks:
- loki
moscow_time:
image: tjann7/moscow_time:latest
ports:
- "5005:5005"
logging:
driver: "json-file"
go_random:
image: tjann7/go_random:latest
ports:
- "5500:5500"
15 changes: 15 additions & 0 deletions monitoring/promtail.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
client:
url: http://loki:3100/api/v1/push
scrape_configs:
- job_name: logging_both_dockersW
static_configs:
- targets:
- localhost
labels:
job: docker
__path__: /var/lib/docker/containers/*/*log # For linux only