Skip to content

Commit 8f1ca3f

Browse files
committed
fix(cmd-api-server): healthcheck broken due to missing wget binary
1. wget now gets installed explicitly 2. upgraded to ubuntu 22.04 LTS for the base image 3. upgraded nodejs to v20 LTS and npm to v10 3. Published the container image corresponding to this commit tagged as `ghcr.io/hyperledger/cactus-cmd-api-server:2023-11-16-issue2894` [skip ci] Fixes #2894 Signed-off-by: Peter Somogyvari <[email protected]>
1 parent 5a59236 commit 8f1ca3f

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

packages/cactus-cmd-api-server/Dockerfile

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:22.04
22

33
SHELL ["/bin/bash", "-c"]
44

@@ -11,7 +11,7 @@ EXPOSE 3000 4000 5000
1111
RUN groupadd --gid 1000 appuser \
1212
&& useradd --uid 1000 --gid appuser --shell /bin/bash --create-home ${APP_USER}
1313

14-
RUN apt update && apt install -y curl
14+
RUN apt update && apt install -y curl wget
1515

1616
RUN mkdir -p "${APP}log/"
1717
RUN chown -R $APP_USER:$APP_USER "${APP}log/"
@@ -22,7 +22,6 @@ COPY --chown=${APP_USER}:${APP_USER} ./packages/cactus-cmd-api-server/healthchec
2222
RUN chown -R $APP_USER:$APP_USER ${APP}
2323

2424
USER $APP_USER
25-
ARG NPM_PKG_VERSION=latest
2625

2726
ENV TZ=Etc/UTC
2827
ENV NODE_ENV=production
@@ -47,21 +46,21 @@ ENV API_PORT=4000
4746
ENV LOG_LEVEL=INFO
4847

4948
ENV NVM_DIR /home/${APP_USER}/.nvm
50-
ENV NODE_VERSION 16.15.1
49+
ENV NODE_VERSION 20.9.0
5150
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
5251
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
5352

5453
# Install nvm with node and npm
5554
RUN mkdir -p ${NVM_DIR}
56-
RUN curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash \
55+
RUN curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \
5756
&& source $NVM_DIR/nvm.sh \
5857
&& nvm install $NODE_VERSION \
5958
&& nvm alias default $NODE_VERSION \
6059
&& nvm use default \
61-
&& npm install -g npm@8.11.0
60+
&& npm install -g npm@10.2.4
6261

63-
RUN npm install -g [email protected]
64-
RUN yarn add @hyperledger/cactus-cmd-api-server@${NPM_PKG_VERSION} --production
62+
ARG NPM_PKG_VERSION=latest
63+
RUN npm install @hyperledger/cactus-cmd-api-server@${NPM_PKG_VERSION}
6564

6665
COPY ./packages/cactus-cmd-api-server/docker-entrypoint.sh /usr/local/bin/
6766
HEALTHCHECK --interval=5s --timeout=5s --start-period=1s --retries=30 CMD /healthcheck.sh

packages/cactus-cmd-api-server/README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ Once you've built the container, the following commands should work:
258258
--env AUTHORIZATION_CONFIG_JSON='{}' \
259259
--env GRPC_TLS_ENABLED=false \
260260
cas \
261-
./node_modules/.bin/cactusapi \
262-
--plugins='[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-fabric", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "connectionProfile": {}, "instanceId": "some-unique-instance-id"}}]'
261+
node_modules/@hyperledger/cactus-cmd-api-server/dist/lib/main/typescript/cmd/cactus-api.js \
262+
--plugins='[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-fabric", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "version": "dev", "peerBinary":"/fabric-samples/bin/peer", "connectionProfile": {}, "instanceId": "some-unique-instance-id"}}]'
263263
```
264264

265265
- Launch container with plugin configuration as an **environment variable**:
@@ -271,7 +271,7 @@ Once you've built the container, the following commands should work:
271271
--env AUTHORIZATION_PROTOCOL='NONE' \
272272
--env AUTHORIZATION_CONFIG_JSON='{}' \
273273
--env GRPC_TLS_ENABLED=false \
274-
--env PLUGINS='[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-besu", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://localhost:8545", "instanceId": "some-unique-besu-connector-instance-id"}}]' \
274+
--env PLUGINS='[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-besu", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "rpcApiWsHost": "http://127.0.0.1:8546", "rpcApiHttpHost": "http://127.0.0.1:8545", "instanceId": "some-unique-besu-connector-instance-id"}}]' \
275275
cas
276276
```
277277

