Skip to content

Commit

Permalink
Switch server release group to pnpm (#13187)
Browse files Browse the repository at this point in the history
This PR updates the server release group to use pnpm instead of npm.
Summary of changes:

- lerna was bumped to v5 in the server release group. This was needed
because earlier releases only supported yarn workspaces properly. I've
attempted this upgrade without pnpm in the past, but it always failed
(presumably due to npm bugs).
- lerna uses the pnpm workspace config and uses pnpm to execute scripts.
- Several packages had missing deps on node libraries like `assert` and
`events`, so I added those explicitly.
- Some packages had missing non-node deps, like axios and sinon. My
guess is that these worked because of hoisting in the past.
- The Docker image uses debian buster instead of stretch. This was
needed to get a later release of the Python build tools that the server
packages require to build (due to node-rdkafka). The latest releases
available for stretch are too old.
  • Loading branch information
tylerbutler authored Feb 6, 2023
1 parent 9215d42 commit 5ac5f2e
Show file tree
Hide file tree
Showing 25 changed files with 14,954 additions and 48,085 deletions.
1 change: 1 addition & 0 deletions server/routerlicious/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist: true
10 changes: 6 additions & 4 deletions server/routerlicious/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

# DisableDockerDetector "No feasible secure solution for OSS repos yet"

FROM node:14.19.1-stretch-slim AS base
FROM node:14.19.1-buster-slim AS base

# node-gyp dependencies
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
make \
git \
Expand All @@ -26,8 +27,8 @@ WORKDIR /usr/src/server

# Copy over the package and package-lock and install prior to the other code to optimize Docker's file system cache on rebuilds
COPY package*.json ./
COPY lerna.json .
COPY lerna-package-lock.json .
COPY pnpm*.yaml ./
COPY scripts/*.* ./scripts/

COPY packages/gitresources/package*.json packages/gitresources/
COPY packages/kafka-orderer/package*.json packages/kafka-orderer/
Expand All @@ -49,11 +50,12 @@ COPY packages/services-utils/package*.json packages/services-utils/
COPY packages/test-utils/package*.json packages/test-utils/
COPY packages/protocol-base/package*.json packages/protocol-base/

RUN npm install --global pnpm

# Need to set the --unsafe-perm flag since we are doing the install as root. Consider adding an 'app' accout so we
# can do the install as node but then switch to 'app' to run. As app we won't be able to write to installed files
# and be able to change them.
RUN npm install --unsafe-perm
RUN pnpm install --unsafe-perm

# And now copy over our actual code and build
COPY . .
Expand Down
3 changes: 2 additions & 1 deletion server/routerlicious/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ We also support volume mounting your local drive into the container which provid
To start the service with your local drive mounted run the following commands:

```sh
npm install
npm install -g pnpm
pnpm install
npm run build
npm start
```
Expand Down
28 changes: 7 additions & 21 deletions server/routerlicious/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,28 @@ services:
alfred:
volumes:
- .:/usr/src/server
- /usr/src/server/node_modules/zookeeper
- /usr/src/server/node_modules/node-rdkafka
- /usr/src/server/packages/routerlicious/node_modules/node-rdkafka/
- /usr/src/server/node_modules
deli:
volumes:
- .:/usr/src/server
- /usr/src/server/node_modules/zookeeper
- /usr/src/server/node_modules/node-rdkafka
- /usr/src/server/packages/routerlicious/node_modules/node-rdkafka/
- /usr/src/server/node_modules
scriptorium:
volumes:
- .:/usr/src/server
- /usr/src/server/node_modules/zookeeper
- /usr/src/server/node_modules/node-rdkafka
- /usr/src/server/packages/routerlicious/node_modules/node-rdkafka/
- /usr/src/server/node_modules
copier:
volumes:
- .:/usr/src/server
- /usr/src/server/node_modules/zookeeper
- /usr/src/server/node_modules/node-rdkafka
- /usr/src/server/packages/routerlicious/node_modules/node-rdkafka/
- /usr/src/server/node_modules
scribe:
volumes:
- .:/usr/src/server
- /usr/src/server/node_modules/zookeeper
- /usr/src/server/node_modules/node-rdkafka
- /usr/src/server/packages/routerlicious/node_modules/node-rdkafka/
- /usr/src/server/node_modules
foreman:
volumes:
- .:/usr/src/server
- /usr/src/server/node_modules/zookeeper
- /usr/src/server/node_modules/node-rdkafka
- /usr/src/server/packages/routerlicious/node_modules/node-rdkafka/
- /usr/src/server/node_modules
riddler:
volumes:
- .:/usr/src/server
- /usr/src/server/node_modules/zookeeper
- /usr/src/server/node_modules/node-rdkafka
- /usr/src/server/packages/routerlicious/node_modules/node-rdkafka/
- /usr/src/server/node_modules
Loading

0 comments on commit 5ac5f2e

Please sign in to comment.