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

Packages' network tab #2022

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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 .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: npx @dappnode/dappnodesdk github-action build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: "Main"
on:
workflow_dispatch:
branches:
- "master"
paths-ignore:
- "README.md"
inputs:
bump:
description: "Bump type, it must be: patch | minor | major"
Expand All @@ -25,9 +21,11 @@ jobs:
runs-on: ubuntu-latest
name: Unit tests
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: "20"
- run: yarn
Expand All @@ -43,11 +41,14 @@ jobs:
runs-on: ubuntu-latest
name: In app integration tests
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
- run: yarn # Caching only saves 30s
- run: yarn build
- run: yarn test:int
Expand All @@ -62,11 +63,14 @@ jobs:
run: |
[[ "$BUMP_TYPE" == "patch" ]] || [[ "$BUMP_TYPE" == "minor" ]] || \
[[ "$BUMP_TYPE" == "major" ]] || { echo "Wrong input, it must be: patch | minor | major"; exit 1;}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
- name: Publish
run: npx @dappnode/dappnodesdk publish ${BUMP_TYPE} --dappnode_team_preset
env:
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/netlify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
# Setup node version 14 for node-sass 4.14 https://stackoverflow.com/questions/60394291/error-node-modules-node-sass-command-failed
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: "20"
# Install dependencies
node-version: "22"
cache: "yarn"
- run: yarn install
# Generate schemas
- run: yarn build
# Build
- run: yarn mock-standalone:build
# Deploy
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
node-version: "22"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies and build
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ node_modules/\.yarn-integrity
# Typescript build artifacts
build/src/dist/
build/src/.temp-transfer/
packages/*/tsconfig.tsbuildinfo

# Common
packages/*/node_modules/
Expand All @@ -58,4 +59,8 @@ packages/dappmanager/dnp_repo
packages/toolkit/truffle/contracts_build/*

# docker tmp
docker-compose-tmp.yml
docker-compose-tmp.yml

# yarn berry
.yarn/install-state.gz
.yarn/releases
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
32 changes: 17 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
# Arguments
ARG NODE_VERSION=20.3.0
ARG BASE_IMAGE=node:${NODE_VERSION}-alpine3.18
ARG BASE_IMAGE=node:20.16.0-alpine3.19
ARG BUILDPLATFORM

# Initial stage to gather git data
FROM --platform=${BUILDPLATFORM:-amd64} ${BASE_IMAGE} AS git-data
FROM ${BASE_IMAGE} AS git-data
WORKDIR /usr/src/app
RUN apk add --no-cache git
COPY .git dappnode_package.json docker/getGitData.js ./
RUN apk add --no-cache git
RUN node getGitData /usr/src/app/.git-data.json

# Build stage
FROM --platform=${BUILDPLATFORM:-amd64} ${BASE_IMAGE} AS build-src
FROM ${BASE_IMAGE} AS build-src
ENV VITE_APP_API_URL /
WORKDIR /app

# Install necessary packages required by vite
RUN apk add --no-cache python3 py3-pip build-base

# Copy and build packages
COPY package.json yarn.lock lerna.json tsconfig.json ./
COPY package.json yarn.lock .yarnrc.yml tsconfig.json ./
COPY packages packages
ENV VITE_APP_API_URL /
RUN yarn install --non-interactive --frozen-lockfile && \
yarn build && \
yarn clean:libraries && \
yarn install --non-interactive --frozen-lockfile --production --force --ignore-optional

# Install necessary packages required by vite
RUN apk add --no-cache python3 py3-pip build-base
# Install corepack to be able to use modern yarn berry
RUN corepack enable
RUN yarn install --immutable
# Build and install production dependencies
RUN yarn build && \
yarn workspaces focus --all --production
# Remove unnecessary files
RUN rm -rf yarn.lock packages/*/src packages/*/tsconfig.json packages/*/.eslint*

# Production stage
FROM node:${NODE_VERSION}-alpine
FROM ${BASE_IMAGE}
WORKDIR /usr/src/app

# Environment variables
Expand Down
38 changes: 15 additions & 23 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,44 +1,36 @@
ARG NODE_VERSION=20.3.0

# Common base so it's cached
# --platform=$BUILDPLATFORM is used build javascript source with host arch
# Otherwise webpack builds on emulated archs can be extremely slow (+1h)
ARG BASE_IMAGE=node:${NODE_VERSION}-alpine
ARG NODE_VERSION=20.16.0
ARG BASE_IMAGE=node:${NODE_VERSION}-alpine3.19

# Initial stage to gather git data
FROM --platform=${BUILDPLATFORM:-amd64} ${BASE_IMAGE} AS git-data
FROM ${BASE_IMAGE} AS git-data
WORKDIR /usr/src/app
RUN apk add --no-cache git python3 py3-pip build-base
COPY .git dappnode_package.json docker/getGitData.js ./
RUN apk add --no-cache git python3 py3-pip build-base
RUN node getGitData /usr/src/app/.git-data.json


# Build + Prod stage
FROM node:${NODE_VERSION}-alpine
FROM ${BASE_IMAGE}
ENV COMPOSE_HTTP_TIMEOUT=300 \
DOCKER_CLIENT_TIMEOUT=300 \
DOCKER_HOST=unix:///var/run/docker.sock \
UI_FILES_PATH=/app/packages/admin-ui/build \
GIT_DATA_PATH=.git-data.json \
TEST=true \
VITE_APP_API_URL=http://my.dappnode:5000/
VITE_APP_API_URL=http://my.dappnode/

WORKDIR /app

RUN apk update && apk add --no-cache docker curl docker-cli-compose xz zip unzip libltdl bash git bind bind-tools bind-dev \
miniupnpc dbus tmux avahi-tools
RUN corepack enable

# Copy git data
COPY --from=git-data /usr/src/app/.git-data.json $GIT_DATA_PATH

COPY docker/start_dev.sh /usr/src/app/start_dev.sh

# Build the src code:
# Copy and install deps first to cache
COPY package.json yarn.lock lerna.json tsconfig.json ./
COPY package.json yarn.lock .yarnrc.yml tsconfig.json ./
COPY packages packages

RUN yarn --frozen-lockfile --non-interactive

ENV VITE_APP_API_URL /
RUN yarn build

ENTRYPOINT [ "/usr/src/app/start_dev.sh" ]
# link instructions must be executed in runtime due to the way the volumes are mounted
ENTRYPOINT ["/bin/sh", "-c", "ln -sf /app/packages/admin-ui/build/ /app/packages/dappmanager/dist && \
ln -sf /usr/src/app/dnp_repo/ /app/packages/dappmanager && \
ln -sf /usr/src/app/DNCORE/ /app/packages/dappmanager && \
yarn && yarn build && yarn run dev"]
74 changes: 37 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,45 @@ Go to the [installation overview](https://docs.dappnode.io/docs/user/install/ove

### Installing

To get started, clone the project locally.
1. To get started, clone the project locally.

```
$ git clone https://github.com/dappnode/DNP_DAPPMANAGER.git
```
```bash
$ git clone https://github.com/dappnode/DNP_DAPPMANAGER.git
```

To develop locally, cd into the src folder and start the nodejs application
2. Use node 20 or higher to run the project.

```
cd build/src
npm i
npm start
```
```bash
$ nvm use 20
```

The DNP_DAPPMANAGER expects to be in a Dappnode network to connect to its WAMP module, Ethereum node and IPFS node. If you wish to use a different providers for such services you can edit their urls in the [`build/src/src/params.js` file](build/src/src/params.js).
3. Install `yarn` globally.

### Building
```bash
$ npm install -g yarn
```

After making sure that the nodejs app runs successfully on its own and passes the tests `npm test`, you can dockerize the package.
4. Enable corepack and set yarn version berry

```
docker-compose build
docker-compose up -d
docker-compose logs -f
```
```bash
$ corepack enable && yarn set version berry
```

### Developing
5. Install the dependencies

Before choosing any of the following options for development, remember to run:
```bash
$ yarn
```

```
yarn
yarn generate
```
6. Build the project

```bash
$ yarn build
```

The DNP_DAPPMANAGER expects to be in a Dappnode network to connect to its WAMP module, Ethereum node and IPFS node. If you wish to use a different providers for such services you can edit their urls in the [`packages/params/src/params.ts` file](packages/params/src/params.ts).

### Developing

There are 4 different developing modes:

Expand Down Expand Up @@ -110,31 +115,25 @@ _Note: This mode is not working a the moment since cross-domain cookies are not

SSH into your Dappnode and clone this repo:

```
https://github.com/dappnode/DNP_DAPPMANAGER
```bash
git clone https://github.com/dappnode/DNP_DAPPMANAGER
```

Open the directory where you cloned the repo using VS Code SSH extension (optional, but recommended)

Force remove Dappmanager container:

```
```bash
docker rm -f DAppNodeCore-dappmanager.dnp.dappnode.eth
```

Build dev Dappmanager:
Build and start dev Dappmanager:

```
docker-compose -f docker-compose-dev.yml build
```

Start dev Dappmanager:

```
docker-compose -f docker-compose-dev.yml up -d
```bash
docker-compose -f docker-compose-dev.yml up -d --build
```

After this, you will be able to access the dappmanager through http://my.dappnode:5000/
After this, you will be able to access the dappmanager through http://my.dappnode/

_Note: To switch back to production Dappmanager, you will have to remove this container and run:_

Expand Down Expand Up @@ -164,6 +163,7 @@ We use [SemVer](http://semver.org/) for versioning. For the versions available,
## Authors

- **Eduardo Antuña Díez** - _Initial work_ - [eduadiez](https://github.com/eduadiez)
- **Pablo Mendez** - [pablomendez](https://github.com/pablomendezroyo)
- **DAppLion** - [dapplion](https://github.com/dapplion)

See also the list of [contributors](https://github.com/dappnode/DNP_DAPPMANAGER/contributors) who participated in this project.
Expand Down
17 changes: 0 additions & 17 deletions docker/start_dev.sh

This file was deleted.

6 changes: 0 additions & 6 deletions lerna.json

This file was deleted.

Loading
Loading