Skip to content

Commit

Permalink
refactor: retire connector plugin specific container images, fix docs
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Container images are being deleted here and will also
get deleted from GHCR. Though the public APIs of the Typescript code
do not change, still, some parts of the documentation will become invalid
until we update it to match the changes here.
I invested a large amount of effort into doing this documentation update
as part of this change but it is very likely that I've missed a few spots
and therefore it is best to mark this as a breaking change in my opinion
to call attention to the fact that we still have ways to go with updating
the documentation around these container images.

1. Deleted all the container images that were just wrappers around the
cmd-api-server container image installing their own npm package from
the registry.
The reason for this is that they ended up just being maintenance burden
since we can achieve the exact same things just by re-using the API server's
container image directly.
2. This way we don't have to deal with CVEs in 10x container images when
it's really just the one container image that we use as the base that needs
to deal with them anyway.
3. I also spent quite a bit of effort in this change to update the README.md
files of the packages where previously we had plugin specific container images
defined so that the README.md files have the tutorials that are more up to
date compared to how they were (most of them had the tutorials completely
broken for a long while which was causing a lot of difficulties to the
newcomers who were trying to work with the packages).
4. The reason why they got so out of date traces back to the undue maintenance
burden of keeping separate images for each connector plugin. We hope that
with this simplification we can keep the documentation continuously up to
date since it will require less time do so.
5. Also deleted the ci.yaml container building jobs which were relevant to
the scope of this change so that we also save on CI resources, another
long-running project that's been in need of some attention from the maintainers.

Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
petermetz committed Jul 15, 2024
1 parent c7fce88 commit 24b5888
Show file tree
Hide file tree
Showing 32 changed files with 429 additions and 444 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2528,25 +2528,6 @@ jobs:
- uses: actions/[email protected]
- name: ghcr.io/hyperledger/cactus-besu-all-in-one
run: DOCKER_BUILDKIT=1 docker build ./tools/docker/besu-all-in-one/ -f ./tools/docker/besu-all-in-one/Dockerfile
ghcr-connector-besu:
needs:
- compute_changed_packages
if: needs.compute_changed_packages.outputs.plugin-ledger-connector-besu-changed == 'true'
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- name: ghcr.io/hyperledger/cactus-connector-besu
run: DOCKER_BUILDKIT=1 docker build ./packages/cactus-plugin-ledger-connector-besu/ -f ./packages/cactus-plugin-ledger-connector-besu/Dockerfile -t cactus-connector-besu
- if: ${{ env.RUN_TRIVY_SCAN == 'true' }}
name: Run Trivy vulnerability scan for cactus-connector-besu
uses: aquasecurity/[email protected]
with:
image-ref: 'cactus-connector-besu'
format: 'table'
exit-code: '1'
ignore-unfixed: false
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
ghcr-connector-corda-server:
runs-on: ubuntu-22.04
needs:
Expand All @@ -2567,26 +2548,6 @@ jobs:
ignore-unfixed: false
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
ghcr-connector-fabric:
runs-on: ubuntu-22.04
needs:
- compute_changed_packages
if: needs.compute_changed_packages.outputs.plugin-ledger-connector-fabric-changed == 'true'

steps:
- uses: actions/[email protected]
- name: ghcr.io/hyperledger/cactus-connector-fabric
run: DOCKER_BUILDKIT=1 docker build ./packages/cactus-plugin-ledger-connector-fabric/ -f ./packages/cactus-plugin-ledger-connector-fabric/Dockerfile -t cactus-connector-fabric
- if: ${{ env.RUN_TRIVY_SCAN == 'true' }}
name: Run Trivy vulnerability scan for cactus-connector-fabric
uses: aquasecurity/[email protected]
with:
image-ref: 'cactus-connector-fabric'
format: 'table'
exit-code: '1'
ignore-unfixed: false
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
ghcr-corda-all-in-one-flowdb:
runs-on: ubuntu-22.04
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.cacti-config.json
.config.json
.nyc_output/
dist/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Contributing

We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!

