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

Use nginx to expose graphql endpoints #37

Open
2 tasks
piotr-iohk opened this issue Sep 11, 2023 · 0 comments
Open
2 tasks

Use nginx to expose graphql endpoints #37

piotr-iohk opened this issue Sep 11, 2023 · 0 comments

Comments

@piotr-iohk
Copy link
Contributor

piotr-iohk commented Sep 11, 2023

Problem

Currently mina daemons in minimina local network use network_mode: host which may be a problem when running multiple networks at the same time as ports may collide between networks. Also exposing ports with ports: [<port>:<port>] may also be problematic because we would need additional logic for handling ports such that they don't interfere on host network.

Minimina does not use network_mode: host any longer however it exposes graphql ports which may interfere when there are networks spinned next to each other therefore the original problem still requires addressing.

Possible way to workaround is to employ nginx reverse proxy to expose graphql endpoints. This way ports handling would live inside private docker network and we can expose graphql like http://localhost/<network-id>/<node-id>/graphql

Acceptance Criteria

  • use nginx to expose graphql endpoints

Example configuration

docker-compose.yaml:

version: '3.8'
x-defaults: &default-attributes
    volumes:
    - /home/piotr/.minimina/default:/local-network
    - config-directory:/config-directory
    environment:
      MINA_PRIVKEY_PASS: naughty blue worm
      MINA_LIBP2P_PASS: naughty blue worm
volumes:
  config-directory: 
services:
  nginx-default:
    image: nginx:latest
    container_name: nginx-default
    ports:
      - "80:80"
    volumes:
      - /home/piotr/.minimina/default/nginx.conf:/etc/nginx/conf.d/default.conf
 ...
  default-mina-seed-1:
    <<: *default-attributes
    container_name: default-mina-seed-1-default
    image: gcr.io/o1labs-192920/mina-daemon:2.0.0rampup3-bfd1009-buster-berkeley
    command: daemon -client-port 3100 -rest-port 3101 -insecure-rest-server -external-port 3102 -metrics-port 3103 -libp2p-metrics-port 3104 -config-file /local-network/genesis_ledger.json -log-json -log-level Trace -file-log-level Trace -config-directory /config-directory/default-mina-seed-1 -seed -libp2p-keypair CAESQFuurFp97v5EFRki4m+FLdwy+I/A4THZecDvKC5c0T2B7FniWMndQhph9T3B08cwXBcgQnqXHG7jhb923qQSSW4=,CAESIOxZ4ljJ3UIaYfU9wdPHMFwXIEJ6lxxu44W/dt6kEklu,12D3KooWRiysxsjGpkGo5PhZbLLQZtteEmwM5nGKgtCxrms6K6bf
    entrypoint:
    - mina

nginx.conf:

server {
    listen 80;

    location /default/seed/graphql {
        proxy_pass http://default-mina-seed-1-default:3101/graphql;
    }

   # other services
  
}

Graphql ep: http://localhost/default/seed/graphql

Tasks

  • Add and configure nginx service when creating network
  • expose graphql endpoints through nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant