remove hostess tool + add extra_hosts entry to oncall backend containers

This commit is contained in:
Joey Orlando 2022-11-23 19:31:26 +01:00
parent 255964ceaf
commit 19e7fc4c00
No known key found for this signature in database
GPG key ID: 469E88366B17F644
2 changed files with 18 additions and 19 deletions

View file

@ -62,12 +62,6 @@ define run_engine_docker_command
endef
# touch SQLITE_DB_FILE if it does not exist and DB is eqaul to SQLITE_PROFILE
#
# hostess installation (crossplatform/idempotent modification of /etc/hosts file)
# see here (https://github.com/cbednarski/hostess#installation) for docs
# basically this is needed because oncall api has been configured locally to communicate w/ grafana @
# http://grafana:3000. This becomes a problem in certain parts of OnCall where we generate "public" URLs
# and the user tries to access them via their browser.
start:
ifeq ($(DB),$(SQLITE_PROFILE))
@if [ ! -f $(SQLITE_DB_FILE) ]; then \
@ -75,17 +69,6 @@ ifeq ($(DB),$(SQLITE_PROFILE))
fi
endif
@if [ ! -x "$$(command -v hostess)" ]; then \
echo "installing hostess"; \
git clone https://github.com/cbednarski/hostess "${HOME}/hostess"; \
cd "${HOME}/hostess"; \
make install; \
fi
@if ! hostess has grafana; then \
sudo hostess add grafana 127.0.0.1; \
fi
$(call run_docker_compose_command,up --remove-orphans -d)
init:
@ -168,4 +151,4 @@ backend-command:
$(call backend_command,$(CMD))
backend-manage-command:
$(call backend_command,python manage.py $(CMD))
$(call backend_command,python manage.py $(CMD))

View file

@ -20,7 +20,19 @@ x-env-files: &oncall-env-files
x-env-vars: &oncall-env-vars
BROKER_TYPE: ${BROKER_TYPE}
GRAFANA_API_URL: http://grafana:3000
GRAFANA_API_URL: http://localhost:3000
# basically this is needed because the oncall backend containers have been configured to communicate w/ grafana via
# http://localhost:3000 (GRAFANA_API_URL). This URL is used in two scenarios:
# 1. oncall backend -> grafana API communication (happens within docker)
# 2. accessing templated URLs generated by the oncall backend - meant to be accessed via a browser on your host machine
# The alternative is to set GRAFANA_API_URL to http://grafana:3000. However, this would only work in scenario #1
# as http://grafana:3000 would not be resolvable on the host machine (without modifying /etc/hosts)
#
# by adding this extra_host entry to the oncall backend containers any calls to localhost will get routed to the docker
# gateway, onto the host machine, where localhost:3000 points to grafana
x-extra-hosts: &oncall-extra-hosts
- "localhost:host-gateway"
services:
oncall_ui:
@ -49,6 +61,7 @@ services:
env_file: *oncall-env-files
environment: *oncall-env-vars
volumes: *oncall-volumes
extra_hosts: *oncall-extra-hosts
ports:
- "8080:8080"
depends_on:
@ -68,6 +81,7 @@ services:
env_file: *oncall-env-files
environment: *oncall-env-vars
volumes: *oncall-volumes
extra_hosts: *oncall-extra-hosts
profiles:
# no need to start this except from within the Makefile
- _engine_commands
@ -81,6 +95,7 @@ services:
env_file: *oncall-env-files
environment: *oncall-env-vars
volumes: *oncall-volumes
extra_hosts: *oncall-extra-hosts
depends_on:
oncall_db_migration:
condition: service_completed_successfully
@ -95,6 +110,7 @@ services:
env_file: *oncall-env-files
environment: *oncall-env-vars
volumes: *oncall-volumes
extra_hosts: *oncall-extra-hosts
depends_on:
postgres:
condition: service_healthy