Please review [CONTIRBUTING.md](#../../CONTRIBUTING.md) to get started.
Please review [CONTRIBUTING.md](#../../CONTRIBUTING.md) to get started.

License
------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ This file lists all the prometheus metrics and what they are used for.

We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!

Please review [CONTIRBUTING.md](#../../CONTRIBUTING.md) to get started.
Please review [CONTRIBUTING.md](#../../CONTRIBUTING.md) to get started.

6\. License
----------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion extensions/cactus-plugin-htlc-coordinator-besu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ shows the sequence diagram of a complete flow for a participant who wants exchan

We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!

Please review [CONTIRBUTING.md](../../CONTRIBUTING.md) to get started.
Please review [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

## License

Expand Down
2 changes: 1 addition & 1 deletion extensions/cactus-plugin-object-store-ipfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const timestamp = response.data.checkedAt;
## Contributing
We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!

Please review [CONTIRBUTING.md](https://github.com/hyperledger/cactus/blob/main/CONTRIBUTING.md "CONTIRBUTING.md") to get started.
Please review [CONTRIBUTING.md](https://github.com/hyperledger/cactus/blob/main/CONTRIBUTING.md "CONTRIBUTING.md") to get started.

## License
This distribution is published under the Apache License Version 2.0 found in the [LICENSE ](https://github.com/hyperledger/cactus/blob/main/LICENSE "LICENSE ")file.
Expand Down
2 changes: 1 addition & 1 deletion packages/cacti-ledger-browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ psql "postgres://postgres.DB_NAME:[email protected]

We welcome contributions to Hyperledger Cacti in many forms, and there’s always plenty to do!

Please review [CONTIRBUTING.md](../../CONTRIBUTING.md) to get started.
Please review [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

## License

Expand Down
5 changes: 0 additions & 5 deletions packages/cacti-plugin-ledger-connector-stellar/Dockerfile

This file was deleted.

75 changes: 48 additions & 27 deletions packages/cacti-plugin-ledger-connector-stellar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,6 @@ const res = await connector.runSorobanTransaction({
});
```

### Building/running the container image locally

In the Cacti project root say:

```sh
DOCKER_BUILDKIT=1 docker build -f ./packages/cacti-plugin-ledger-connector-stellar/Dockerfile . --tag cplcs --tag cacti-plugin-ledger-connector-stellar
```

Build with a specific version of the npm package:

```sh
DOCKER_BUILDKIT=1 docker build --build-arg NPM_PKG_VERSION=2.0.0-rc.2 -f ./packages/cacti-plugin-ledger-connector-stellar/Dockerfile . --tag cplcs --tag cacti-plugin-ledger-connector-stellar
```

#### Running the container

Launch container with plugin configuration as an **environment variable**:
Expand All @@ -173,36 +159,71 @@ docker run \
--rm \
--publish 3000:3000 \
--publish 4000:4000 \
--env PLUGINS='[{"packageName": "@hyperledger/cacti-plugin-ledger-connector-stellar", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "instanceId": "some-unique-stellar-connector-instance-id"}}]' \
cplcs
--env AUTHORIZATION_PROTOCOL='NONE' \
--env AUTHORIZATION_CONFIG_JSON='{}' \
--env GRPC_TLS_ENABLED=false \
--env API_TLS_CERT_PEM=- \
--env API_TLS_CLIENT_CA_PEM=- \
--env API_TLS_KEY_PEM=- \
--env API_TLS_ENABLED=false \
--env API_MTLS_ENABLED=false \
--env API_HOST=0.0.0.0 \
--env LOG_LEVEL=INFO \
--env PLUGINS='[{"packageName": "@hyperledger/cacti-plugin-ledger-connector-stellar", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "instanceId": "some-unique-stellar-connector-instance-id", "networkConfig": {}}}]' \
ghcr.io/hyperledger/cactus-cmd-api-server:2024-07-03t18-38-45-dev-65adc3255
```

> Notice that in the command above we've left the `networkConfig` parameter as
> an empty object. If you'd like the Stellar connector plugin to connect to
> a specific ledger then fill out the details of `networkConfig` accordingly.
Launch container with plugin configuration as a **CLI argument**:

```sh
docker run \
--rm \
--publish 3000:3000 \
--publish 4000:4000 \
cplcs \
./node_modules/.bin/cactusapi \
--plugins='[{"packageName": "@hyperledger/cacti-plugin-ledger-connector-stellar", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "instanceId": "some-unique-stellar-connector-instance-id"}}]'
--publish 4000:4000 \
--env AUTHORIZATION_PROTOCOL='NONE' \
--env AUTHORIZATION_CONFIG_JSON='{}' \
--env GRPC_TLS_ENABLED=false \
--env API_TLS_CERT_PEM=- \
--env API_TLS_CLIENT_CA_PEM=- \
--env API_TLS_KEY_PEM=- \
--env API_TLS_ENABLED=false \
--env API_MTLS_ENABLED=false \
--env API_HOST=0.0.0.0 \
--env LOG_LEVEL=INFO \
ghcr.io/hyperledger/cactus-cmd-api-server:2024-07-03t18-38-45-dev-65adc3255 \
node index.js \
--plugins='[{"packageName": "@hyperledger/cacti-plugin-ledger-connector-stellar", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "networkConfig":{}, "instanceId": "some-unique-stellar-connector-instance-id"}}]'
```

Launch container with **configuration file** mounted from host machine:

```sh
echo '{"plugins": [{"packageName": "@hyperledger/cacti-plugin-ledger-connector-stellar", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "networkConfig":{}, "instanceId": "some-unique-stellar-connector-instance-id"}}]}' > .cacti-config.json
```

echo '[{"packageName": "@hyperledger/cacti-plugin-ledger-connector-stellar", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": { "instanceId": "some-unique-stellar-connector-instance-id"}}]' > cactus.json

```sh
docker run \
--rm \
--publish 3000:3000 \
--publish 4000:4000 \
--mount type=bind,source="$(pwd)"/cactus.json,target=/cactus.json \
cplcs \
./node_modules/.bin/cactusapi \
--config-file=/cactus.json
--env AUTHORIZATION_PROTOCOL='NONE' \
--env AUTHORIZATION_CONFIG_JSON='{}' \
--env GRPC_TLS_ENABLED=false \
--env API_TLS_CERT_PEM=- \
--env API_TLS_CLIENT_CA_PEM=- \
--env API_TLS_KEY_PEM=- \
--env API_TLS_ENABLED=false \
--env API_MTLS_ENABLED=false \
--env API_HOST=0.0.0.0 \
--env LOG_LEVEL=INFO \
--mount type=bind,source="$(pwd)"/.cacti-config.json,target=/.cacti-config.json \
cas \
node index.js \
--config-file=/.cacti-config.json
```

#### Testing API calls with the container
Expand Down Expand Up @@ -293,7 +314,7 @@ yarn jest packages/cacti-plugin-ledger-connector-stellar/

We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!

Please review [CONTIRBUTING.md](../../CONTRIBUTING.md) to get started.
Please review [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

## License

Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-plugin-htlc-eth-besu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Run ALL the solidity tests: `forge test -vvvv`

We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!

Please review [CONTIRBUTING.md](../../CONTRIBUTING.md) to get started.
Please review [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

## Nohoist configuration
Foundry uses ``forge-std``and ``ds-test``modules for testing purposes. Given that Foundry cannot access files outside of the project, we use nohoist to force lerna to download the packages within the Forge project directory:
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-plugin-keychain-aws-sm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ This file lists all the prometheus metrics and what they are used for.

We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!

Please review [CONTIRBUTING.md](../../CONTRIBUTING.md) to get started.
Please review [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

## 5. License

Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-plugin-ledger-connector-aries/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ npx jest cactus-plugin-ledger-connector-aries

We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!

Please review [CONTIRBUTING.md](../../CONTRIBUTING.md) to get started.
Please review [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

### TODO

Expand Down
9 changes: 0 additions & 9 deletions packages/cactus-plugin-ledger-connector-besu/Dockerfile

This file was deleted.

Loading

0 comments on commit 24b5888

Please sign in to comment.