From c91b07b96a1f412dcdb9b2a48e6e57b2b126224d Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Thu, 3 Oct 2024 21:57:59 +0200 Subject: [PATCH] fix: run yamlfix This reverts commit 779f73765b4a16e63c0f4c30ac139ee38e0e06fc. --- .github/dependabot.yml | 2 ++ .github/workflows/build.yml | 8 ++++++++ .github/workflows/code-quality.yml | 8 ++++++++ .github/workflows/nix-ci.yml | 7 +++++++ .github/workflows/pytest.yml | 12 ++++++++++++ .github/workflows/test-keygen.yml | 10 ++++++++++ .readthedocs.yml | 5 +++++ deployment/docker-build/config.yml | 17 +++++++++++++++++ deployment/docker-build/docker-compose.yml | 12 ++++++++++++ .../samples/docker-compose/docker-compose.yml | 12 ++++++++++++ .../samples/docker-compose/sample-config.yml | 16 ++++++++++++++++ .../docker-monitoring/docker-compose.yml | 16 ++++++++++++++++ .../docker-monitoring/grafana/dashboard.yaml | 2 ++ .../docker-monitoring/grafana/prometheus.yaml | 2 ++ .../samples/docker-monitoring/prometheus.yml | 2 ++ .../samples/docker-monitoring/sample-config.yml | 14 ++++++++++++++ 16 files changed, 145 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 44cdb3cf..a92237aa 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,7 @@ --- version: 2 + + updates: - package-ecosystem: "pip" directory: "/" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d425ece..a9779f14 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,7 @@ --- name: Build + + on: push: branches: @@ -8,21 +10,27 @@ on: pull_request: branches: - "*" + + jobs: build: runs-on: ubuntu-22.04 steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 + - name: Log in to registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Download Docker cache image (if available) run: docker pull ghcr.io/$GITHUB_REPOSITORY/build-cache || true + - name: Build the Docker image run: | git fetch --prune --unshallow --tags docker build . -t pyaleph-node:${GITHUB_REF##*/} -f deployment/docker-build/pyaleph.dockerfile --cache-from=ghcr.io/$GITHUB_REPOSITORY/build-cache + - name: Push the image to the cache # It's not possible to push packages from fork PRs. if: github.ref == 'refs/heads/main' || github.event.pull_request.head.repo.full_name diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 3034407d..142daa31 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -1,18 +1,25 @@ --- name: Test code quality + + on: push: branches: - "*" + + jobs: code-quality: runs-on: ubuntu-22.04 + steps: - uses: actions/checkout@v4 + - name: Install pip and hatch run: | sudo apt-get install -y python3-pip pip3 install hatch hatch-vcs + - name: Cache dependencies uses: actions/cache@v4 with: @@ -20,5 +27,6 @@ jobs: key: ${{ runner.os }}-code-quality-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-code-quality-${{ hashFiles('pyproject.toml') }} + - name: Run Hatch lint run: hatch run linting:all diff --git a/.github/workflows/nix-ci.yml b/.github/workflows/nix-ci.yml index e187b172..b3b98c30 100644 --- a/.github/workflows/nix-ci.yml +++ b/.github/workflows/nix-ci.yml @@ -1,24 +1,31 @@ --- name: Test nix-shell + + on: push: branches: - 'doesnt_exist' + + jobs: nix-shell: strategy: matrix: os: [macos-latest, ubuntu-latest] runs-on: ${{ matrix.os }} + steps: - uses: actions/checkout@v4 with: # Fetch the whole history for all tags and branches (required for aleph.__version__) fetch-depth: 0 + - name: Set up Nix uses: cachix/install-nix-action@v27 with: # Use channel nixos-23.11 for Linux and nixpkgs-23.11-darwin for macOS nix_path: nixpkgs=channel:${{ matrix.os == 'macos-latest' && 'nixpkgs-24.05-darwin' || 'nixos-24.05' }} + - name: Run tests run: nix-shell --run "hatch run testing:test -- ./src/ ./test/" diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index a7a15f5d..0ee77eee 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,5 +1,7 @@ --- name: Test/Coverage with Python + + on: push: branches: @@ -8,6 +10,8 @@ on: pull_request: branches: - "*" + + jobs: tests: runs-on: ubuntu-22.04 @@ -24,24 +28,29 @@ jobs: image: redis:7.0.10 ports: - 127.0.0.1:6379:6379 + steps: - uses: actions/checkout@v4 with: # Fetch the whole history for all tags and branches (required for aleph.__version__) fetch-depth: 0 + - name: Set up Python 3.12 id: setup-python uses: actions/setup-python@v2 with: python-version: 3.12 + - name: Install latest Rust nightly toolchain uses: actions-rs/toolchain@v1 with: toolchain: nightly override: true + - name: Set rust to nightly run: | rustup default nightly # Required to build some dependencies + - name: Cache dependencies uses: actions/cache@v4 with: @@ -55,14 +64,17 @@ jobs: sudo apt-get install -y libpq-dev libsodium-dev libgmp-dev - run: | pip install hatch coverage + - run: | sudo cp .github/openssl-ci.cnf /etc/ssl/openssl.cnf export OPENSSL_CONF=/etc/ssl/openssl.cnf touch config.yml # Fake config file for alembic # TODO: determine why ResourceWarning warnings occur in some tests. hatch run testing:test + - run: | hatch run testing:cov + - uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/test-keygen.yml b/.github/workflows/test-keygen.yml index 9857402e..3879297a 100644 --- a/.github/workflows/test-keygen.yml +++ b/.github/workflows/test-keygen.yml @@ -1,5 +1,7 @@ --- name: Test keys generation instruction from the README by booting the docker image + + on: push: branches: @@ -7,28 +9,36 @@ on: pull_request: branches: - "*" + + jobs: generate-keys: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + - name: Log in to registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Download Docker cache image (if available) run: docker pull ghcr.io/$GITHUB_REPOSITORY/build-cache || true + - name: Build the Docker image run: | git fetch --prune --unshallow --tags docker build . -t alephim/pyaleph-node:${GITHUB_REF##*/} -f deployment/docker-build/pyaleph.dockerfile --cache-from=ghcr.io/$GITHUB_REPOSITORY/build-cache + - name: Tag the image run: | docker tag alephim/pyaleph-node:${GITHUB_REF##*/} ghcr.io/$GITHUB_REPOSITORY/build-cache + - name: Generate keys run: | mkdir keys docker run --rm --user root --entrypoint "" -v $(pwd)/keys:/opt/pyaleph/keys alephim/pyaleph-node:${GITHUB_REF##*/} chown aleph:aleph /opt/pyaleph/keys docker run --rm --entrypoint "" -v $(pwd)/keys:/opt/pyaleph/keys alephim/pyaleph-node:${GITHUB_REF##*/} pyaleph --gen-keys --key-dir /opt/pyaleph/keys + - name: Ensure keys exists run: |- ls keys/node-pub.key diff --git a/.readthedocs.yml b/.readthedocs.yml index 2a3052fb..d65d8fe6 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -5,19 +5,24 @@ # Required version: 2 + # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/conf.py + # Build documentation with MkDocs # mkdocs: # configuration: mkdocs.yml # Optionally build your docs in additional formats such as PDF and ePub formats: all + + build: os: ubuntu-22.04 tools: python: "3.12" + # Optionally set the version of Python and requirements required to build your docs python: install: diff --git a/deployment/docker-build/config.yml b/deployment/docker-build/config.yml index 9279198b..3367cf78 100644 --- a/deployment/docker-build/config.yml +++ b/deployment/docker-build/config.yml @@ -7,8 +7,11 @@ nuls2: api_url: https://apiserver.nuls.io/ explorer_url: https://nuls.world/ token_contract: NULSd6Hh1FjbnAktH1FFvFnTzfgFnZtgAhYut + + ethereum: enabled: false + # api_url: {{ ALEPH_ETHEREUM_URL }} chain_id: 1 packing_node: false @@ -16,27 +19,41 @@ ethereum: start_height: 11474360 token_contract: "0x27702a26126e0B3702af63Ee09aC4d1A084EF628" token_start_height: 10939074 + + binancechain: enabled: false packing_node: false + + mongodb: uri: "mongodb://127.0.0.1:27017" database: aleph + + storage: store_files: true engine: mongodb + + ipfs: enabled: true host: 127.0.0.1 port: 5001 gateway_port: 8080 + + aleph: queue_topic: ALEPH-TEST + + p2p: host: 0.0.0.0 http_port: 4024 port: 4025 control_port: 4030 reconnect_delay: 60 + + sentry: dsn: diff --git a/deployment/docker-build/docker-compose.yml b/deployment/docker-build/docker-compose.yml index 5b76235e..486457c0 100644 --- a/deployment/docker-build/docker-compose.yml +++ b/deployment/docker-build/docker-compose.yml @@ -1,11 +1,17 @@ --- # Starts all the services used by pyaleph, minus pyaleph itself. This is used for local development. # Use the docker-compose/docker-compose.yml file for deployment. + version: '2.2' + + volumes: pyaleph-ipfs: pyaleph-postgres: + + services: + rabbitmq: restart: always image: rabbitmq:3.11.15-management @@ -17,6 +23,7 @@ services: ports: - "127.0.0.1:5672:5672" - "127.0.0.1:15672:15672" + p2p-service: restart: always image: alephim/p2p-service:0.1.3 @@ -37,6 +44,7 @@ services: - "/etc/p2p-service/config.yml" - "--private-key-file" - "/etc/p2p-service/node-secret.pkcs8.der" + ipfs: restart: always image: ipfs/kubo:v0.15.0 @@ -52,6 +60,7 @@ services: networks: - pyaleph command: ["daemon", "--enable-pubsub-experiment", "--migrate"] + postgres: restart: always image: postgres:15.1 @@ -66,6 +75,7 @@ services: networks: - pyaleph shm_size: "2gb" + redis: restart: always image: redis:7.0.10 @@ -73,5 +83,7 @@ services: - "127.0.0.1:6380:6379" networks: - pyaleph + + networks: pyaleph: diff --git a/deployment/samples/docker-compose/docker-compose.yml b/deployment/samples/docker-compose/docker-compose.yml index 6c75e26a..51292be5 100644 --- a/deployment/samples/docker-compose/docker-compose.yml +++ b/deployment/samples/docker-compose/docker-compose.yml @@ -1,9 +1,13 @@ --- version: '2.2' + + volumes: pyaleph-ipfs: pyaleph-local-storage: pyaleph-postgres: + + services: pyaleph: restart: always @@ -23,6 +27,7 @@ services: logging: options: max-size: 50m + pyaleph-api: restart: always image: alephim/pyaleph-node:0.5.4 @@ -43,6 +48,7 @@ services: logging: options: max-size: 50m + p2p-service: restart: always image: alephim/p2p-service:0.1.3 @@ -63,6 +69,7 @@ services: - "/etc/p2p-service/config.yml" - "--private-key-file" - "/etc/p2p-service/node-secret.pkcs8.der" + postgres: restart: always image: postgres:15.1 @@ -77,6 +84,7 @@ services: networks: - pyaleph shm_size: "2gb" + rabbitmq: restart: always image: rabbitmq:3.11.15-management @@ -88,11 +96,13 @@ services: ports: - "127.0.0.1:5672:5672" - "127.0.0.1:15672:15672" + redis: restart: always image: redis:7.0.10 networks: - pyaleph + ipfs: restart: always image: ipfs/kubo:v0.15.0 @@ -107,5 +117,7 @@ services: networks: - pyaleph command: ["daemon", "--enable-pubsub-experiment", "--migrate"] + + networks: pyaleph: diff --git a/deployment/samples/docker-compose/sample-config.yml b/deployment/samples/docker-compose/sample-config.yml index 0650d2fd..8adf2579 100644 --- a/deployment/samples/docker-compose/sample-config.yml +++ b/deployment/samples/docker-compose/sample-config.yml @@ -7,6 +7,8 @@ nuls2: api_url: https://apiserver.nuls.io/ explorer_url: https://nuls.world/ token_contract: NULSd6Hh1FjbnAktH1FFvFnTzfgFnZtgAhYut + + ethereum: enabled: true # api_url: https://mainnet.infura.io/v3/ @@ -16,19 +18,29 @@ ethereum: start_height: 11474360 token_contract: "0x27702a26126e0B3702af63Ee09aC4d1A084EF628" token_start_height: 10939074 + + postgres: host: postgres + + storage: store_files: true engine: filesystem folder: /var/lib/pyaleph + + ipfs: enabled: true host: ipfs port: 5001 gateway_port: 8080 + + aleph: queue_topic: ALEPH-TEST + + p2p: daemon_host: p2p-service http_port: 4024 @@ -39,10 +51,14 @@ p2p: peers: - /dns/api1.aleph.im/tcp/4025/p2p/Qmaxufiqdyt5uVWcy1Xh2nh3Rs3382ArnSP2umjCiNG2Vs - /dns/api2.aleph.im/tcp/4025/p2p/QmZkurbY2G2hWay59yiTgQNaQxHSNzKZFt2jbnwJhQcKgV + + rabbitmq: host: rabbitmq port: 5672 username: aleph-p2p password: change-me! + + sentry: dsn: "" diff --git a/deployment/samples/docker-monitoring/docker-compose.yml b/deployment/samples/docker-monitoring/docker-compose.yml index f2d15dcf..28db4043 100644 --- a/deployment/samples/docker-monitoring/docker-compose.yml +++ b/deployment/samples/docker-monitoring/docker-compose.yml @@ -1,11 +1,15 @@ --- version: '2.2' + + volumes: pyaleph-ipfs: pyaleph-local-storage: pyaleph-postgres: pyaleph-caddy-data: pyaleph-caddy-config: + + services: pyaleph: restart: always @@ -25,6 +29,7 @@ services: logging: options: max-size: 50m + pyaleph-api: restart: always image: alephim/pyaleph-node:0.5.4 @@ -45,6 +50,7 @@ services: logging: options: max-size: 50m + p2p-service: restart: always image: alephim/p2p-service:0.1.3 @@ -65,6 +71,7 @@ services: - "/etc/p2p-service/config.yml" - "--private-key-file" - "/etc/p2p-service/node-secret.pkcs8.der" + postgres: restart: always image: postgres:15.1 @@ -79,6 +86,7 @@ services: networks: - pyaleph shm_size: "2gb" + rabbitmq: restart: always image: rabbitmq:3.11.15-management @@ -90,11 +98,13 @@ services: ports: - "127.0.0.1:5672:5672" - "127.0.0.1:15672:15672" + redis: restart: always image: redis:7.0.10 networks: - pyaleph + ipfs: restart: always image: ipfs/kubo:v0.15.0 @@ -109,6 +119,7 @@ services: networks: - pyaleph command: ["daemon", "--enable-pubsub-experiment", "--migrate"] + prometheus: restart: always image: prom/prometheus @@ -120,6 +131,7 @@ services: networks: - pyaleph - grafana + grafana: restart: always image: grafana/grafana @@ -134,11 +146,13 @@ services: - GF_SECURITY_ADMIN_PASSWORD=a440fc1aa53b6b313b85b004605b7647 # Warning, change this ! networks: - grafana + caddy: restart: always image: caddy:latest command: caddy reverse-proxy --from :80 --to grafana:3000 # Use the following command with your own domain name to enable HTTPS instead + # command: caddy reverse-proxy --from grafana.aleph-node.example.org --to grafana:3000 ports: - "80:80" @@ -149,6 +163,8 @@ services: networks: - pyaleph - grafana + + networks: pyaleph: grafana: diff --git a/deployment/samples/docker-monitoring/grafana/dashboard.yaml b/deployment/samples/docker-monitoring/grafana/dashboard.yaml index 05725b92..c32c2a6a 100644 --- a/deployment/samples/docker-monitoring/grafana/dashboard.yaml +++ b/deployment/samples/docker-monitoring/grafana/dashboard.yaml @@ -1,5 +1,7 @@ --- apiVersion: 1 + + providers: - name: 'aleph.im' orgId: 1 diff --git a/deployment/samples/docker-monitoring/grafana/prometheus.yaml b/deployment/samples/docker-monitoring/grafana/prometheus.yaml index 8474c4f1..664a89a2 100644 --- a/deployment/samples/docker-monitoring/grafana/prometheus.yaml +++ b/deployment/samples/docker-monitoring/grafana/prometheus.yaml @@ -1,5 +1,7 @@ --- apiVersion: 1 + + datasources: - name: Prometheus type: prometheus diff --git a/deployment/samples/docker-monitoring/prometheus.yml b/deployment/samples/docker-monitoring/prometheus.yml index eff2dd8b..230d11a3 100644 --- a/deployment/samples/docker-monitoring/prometheus.yml +++ b/deployment/samples/docker-monitoring/prometheus.yml @@ -2,6 +2,8 @@ global: scrape_interval: 5s evaluation_interval: 5s + + scrape_configs: - job_name: pyaleph static_configs: diff --git a/deployment/samples/docker-monitoring/sample-config.yml b/deployment/samples/docker-monitoring/sample-config.yml index 36e82f95..c633673b 100644 --- a/deployment/samples/docker-monitoring/sample-config.yml +++ b/deployment/samples/docker-monitoring/sample-config.yml @@ -7,6 +7,8 @@ nuls2: api_url: https://apiserver.nuls.io/ explorer_url: https://nuls.world/ token_contract: NULSd6Hh1FjbnAktH1FFvFnTzfgFnZtgAhYut + + ethereum: enabled: true # api_url: https://mainnet.infura.io/v3/ @@ -16,27 +18,39 @@ ethereum: start_height: 11474360 token_contract: "0x27702a26126e0B3702af63Ee09aC4d1A084EF628" token_start_height: 10939074 + + storage: store_files: true engine: filesystem folder: /var/lib/pyaleph + + ipfs: enabled: true host: ipfs port: 5001 gateway_port: 8080 + + aleph: queue_topic: ALEPH-TEST + + p2p: daemon_host: p2p-service http_port: 4024 port: 4025 control_port: 4030 reconnect_delay: 60 + + rabbitmq: host: rabbitmq port: 5672 username: aleph-p2p password: change-me! + + sentry: dsn: ""