Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: added docker support for osx #6696

Merged
merged 5 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
build: docker/grafana
restart: always
ports:
- "3000:3000"
- "127.0.0.1:3000:3000"
jeluard marked this conversation as resolved.
Show resolved Hide resolved
volumes:
- "grafana:/var/lib/grafana"
- "grafana-dashboards:/dashboards"
Expand Down
20 changes: 11 additions & 9 deletions docker/docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,30 @@ services:
build:
context: prometheus
environment:
# Linux: http://localhost:8008
# MacOSX: http://host.docker.internal:8008
BEACON_URL: localhost:8008
VC_URL: localhost:5064
BEACON_URL: host.docker.internal:8008
VC_URL: host.docker.internal:5064
restart: always
network_mode: host
volumes:
- "prometheus:/prometheus"
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "127.0.0.1:9090:9090"

grafana:
build:
context: ..
dockerfile: docker/grafana
restart: always
network_mode: host
volumes:
- "grafana:/var/lib/grafana"
- "grafana-dashboards:/dashboards"
environment:
# Linux: http://localhost:9090
# MacOSX: http://host.docker.internal:9090
PROMETHEUS_URL: http://localhost:9090
PROMETHEUS_URL: http://host.docker.internal:9090
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "127.0.0.1:3000:3000"

volumes:
prometheus:
Expand Down
20 changes: 11 additions & 9 deletions docker/docker-compose.local_dev.yml
jeluard marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,28 @@ services:
build:
context: prometheus
environment:
# Linux: http://localhost:8008
# MacOSX: http://host.docker.internal:8008
BEACON_URL: localhost:8008
VC_URL: localhost:5064
BEACON_URL: host.docker.internal:8008
VC_URL: host.docker.internal:5064
restart: always
network_mode: host
volumes:
- "prometheus:/prometheus"
extra_hosts:
- "host.docker.internal:host-gateway"
jeluard marked this conversation as resolved.
Show resolved Hide resolved
ports:
- "127.0.0.1:9090:9090"

grafana:
build: grafana_dev
restart: always
network_mode: host
volumes:
- "grafana:/var/lib/grafana"
- "grafana-dashboards:/dashboards"
environment:
# Linux: http://localhost:9090
# MacOSX: http://host.docker.internal:9090
PROMETHEUS_URL: http://localhost:9090
PROMETHEUS_URL: http://host.docker.internal:9090
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "127.0.0.1:3000:3000"

volumes:
prometheus:
Expand Down
3 changes: 1 addition & 2 deletions docker/grafana/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ VOLUME /dashboards
ENV GF_SECURITY_ADMIN_USER=admin
ENV GF_SECURITY_ADMIN_PASSWORD=admin

# Modified datasource to work with a network_mode: host
ENV PROMETHEUS_URL=http://prometheus:9090
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to override those here? Might be better to just do it in the compose file where extra_hosts is set

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear to me why it was done like that in the first place. Maybe there are other ways those Dockerfile are used?
To reduce potential for regression I'd rather keep this PR focused on adding OSX support and not introduce other refactoring.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there are other ways those Dockerfile are used?

Yes, we publish those to docker hub, users might rely on host being set to prometheus here

ENV PROMETHEUS_URL=http://host.docker.internal:9090
ENV DASHBOARDS_DIR=/dashboards

CMD [ \
Expand Down
3 changes: 1 addition & 2 deletions docker/grafana_dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ COPY dashboards /dashboards/
ENV GF_SECURITY_ADMIN_USER=admin
ENV GF_SECURITY_ADMIN_PASSWORD=admin

# Modified datasource to work with a network_mode: host
ENV PROMETHEUS_URL=http://prometheus:9090
ENV PROMETHEUS_URL=host.docker.internal:9090
ENV DASHBOARDS_DIR=/dashboards

CMD [ \
Expand Down
8 changes: 2 additions & 6 deletions docker/prometheus/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ COPY prometheus.yml /etc/prometheus/prometheus.yml
COPY --chown=nobody:nobody entrypoint.sh /etc/prometheus/entrypoint.sh
RUN chmod +x /etc/prometheus/entrypoint.sh

# Modified datasource to work with a network_mode: host
# Docker DNS: "beacon_node:8008"
# net host: "localhost:8008"
# MacOSX: "host.docker.internal:8008"
ENV BEACON_URL='beacon_node:8008'
ENV VC_URL='validator:5064'
ENV BEACON_URL='host.docker.internal:8008'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, might be sufficient to override in compose files

ENV VC_URL='host.docker.internal:5064'
VOLUME /prometheus

ENTRYPOINT ["/etc/prometheus/entrypoint.sh"]
Expand Down
Loading