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(postgres): Create a docker file to bring nwaku + PostgreSQL simultaneously. #1840

Closed
2 tasks
Tracked by #1888
Ivansete-status opened this issue Jul 5, 2023 · 8 comments
Closed
2 tasks
Tracked by #1888
Assignees
Labels
E:PostgreSQL See https://github.com/waku-org/pm/issues/84 for details good first issue Good for newcomers

Comments

@Ivansete-status
Copy link
Collaborator

Background

Create a Docker Compose file that allows starting a Docker container with nwaku and the "store" protocol mounted plus another Docker container Postgres container.

Details

To create the nwaku container, the next can be used as a reference:

version: '3.7'
services:
  node:
    container_name: 'nim-waku-v2'
    image: 'statusteam/nim-waku:deploy-wakuv2-test'
    labels:
      # auto-updating of docker image
      com.centurylinklabs.watchtower.enable: 'true'
    deploy:
      resources:
        limits:
          cpus: '0.7'
          memory: '1383M'
        reservations:
          memory: '395M'
      restart_policy:
        condition: 'any'
    ports:
      - '127.0.0.1:8545:8545/tcp'
      - '30303:30303/tcp'
      - '30303:30303/udp'
      - '8008:8008/tcp'
      - '8000:8000/tcp'
      - '9000:9000/udp'
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8008/health"]
      interval: 30s
      retries: 3
    command: |
      --relay=true
      --store=true
      --filter=true
      --lightpush=true
      --rln-relay=true
      --peer-exchange=true
      --rpc-admin=true
      --peer-persistence=false
      --keep-alive=true
      --max-connections=300
      --topic='/waku/2/default-waku/proto'
      --topic='/waku/2/dev-waku/proto'
      --store-message-db-url='postgres://postgres:test123@localhost:5432/postgres'
      --store-message-retention-policy=time:2592000
      --discv5-discovery=true
      --discv5-udp-port=9000
      --discv5-enr-auto-update=False
      --nodekey=d4735222265e16eee03f59718b9b5d03019c07d8b6c51f90da3a666eec13ab35
      --log-level=DEBUG
      --rpc-port=8545
      --rpc-address=0.0.0.0
      --tcp-port=30303
      --metrics-server=True
      --metrics-server-port=8008
      --metrics-server-address=0.0.0.0
  • Where the nodekey=d4735222265e16eee03f59718b9b5d03019c07d8b6c51f90da3a666eec13ab35 should ideally be a random value each time the docker compose -f ... up is called.

  • I'm not sure if some tweaks will be required re localhost in --store-message-db-url='postgres://postgres:test123@localhost:5432/postgres'

To create the Postgres container, the next docker compose can be used as a reference:

version: "3.8"

services:
  db:
    image: postgres:9.6-alpine
    restart: always
    environment:
      POSTGRES_PASSWORD: test123
    ports:
      - "5432:5432"

Acceptance Criteria

The nwaku node should be able to act as a "store" node and be able to store/retrieve messages from the Postgres database.

Post actions

Related issue

#1604

@Ivansete-status Ivansete-status changed the title chore: Create a docker file to bring nwaku + PostgreSQL simultaneously. chore(postgres): Create a docker file to bring nwaku + PostgreSQL simultaneously. Jul 5, 2023
@alrevuelta
Copy link
Contributor

plan to migrate this https://github.com/alrevuelta/nwaku-compose to waku-org
Can we have as part of that repo?

@Ivansete-status
Copy link
Collaborator Author

plan to migrate this https://github.com/alrevuelta/nwaku-compose to waku-org Can we have as part of that repo?

Morning Álvaro! I think that's a great idea :)

@fryorcraken
Copy link
Collaborator

fryorcraken commented Jul 27, 2023

Grafana as part of the docker compose like I have seen previously would be good.
I wonder if Grafana can also provide some insights to Posgres? Thing like Watermark, db sidze for example (I'm not a DB Expert)

@Ivansete-status
Copy link
Collaborator Author

Grafana as part of the docker compose like I have seen previously would be good. I wonder if Grafana can also provide some insights to Posgres? Thing like Watermark, db sidze for example (I'm not a DB Expert)

I don't know but I will explore it if is feasible :)

@vpavlin
Copy link
Member

vpavlin commented Jul 27, 2023

You'll probably need to use postgres-exporter (https://github.com/prometheus-community/postgres_exporter) for Prometheus as it does not seem Postgres itself can expose the metrics directly, but it should be relatively straightforward to add it to the compose

https://grafana.com/oss/prometheus/exporters/postgres-exporter/?tab=installation

@vpavlin vpavlin added this to the Release 0.19.0 milestone Aug 1, 2023
@Ivansete-status
Copy link
Collaborator Author

I submitted this PR but I cannot assign reviewers.

https://github.com/alrevuelta/nwaku-compose/pull/3

@alrevuelta - I wonder if we could move this repo to the waku-org to enhance that.

If not possible, I'd like to add you, @vpavlin, and @LordGhostX as reviewers :)

Thanks in advance!

@Ivansete-status Ivansete-status mentioned this issue Aug 7, 2023
8 tasks
@Ivansete-status
Copy link
Collaborator Author

Morning @LordGhostX !

We've completed the creation of a docker compose file that runs both nwaku and a postgres instance. This might need to be updated in the https://docs.waku.org/ portal.

Cheers!

@vpavlin
Copy link
Member

vpavlin commented Aug 15, 2023

This has been finished as part of https://github.com/waku-org/nwaku-compose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E:PostgreSQL See https://github.com/waku-org/pm/issues/84 for details good first issue Good for newcomers
Projects
Archived in project
Development

No branches or pull requests

4 participants