@@ -285,14 +285,14 @@ Once you've built the container, the following commands should work:
285285
--env AUTHORIZATION_CONFIG_JSON='{}' \
286286
--env GRPC_TLS_ENABLED=false \
287287
cas \
288-
./node_modules/.bin/cactusapi \
289-
--plugins='[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-besu", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://localhost:8545", "instanceId": "some-unique-besu-connector-instance-id"}}]'
288+
./node_modules/@hyperledger/cactus-cmd-api-server/dist/lib/main/typescript/cmd/cactus-api.js \
289+
--plugins='[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-besu", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "rpcApiWsHost": "http://127.0.0.1:8546", "rpcApiHttpHost": "http://127.0.0.1:8545", "instanceId": "some-unique-besu-connector-instance-id"}}]'
290290
```
291291

292292
- Launch container with **configuration file** mounted from host machine:
293293
```sh
294294

295-
echo '[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-besu", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://localhost:8545", "instanceId": "some-unique-besu-connector-instance-id"}}]' > cactus.json
295+
echo '{"plugins": [{"packageName": "@hyperledger/cactus-plugin-ledger-connector-besu", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "rpcApiWsHost": "http://127.0.0.1:8546", "rpcApiHttpHost": "http://127.0.0.1:8545", "instanceId": "some-unique-besu-connector-instance-id"}}]}' > cactus.json
296296

297297
docker run \
298298
--rm \
@@ -303,7 +303,7 @@ Once you've built the container, the following commands should work:
303303
--env GRPC_TLS_ENABLED=false \
304304
--mount type=bind,source="$(pwd)"/cactus.json,target=/cactus.json \
305305
cas \
306-
./node_modules/.bin/cactusapi \
306+
./node_modules/@hyperledger/cactus-cmd-api-server/dist/lib/main/typescript/cmd/cactus-api.js \
307307
--config-file=/cactus.json
308308
```
309309

@@ -313,7 +313,10 @@ Don't have a Besu network on hand to test with? Test or develop against our Besu
313313

314314
1. Terminal Window 1 (Ledger)
315315
```sh
316-
docker run --publish 8545:8545 hyperledger/cactus-besu-all-in-one:latest
316+
docker run \
317+
--publish 8545:8545 \
318+
--publish 8546:8546 \
319+
ghcr.io/hyperledger/cactus-besu-all-in-one:2023-11-16-89d9b93
317320
```
318321

319322
2. Terminal Window 2 (Cactus API Server)
@@ -326,7 +329,7 @@ Don't have a Besu network on hand to test with? Test or develop against our Besu
326329
--env AUTHORIZATION_PROTOCOL='NONE' \
327330
--env AUTHORIZATION_CONFIG_JSON='{}' \
328331
--env GRPC_TLS_ENABLED=false \
329-
--env PLUGINS='[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-besu", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://localhost:8545", "instanceId": "some-unique-besu-connector-instance-id"}}]' \
332+
--env PLUGINS='[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-besu", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "rpcApiWsHost": "http://127.0.0.1:8546", "rpcApiHttpHost": "http://127.0.0.1:8545", "instanceId": "some-unique-besu-connector-instance-id"}}]' \
330333
cas
331334
```
332335

0 commit comments

Comments
 (0)