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

test(weaver-fabric-examples): use docker compose v2 #3358

Closed
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
Original file line number Diff line number Diff line change
@@ -519,7 +519,7 @@ Weaver provides a [pre-built image](https://github.com/hyperledger/cacti/pkgs/co

To start the relay server, navigate to the folder containing the above files and run the following:
```bash
docker-compose up -d relay-server
docker compose up -d relay-server
```

#### Launch Driver
@@ -553,13 +553,13 @@ Weaver provides a [pre-built image](https://github.com/hyperledger/cacti/pkgs/co
- **Enabling TLS**:
- You can make your driver accept TLS connections by specifying `DRIVER_TLS` as `true` and specifying a TLS certificate file path and private key file path in `DRIVER_TLS_CERT_PATH` and `DRIVER_TLS_KEY_PATH` respectively. The same certificate should be specified in this driver's definition in the `drivers` section in the `config.toml` file of your relay in the `tlsca_cert_path` property (see the earlier section on relay configuration).
- To communicate with your network' relay using TLS (i.e., if the relay is TLS-enabled), specify that relay's TLS CA certificate path in `RELAY_TLSCA_CERT_PATH` (currently only one certificate can be configured) and set `RELAY_TLS` to `true`. This CA certificate should match the one specified in the `cert_path` property in the relay's `config.toml` file (see the earlier section on relay configuration):
- You can point to the folder in your host system containing the certificate and key using the `TLS_CREDENTIALS_DIR` variable. (This folder will be synced to the `/corda-driver/credentials` folder in the Fabric Driver container as specified in the [docker-compose file](https://github.com/hyperledger/cacti/blob/main/weaver/core/drivers/fabric-driver/docker-compose.yml).) Make sure you point to the right certificate and key file paths within the container using the `DRIVER_TLS_CERT_PATH`, `DRIVER_TLS_KEY_PATH`, and `RELAY_TLSCA_CERT_PATH` variables.
- You can point to the folder in your host system containing the certificate and key using the `TLS_CREDENTIALS_DIR` variable. (This folder will be synced to the `/corda-driver/credentials` folder in the Fabric Driver container as specified in the [docker compose file](https://github.com/hyperledger/cacti/blob/main/weaver/core/drivers/fabric-driver/docker-compose.yml).) Make sure you point to the right certificate and key file paths within the container using the `DRIVER_TLS_CERT_PATH`, `DRIVER_TLS_KEY_PATH`, and `RELAY_TLSCA_CERT_PATH` variables.

- `docker-compose.yaml`: This specifies the properties of the driver container. You can use the [file in the repository](https://github.com/hyperledger/cacti/blob/main/weaver/core/drivers/corda-driver/docker-compose.yml) verbatim.

To start the driver, navigate to the folder containing the above files and run the following:
```bash
docker-compose up -d
docker compose up -d
```

#### Vault Initialization
Original file line number Diff line number Diff line change
@@ -610,7 +610,7 @@ Weaver provides a [pre-built image](https://github.com/hyperledger/cacti/pkgs/co

To start the relay server, navigate to the folder containing the above files and run the following:
```bash
docker-compose up -d relay-server
docker compose up -d relay-server
```

#### Launch Driver
@@ -647,7 +647,7 @@ Weaver provides a [pre-built image](https://github.com/hyperledger/cacti/pkgs/co
- **Enabling TLS**:
- You can make your driver accept TLS connections by specifying `DRIVER_TLS` as `true` and specifying a TLS certificate file path and private key file path in `DRIVER_TLS_CERT_PATH` and `DRIVER_TLS_KEY_PATH` respectively. The same certificate should be specified in this driver's definition in the `drivers` section in the `config.toml` file of your relay in the `tlsca_cert_path` property (see the earlier section on relay configuration).
- To communicate with your network' relay using TLS (i.e., if the relay is TLS-enabled), specify that relay's TLS CA certificate path in `RELAY_TLSCA_CERT_PATH` (currently only one certificate can be configured) and set `RELAY_TLS` to `true`. This CA certificate should match the one specified in the `cert_path` property in the relay's `config.toml` file (see the earlier section on relay configuration):
- You can point to the folder in your host system containing the certificate and key using the `TLS_CREDENTIALS_DIR` variable. (This folder will be synced to the `/fabric-driver/credentials` folder in the Fabric Driver container as specified in the [docker-compose file](https://github.com/hyperledger/cacti/blob/main/weaver/core/drivers/fabric-driver/docker-compose.yml).) Make sure you point to the right certificate and key file paths within the container using the `DRIVER_TLS_CERT_PATH`, `DRIVER_TLS_KEY_PATH`, and `RELAY_TLSCA_CERT_PATH` variables.
- You can point to the folder in your host system containing the certificate and key using the `TLS_CREDENTIALS_DIR` variable. (This folder will be synced to the `/fabric-driver/credentials` folder in the Fabric Driver container as specified in the [docker compose file](https://github.com/hyperledger/cacti/blob/main/weaver/core/drivers/fabric-driver/docker-compose.yml).) Make sure you point to the right certificate and key file paths within the container using the `DRIVER_TLS_CERT_PATH`, `DRIVER_TLS_KEY_PATH`, and `RELAY_TLSCA_CERT_PATH` variables.

- `config.json`: This contains settings used to connect to a CA of a Fabric network organization and enroll a client. A sample is given below:
```json
@@ -669,7 +669,7 @@ Weaver provides a [pre-built image](https://github.com/hyperledger/cacti/pkgs/co
- As in the `.env` configuration, you should pick an organization for the driver to associate with. The `admin` section specifies the registrar name and password (this should be familiar to any Fabric network administrator) used to enroll clients. Default values of `admin` and `adminpw` are specified above as examples, which you should replace with the right values configured in your network organization's CA.
- `<affiliation>` should be what's specified in your organization's Fabric CA server configuration. The default is `org1.department1`, but you should look up the appropriate value from the CA server's configuration file.
- `<msp-id>` should be set to the (or an) MSP ID of the selected organization.
- `<ca-service-endpoint>` should be set to the CA server's endpoint. If you launched your CA server as a container from a docker-compose file, this should be set to the container's service name.
- `<ca-service-endpoint>` should be set to the CA server's endpoint. If you launched your CA server as a container from a docker compose file, this should be set to the container's service name.

| Notes |
|:------|
@@ -679,7 +679,7 @@ Weaver provides a [pre-built image](https://github.com/hyperledger/cacti/pkgs/co

To start the driver, navigate to the folder containing the above files and run the following:
```bash
docker-compose up -d
docker compose up -d
```

#### Launch IIN Agents
@@ -790,13 +790,13 @@ Weaver provides a [pre-built image](https://github.com/hyperledger/cacti/pkgs/co
- `EXTERNAL_NETWORK`: Set to the network [name](https://docs.docker.com/compose/networking/) of your Fabric network.
- **Enabling TLS**:
- Make your IIN Agent accept TLS connections by specifying `IIN_AGENT_TLS` as `true` and specifying a TLS certificate file path and private key file path in `IIN_AGENT_TLS_CERT_PATH` and `IIN_AGENT_TLS_KEY_PATH` respectively. The same certificate should be specified in this agent's JSON object in another agent's `dnsconfig.json` file under the appropriate security domain and IIN Agent ID scope.
- You can point to the folder in your host system containing the certificate and key using the `TLS_CREDENTIALS_DIR` variable. (This folder will be synced to the `/opt/iinagent/credentials` folder in the IIN Agent container as specified in the [docker-compose file](https://github.com/hyperledger/cacti/blob/main/weaver/core/identity-management/iin-agent/docker-compose.yml).) Make sure you point to the right certificate and key file paths within the container using the `IIN_AGENT_TLS_CERT_PATH` and `IIN_AGENT_TLS_KEY_PATH` variables respectively.
- You can point to the folder in your host system containing the certificate and key using the `TLS_CREDENTIALS_DIR` variable. (This folder will be synced to the `/opt/iinagent/credentials` folder in the IIN Agent container as specified in the [docker compose file](https://github.com/hyperledger/cacti/blob/main/weaver/core/identity-management/iin-agent/docker-compose.yml).) Make sure you point to the right certificate and key file paths within the container using the `IIN_AGENT_TLS_CERT_PATH` and `IIN_AGENT_TLS_KEY_PATH` variables respectively.

- `docker-compose.yaml`: This specifies the properties of the IIN agent container. You can use the [file in the repository](https://github.com/hyperledger/cacti/blob/main/weaver/core/identity-management/iin-agent/docker-compose.yml) verbatim.

Now to start the IIN agent, navigate to the folder containing the above files and run the following:
```bash
docker-compose up -d
docker compose up -d
```

Repeat the above steps to launch an IIN Agent for every other organization on your channnel, i.e., create similar configuration files in an organization-specific folder. Make sure you:
4 changes: 2 additions & 2 deletions weaver/core/drivers/corda-driver/README.md
Original file line number Diff line number Diff line change
@@ -111,7 +111,7 @@ To push image to github container registry:

**NOTE:** Push image to `hyperledger-labs` only after PR approval, first test it by deploying it on your fork by running (instead of last step above): `make push-image DOCKER_REGISTRY=ghcr.io/<username>`, where replace `<username>` with your git username.

### Docker-Compose Deployment
### Docker Compose Deployment

* Copy `.env.docker.template` to `.env`
- `NETWORK_NAME`: Used as suffix to driver-corda container name, i.e. `driver-corda-<network-name>` will be the name of the container.
@@ -133,7 +133,7 @@ To push image to github container registry:
* Create a Personal Access Token with read packages access in github. Refer [Creating a Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) for help.
* Run `docker login ghcr.io` and use your github username and personal access token as password.
* Run: `make deploy`.
* To stop, run: `docker-compose down`
* To stop, run: `docker compose down`

## Documentation

4 changes: 2 additions & 2 deletions weaver/core/drivers/corda-driver/makefile
Original file line number Diff line number Diff line change
@@ -52,11 +52,11 @@ run:

.PHONY: deploy
deploy:
docker-compose $(COMPOSE_ARG) up -d
docker compose $(COMPOSE_ARG) up -d

.PHONY: stop
stop:
docker-compose $(COMPOSE_ARG) down
docker compose $(COMPOSE_ARG) down

.PHONY: clean
clean:
4 changes: 2 additions & 2 deletions weaver/core/drivers/fabric-driver/makefile
Original file line number Diff line number Diff line change
@@ -63,10 +63,10 @@ push-image-latest:

deploy:
mkdir -p wallet-$(NETWORK_NAME) && chmod 777 wallet-$(NETWORK_NAME)
docker-compose $(COMPOSE_ARG) up -d
docker compose $(COMPOSE_ARG) up -d

stop:
docker-compose $(COMPOSE_ARG) down
docker compose $(COMPOSE_ARG) down

re-deploy: stop deploy

6 changes: 3 additions & 3 deletions weaver/core/drivers/fabric-driver/readme.md
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ Note: Can also be run in mocked mode by setting environment variable `MOCK=true`

Make sure the env and config file have the expected values.

Update the docker-compose with the correct external network and ports exposed
Update the docker compose with the correct external network and ports exposed

To do a full build run `make build-image`. This update/clones protos, generates js protos and compiles typescript.

@@ -67,8 +67,8 @@ To deploy, run `make deploy`
* Run `docker login ghcr.io` and use your github username and personal access token as password.
* Copy `.env.docker.template` to `.env` and make changes appropriately (like correcting the base path of repo, changing network name if required etc, check image details here: [cacti-weaver-fabric-driver](https://github.com/hyperledger/cacti/pkgs/container/cacti-weaver-fabric-driver)).
* Make sure connection profile used for docker, containers correct hostnames instead of localhost in urls.
* If deploying more than one driver on same host, make sure to change service name in docker-compose to avoid conflicts.
* Finally run `docker-compose up -d` to deploy the fabric driver.
* If deploying more than one driver on same host, make sure to change service name in docker compose to avoid conflicts.
* Finally run `docker compose up -d` to deploy the fabric driver.


### TL/MP Environment
4 changes: 2 additions & 2 deletions weaver/core/identity-management/iin-agent/makefile
Original file line number Diff line number Diff line change
@@ -65,10 +65,10 @@ push-image-latest:
deploy:
chmod 777 $(DLT_SPECIFIC_DIR)
docker network create iin || true
docker-compose $(COMPOSE_ARG) up -d
docker compose $(COMPOSE_ARG) up -d

stop:
docker-compose $(COMPOSE_ARG) down
docker compose $(COMPOSE_ARG) down

re-deploy: stop deploy

8 changes: 4 additions & 4 deletions weaver/core/relay/Makefile
Original file line number Diff line number Diff line change
@@ -155,17 +155,17 @@ pushi-images: push-server push-client push-driver push-allinone
.PHONY: start
start:
docker network create relay || true
docker-compose $(COMPOSE_ARG) up -d
docker compose $(COMPOSE_ARG) up -d
# Starts an instance of the relay container.
#
.PHONY: start-server
start-server:
docker network create relay || true
docker-compose $(COMPOSE_ARG) up -d relay-server
docker compose $(COMPOSE_ARG) up -d relay-server

.PHONY: stop
stop:
docker-compose $(COMPOSE_ARG) down
docker compose $(COMPOSE_ARG) down

.PHONY: convert-compose-method1
convert-compose-method1:
@@ -182,7 +182,7 @@ clean:
@echo -e "\033[1mCLEAN\033[0m - Removing all artifacts..."
-rm -rf protos-rs
-rm fingerprint.json
-docker-compose down
-docker compose down
-docker rmi $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_SERVER)
-docker rmi $(DOCKER_IMAGE_SERVER)
-docker rmi $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_CLIENT)
8 changes: 4 additions & 4 deletions weaver/core/relay/relay-docker.md
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ First **login** to github container registry:
* Create a Personal Access Token with read packages access in github. Refer [Creating a Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) for help.
* Run `docker login ghcr.io` and use your github username and personal access token as password.

**Some sample steps to deploy relay using docker-compose when Config File is available:**
**Some sample steps to deploy relay using docker compose when Config File is available:**

* Copy `.env.template` file to `.env`.
* Keep following Environment Variables in `.env` and delete/ignore rest:
@@ -162,10 +162,10 @@ First **login** to github container registry:
* Tip: If running all relays on same host, make sure to change service name before each relay deployment, to avoid conflict in names.
* Run `make convert-compose-method1`.
* Create docker network named `relay`: `docker network create relay`.
* To deploy relay, run: `docker-compose up relay-server -d` (Given relay-server is the service name in docker-compose).
* To deploy relay, run: `docker compose up relay-server -d` (Given relay-server is the service name in docker-compose).
* Also `make start-server` does the above 2 steps, if service name is not changed.

**Some sample steps to deploy relay using docker-compose when Config is not available:**
**Some sample steps to deploy relay using docker compose when Config is not available:**

* Copy `.env.template.2` file to `.env`.
* Configure the following environment variables in `.env` and delete (or ignore) the rest:
@@ -197,7 +197,7 @@ First **login** to github container registry:
* Run `make convert-compose-method2`.
* Tip: If running all relays on same host, make sure to change service name before each relay deployment, to avoid conflict in names.
* Create docker network named `relay`: `docker network create relay`.
* To deploy relay, run: `docker-compose up relay-server -d` (Given relay-server is the service name in docker-compose).
* To deploy relay, run: `docker compose up relay-server -d` (Given relay-server is the service name in docker-compose).
* Also `make start-server` does the above 2 steps, if service name is not changed.

## Push Relay image to Github container registry
Original file line number Diff line number Diff line change
@@ -511,7 +511,7 @@ Weaver provides a [pre-built image](https://github.com/hyperledger/cacti/pkgs/co

To start the relay server, navigate to the folder containing the above files and run the following:
```bash
docker-compose up -d relay-server
docker compose up -d relay-server
```

#### Launch Driver
@@ -544,13 +544,13 @@ Weaver provides a [pre-built image](https://github.com/hyperledger/cacti/pkgs/co
- **Enabling TLS**:
- You can make your driver accept TLS connections by specifying `DRIVER_TLS` as `true` and specifying a TLS certificate file path and private key file path in `DRIVER_TLS_CERT_PATH` and `DRIVER_TLS_KEY_PATH` respectively. The same certificate should be specified in this driver's definition in the `drivers` section in the `config.toml` file of your relay in the `tlsca_cert_path` property (see the earlier section on relay configuration).
- To communicate with your network' relay using TLS (i.e., if the relay is TLS-enabled), specify that relay's TLS CA certificate path in `RELAY_TLSCA_CERT_PATH` (currently only one certificate can be configured) and set `RELAY_TLS` to `true`. This CA certificate should match the one specified in the `cert_path` property in the relay's `config.toml` file (see the earlier section on relay configuration):
- You can point to the folder in your host system containing the certificate and key using the `TLS_CREDENTIALS_DIR` variable. (This folder will be synced to the `/corda-driver/credentials` folder in the Fabric Driver container as specified in the [docker-compose file](https://github.com/hyperledger/cacti/blob/main/weaver/core/drivers/fabric-driver/docker-compose.yml).) Make sure you point to the right certificate and key file paths within the container using the `DRIVER_TLS_CERT_PATH`, `DRIVER_TLS_KEY_PATH`, and `RELAY_TLSCA_CERT_PATH` variables.
- You can point to the folder in your host system containing the certificate and key using the `TLS_CREDENTIALS_DIR` variable. (This folder will be synced to the `/corda-driver/credentials` folder in the Fabric Driver container as specified in the [docker compose file](https://github.com/hyperledger/cacti/blob/main/weaver/core/drivers/fabric-driver/docker-compose.yml).) Make sure you point to the right certificate and key file paths within the container using the `DRIVER_TLS_CERT_PATH`, `DRIVER_TLS_KEY_PATH`, and `RELAY_TLSCA_CERT_PATH` variables.

- `docker-compose.yaml`: This specifies the properties of the driver container. You can use the [file in the repository](https://github.com/hyperledger/cacti/blob/main/weaver/core/drivers/corda-driver/docker-compose.yml) verbatim.

To start the driver, navigate to the folder containing the above files and run the following:
```bash
docker-compose up -d
docker compose up -d
```

#### Vault Initialization
Loading