From bdd5fac5b35f56ce7b632b91270a2d8a13f88e10 Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Tue, 27 Feb 2024 15:33:29 -0300 Subject: [PATCH 01/16] Add cli image job, update docs, and move the docker folder to outside project-template --- .github/workflows/ci.yml | 30 -------------- .github/workflows/publish-cli-image.yml | 37 +++++++++++++++++ .../docker/Dockerfile | 3 -- .../{chaincode-template => }/docker/README.md | 0 chain-cli/src/commands/init/index.ts | 5 --- docs/getting-started.md | 41 ++++++++++++------- 6 files changed, 63 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/publish-cli-image.yml rename chain-cli/{chaincode-template => }/docker/Dockerfile (83%) rename chain-cli/{chaincode-template => }/docker/README.md (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3719acd8a..41f54cb1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,36 +121,6 @@ jobs: exit 1 fi - windows-init-command: - name: Init Command on Windows - runs-on: windows-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 18 - - name: Install dependencies - run: npm install - - name: Build CLI for windows and link it - run: | - cd chain-cli - npm install - npm run build-win - npm link --force - - name: Initialize a project and validate the package.json - run: galachain init test-project - - name: Check if the package.json contains '@gala-chain/test-project' using windows command - run: | - $package = Get-Content -Path test-project/package.json -Raw - if ($package -match '@gala-chain/test-project') { - Write-Host "package.json contains '@gala-chain/test-project'" - } else { - Write-Host "package.json does not contain '@gala-chain/test-project'" - exit 1 - } - chaincode-template-lint: name: Chaincode Template Lint runs-on: ubuntu-22.04 diff --git a/.github/workflows/publish-cli-image.yml b/.github/workflows/publish-cli-image.yml new file mode 100644 index 000000000..7bfc89f94 --- /dev/null +++ b/.github/workflows/publish-cli-image.yml @@ -0,0 +1,37 @@ +name: Publish CLI Docker image +on: + push: + paths: + - 'xxx/docker/Dockerfile' # TODO: replace with the correct path to the Dockerfile + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}-cli + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./chain-cli/docker + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/chain-cli/chaincode-template/docker/Dockerfile b/chain-cli/docker/Dockerfile similarity index 83% rename from chain-cli/chaincode-template/docker/Dockerfile rename to chain-cli/docker/Dockerfile index 0d9d4e1a2..d301b6f37 100644 --- a/chain-cli/chaincode-template/docker/Dockerfile +++ b/chain-cli/docker/Dockerfile @@ -27,6 +27,3 @@ RUN npm install # Expose port 3010 EXPOSE 3010 - -# Start the Docker daemon as a background process and tail its log file -CMD dockerd > /var/log/dockerd.log 2>&1 & tail -f /var/log/dockerd.log diff --git a/chain-cli/chaincode-template/docker/README.md b/chain-cli/docker/README.md similarity index 100% rename from chain-cli/chaincode-template/docker/README.md rename to chain-cli/docker/README.md diff --git a/chain-cli/src/commands/init/index.ts b/chain-cli/src/commands/init/index.ts index 9806f5781..f9a44a0ca 100644 --- a/chain-cli/src/commands/init/index.ts +++ b/chain-cli/src/commands/init/index.ts @@ -68,11 +68,6 @@ export default class Init extends BaseCommand { } copyChaincodeTemplate(destinationPath: string): void { - if (process.platform === "win32") { - const sourceTemplateDir = path.resolve(__dirname, "..", "..", "..", "chaincode-template"); - execSync(`xcopy ${sourceTemplateDir} ${destinationPath} /E /I`); - return; - } const sourceTemplateDir = path.resolve(require.resolve("."), "../../../chaincode-template"); execSync(`cp -R ${sourceTemplateDir} ${destinationPath}`); } diff --git a/docs/getting-started.md b/docs/getting-started.md index 4694eb015..c0327595e 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -142,41 +142,52 @@ Navigate to [http://localhost:3010/blocks](http://localhost:3010/blocks) to see Navigate to [http://localhost:3010/graphiql](http://localhost:3010/graphiql) to interact with GraphQL and execute queries. -## Use Docker file + Dev Containers (Linux, MacOS or Windows) +## Use Docker image (Linux, MacOS or Windows) ### Requirements -- [VSCode](https://code.visualstudio.com/) -- [Dev Containers Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) -- Node.js - Docker -### 1. Install our CLI +### 1. Run the Docker image ``` -npm i -g @gala-games/chain-cli +docker run --privileged -d -p 3010:3010 -it --name ghcr.io/gala-games/sdk-cli:latest ``` -Check the CLI: +### 2. Open the running container + +## 2.1 Open the container with bash ``` -galachain --help +docker exec -ti /bin/bash ``` -### 2. Initialize your project +## 2.2 Open the container with VSCode (Requires VSCode and Dev Containers Extension) + +Open VSCode and press F1 to open the Command Palette and search for `Dev Containers: Attach to Running Container` + +After attach the container you may have to open the project folder manually. + +### 3. Start the network + +Once the terminal is open, start the network ``` -galachain init +npm run network:start ``` -It will create a sample project inside `` directory. +The network is going to start in dev mode and the prompt will be left showing the logs, so don't close the prompt and open new ones to proceed with the following commands. -### 3. Docker file and Instructions +### 4. Run integration tests -Navigate to the docker folder where you can find a Docker file and instructions about how to use it. +Now you can run integration tests with: ``` -cd /docker +npm run test:e2e ``` -Follow the steps on the `README.md` file. +### 5. Verify changes in block browser and GraphQL + +Navigate to [http://localhost:3010/blocks](http://localhost:3010/blocks) to see our block browser which allows you to see what's saved on your local GalaChain network. + +Navigate to [http://localhost:3010/graphiql](http://localhost:3010/graphiql) to interact with GraphQL and execute queries. From caf13a5c076fcb05ec3ba570d9e47c183cf16fd7 Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Tue, 27 Feb 2024 17:51:16 -0300 Subject: [PATCH 02/16] Update docs --- chain-cli/docker/Dockerfile | 7 ++--- chain-cli/docker/README.md | 51 +++++++++++++++++++------------------ docs/getting-started.md | 6 ++++- 3 files changed, 33 insertions(+), 31 deletions(-) diff --git a/chain-cli/docker/Dockerfile b/chain-cli/docker/Dockerfile index d301b6f37..72a1c2edc 100644 --- a/chain-cli/docker/Dockerfile +++ b/chain-cli/docker/Dockerfile @@ -13,14 +13,11 @@ RUN npm install -g @gala-chain/cli # Install Nodemon globally RUN npm install -g nodemon -# Define the build-time argument for the project name with a default value -ARG PROJECT_NAME=proj-galachain - # Initialize a project with galachain -RUN galachain init "$PROJECT_NAME" +RUN galachain init chaincode-template # Change working directory to the project directory -WORKDIR /$PROJECT_NAME +WORKDIR /chaincode-template # Install project dependencies RUN npm install diff --git a/chain-cli/docker/README.md b/chain-cli/docker/README.md index 798fa6859..9f0aa2786 100644 --- a/chain-cli/docker/README.md +++ b/chain-cli/docker/README.md @@ -2,50 +2,51 @@ ## Base requirement -- Docker Desktop or Docker CLI installed on your machine. -- VS Code with [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension. - -## Build the image -Run the docker build command - - $ docker build --build-arg PROJECT_NAME= -t . - -You can also run this command without the project name argument: - - $ docker build -t . - -This will run the `galachain init ` command with a default project-name of `proj-galachain` - +- Docker Desktop or Docker CLI. +- [Optional] VS Code with [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension. ## Run a container Run a container from the built image: - $ docker run --privileged -d -p 3010:3010 -it --name + $ docker run --privileged -d -p 3010:3010 -it --name ghcr.io/gala-games/sdk-cli:latest Make sure the container is up and running. +The Docker image initializes a new project with the name `chaincode-template` by default. -## Attach VS Code to the Container +## Open the running container -Make sure you have the Dev Containers extension installed in VS code. +### Open the container with bash -Run `Dev Containers: Attach to a running container` +``` +docker exec -ti /bin/bash +``` -After attach the container you may have to open the project folder manually. +### Open the container with VSCode (Requires VSCode and Dev Containers Extension) + +Open VSCode and press F1 to open the Command Palette and search for `Dev Containers: Attach to Running Container` +After attach the container you may have to open the project folder manually. -## Open the Dev Container Terminal and Start Network +## Start the network Once the terminal is open, start the network - $ npm run network:start + +``` +npm run network:start +``` The network is going to start in dev mode and the prompt will be left showing the logs, so don't close the prompt and open new ones to proceed with the following commands. -## Open a new Dev Container Terminal and Run Tests +## Run integration tests - $ npm run test:e2e +Now you can run integration tests with: +``` +npm run test:e2e +``` ## Verify changes in block browser and GraphQL -Navigate to http://localhost:3010/blocks to see our block browser which allows you to see what's saved on your local GalaChain network. -Navigate to http://localhost:3010/graphiql to interact with GraphQL and execute queries. +Navigate to [http://localhost:3010/blocks](http://localhost:3010/blocks) to see our block browser which allows you to see what's saved on your local GalaChain network. + +Navigate to [http://localhost:3010/graphiql](http://localhost:3010/graphiql) to interact with GraphQL and execute queries. \ No newline at end of file diff --git a/docs/getting-started.md b/docs/getting-started.md index c0327595e..8814c9d6c 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -146,7 +146,8 @@ Navigate to [http://localhost:3010/graphiql](http://localhost:3010/graphiql) to ### Requirements -- Docker +- Docker Desktop or Docker CLI. +- [Optional] VS Code with [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension. ### 1. Run the Docker image @@ -154,6 +155,9 @@ Navigate to [http://localhost:3010/graphiql](http://localhost:3010/graphiql) to docker run --privileged -d -p 3010:3010 -it --name ghcr.io/gala-games/sdk-cli:latest ``` +Make sure the container is up and running. +The Docker image initializes a new project with the name `chaincode-template` by default. + ### 2. Open the running container ## 2.1 Open the container with bash From 9df86dec463cb58cc9481c10546bceaf8927baa6 Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Wed, 28 Feb 2024 07:59:11 -0300 Subject: [PATCH 03/16] Update docker registry path and fix unifyVersions script --- .github/workflows/publish-cli-image.yml | 2 +- chain-cli/docker/README.md | 2 +- docs/getting-started.md | 2 +- unifyVersions.js | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-cli-image.yml b/.github/workflows/publish-cli-image.yml index 7bfc89f94..90e443ad5 100644 --- a/.github/workflows/publish-cli-image.yml +++ b/.github/workflows/publish-cli-image.yml @@ -6,7 +6,7 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }}-cli + IMAGE_NAME: gala-chain/${{ github.repository }} jobs: build-and-push-image: diff --git a/chain-cli/docker/README.md b/chain-cli/docker/README.md index 9f0aa2786..4e36cf4fb 100644 --- a/chain-cli/docker/README.md +++ b/chain-cli/docker/README.md @@ -8,7 +8,7 @@ ## Run a container Run a container from the built image: - $ docker run --privileged -d -p 3010:3010 -it --name ghcr.io/gala-games/sdk-cli:latest + $ docker run --privileged -d -p 3010:3010 -it --name ghcr.io/gala-chain/sdk:latest Make sure the container is up and running. The Docker image initializes a new project with the name `chaincode-template` by default. diff --git a/docs/getting-started.md b/docs/getting-started.md index 8814c9d6c..a24ef19cd 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -152,7 +152,7 @@ Navigate to [http://localhost:3010/graphiql](http://localhost:3010/graphiql) to ### 1. Run the Docker image ``` -docker run --privileged -d -p 3010:3010 -it --name ghcr.io/gala-games/sdk-cli:latest +docker run --privileged -d -p 3010:3010 -it --name ghcr.io/gala-chain/sdk:latest ``` Make sure the container is up and running. diff --git a/unifyVersions.js b/unifyVersions.js index 35bdffb52..353a12bf0 100755 --- a/unifyVersions.js +++ b/unifyVersions.js @@ -95,9 +95,10 @@ packages.forEach(({ packageJson, packageJsonPath }) => { } }); +const { execSync } = require("child_process"); + // execute `npm install` in the root directory to update the lock file and licenses execSync("npm install"); // execute `npm run build` in chain-cli to update the new version in README.md and oclif.manifest.json -const { execSync } = require("child_process"); execSync("npm run build", { cwd: "chain-cli" }); \ No newline at end of file From b6fa03bf9a5a4c10fb17aafde6f34c41dfb79444 Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Wed, 28 Feb 2024 08:19:57 -0300 Subject: [PATCH 04/16] Update publish image ci --- .github/workflows/publish-cli-image.yml | 2 +- docs/getting-started.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-cli-image.yml b/.github/workflows/publish-cli-image.yml index 90e443ad5..07c297bf5 100644 --- a/.github/workflows/publish-cli-image.yml +++ b/.github/workflows/publish-cli-image.yml @@ -2,7 +2,7 @@ name: Publish CLI Docker image on: push: paths: - - 'xxx/docker/Dockerfile' # TODO: replace with the correct path to the Dockerfile + - 'chain-cli/docker/Dockerfile' env: REGISTRY: ghcr.io diff --git a/docs/getting-started.md b/docs/getting-started.md index a24ef19cd..a1b3128d7 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -174,7 +174,7 @@ After attach the container you may have to open the project folder manually. ### 3. Start the network -Once the terminal is open, start the network +Once the terminal is open, start the network with: ``` npm run network:start From 1be05afaf177a3395df99799778cc6e73aa4dcbb Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Wed, 28 Feb 2024 08:34:04 -0300 Subject: [PATCH 05/16] Update Docker file to trigger the CI --- chain-cli/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chain-cli/docker/Dockerfile b/chain-cli/docker/Dockerfile index 72a1c2edc..ae75852bf 100644 --- a/chain-cli/docker/Dockerfile +++ b/chain-cli/docker/Dockerfile @@ -13,7 +13,7 @@ RUN npm install -g @gala-chain/cli # Install Nodemon globally RUN npm install -g nodemon -# Initialize a project with galachain +# Initialize a project with a default name of "chaincode-template" RUN galachain init chaincode-template # Change working directory to the project directory From 196d196a852d6b0cdc68405a6771b92a27344e2a Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Wed, 28 Feb 2024 08:38:23 -0300 Subject: [PATCH 06/16] Update docker path --- .github/workflows/publish-cli-image.yml | 2 +- chain-cli/docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-cli-image.yml b/.github/workflows/publish-cli-image.yml index 07c297bf5..bc55e5b14 100644 --- a/.github/workflows/publish-cli-image.yml +++ b/.github/workflows/publish-cli-image.yml @@ -6,7 +6,7 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: gala-chain/${{ github.repository }} + IMAGE_NAME: ${{ github.repository }} jobs: build-and-push-image: diff --git a/chain-cli/docker/Dockerfile b/chain-cli/docker/Dockerfile index ae75852bf..72a1c2edc 100644 --- a/chain-cli/docker/Dockerfile +++ b/chain-cli/docker/Dockerfile @@ -13,7 +13,7 @@ RUN npm install -g @gala-chain/cli # Install Nodemon globally RUN npm install -g nodemon -# Initialize a project with a default name of "chaincode-template" +# Initialize a project with galachain RUN galachain init chaincode-template # Change working directory to the project directory From 43e3d2b72421eec26299971e21c05c9d3ad99eab Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Wed, 28 Feb 2024 09:53:05 -0300 Subject: [PATCH 07/16] Change tag to latest --- .github/workflows/publish-cli-image.yml | 2 +- chain-cli/docker/Dockerfile | 2 +- chain-cli/docker/README.md | 2 +- docs/getting-started.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-cli-image.yml b/.github/workflows/publish-cli-image.yml index bc55e5b14..e966e0418 100644 --- a/.github/workflows/publish-cli-image.yml +++ b/.github/workflows/publish-cli-image.yml @@ -33,5 +33,5 @@ jobs: with: context: ./chain-cli/docker push: true - tags: ${{ steps.meta.outputs.tags }} + tags: latest labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/chain-cli/docker/Dockerfile b/chain-cli/docker/Dockerfile index 72a1c2edc..ae75852bf 100644 --- a/chain-cli/docker/Dockerfile +++ b/chain-cli/docker/Dockerfile @@ -13,7 +13,7 @@ RUN npm install -g @gala-chain/cli # Install Nodemon globally RUN npm install -g nodemon -# Initialize a project with galachain +# Initialize a project with a default name of "chaincode-template" RUN galachain init chaincode-template # Change working directory to the project directory diff --git a/chain-cli/docker/README.md b/chain-cli/docker/README.md index 4e36cf4fb..295f8f37d 100644 --- a/chain-cli/docker/README.md +++ b/chain-cli/docker/README.md @@ -8,7 +8,7 @@ ## Run a container Run a container from the built image: - $ docker run --privileged -d -p 3010:3010 -it --name ghcr.io/gala-chain/sdk:latest + $ docker run --privileged -d -p 3010:3010 -it --name ghcr.io/galachain/sdk:latest Make sure the container is up and running. The Docker image initializes a new project with the name `chaincode-template` by default. diff --git a/docs/getting-started.md b/docs/getting-started.md index a1b3128d7..0eb5fd4c5 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -152,7 +152,7 @@ Navigate to [http://localhost:3010/graphiql](http://localhost:3010/graphiql) to ### 1. Run the Docker image ``` -docker run --privileged -d -p 3010:3010 -it --name ghcr.io/gala-chain/sdk:latest +docker run --privileged -d -p 3010:3010 -it --name ghcr.io/galachain/sdk:latest ``` Make sure the container is up and running. From 0f14b876ebce11a8dc868315315d4ef08b0a3901 Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Wed, 28 Feb 2024 09:56:31 -0300 Subject: [PATCH 08/16] Change tag to latest and remove extract metadata --- .github/workflows/publish-cli-image.yml | 8 +------- chain-cli/docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-cli-image.yml b/.github/workflows/publish-cli-image.yml index e966e0418..a58078e51 100644 --- a/.github/workflows/publish-cli-image.yml +++ b/.github/workflows/publish-cli-image.yml @@ -23,15 +23,9 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: ./chain-cli/docker push: true - tags: latest - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ No newline at end of file diff --git a/chain-cli/docker/Dockerfile b/chain-cli/docker/Dockerfile index ae75852bf..72a1c2edc 100644 --- a/chain-cli/docker/Dockerfile +++ b/chain-cli/docker/Dockerfile @@ -13,7 +13,7 @@ RUN npm install -g @gala-chain/cli # Install Nodemon globally RUN npm install -g nodemon -# Initialize a project with a default name of "chaincode-template" +# Initialize a project with galachain RUN galachain init chaincode-template # Change working directory to the project directory From efe5eadd3c1970b34a115a610958716648a029cc Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Wed, 28 Feb 2024 09:58:14 -0300 Subject: [PATCH 09/16] Use registry in lowercase --- .github/workflows/publish-cli-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-cli-image.yml b/.github/workflows/publish-cli-image.yml index a58078e51..eb4de10f1 100644 --- a/.github/workflows/publish-cli-image.yml +++ b/.github/workflows/publish-cli-image.yml @@ -28,4 +28,4 @@ jobs: with: context: ./chain-cli/docker push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ No newline at end of file + tags: galachain/${{ env.IMAGE_NAME }}:latest \ No newline at end of file From 0d4c911e23f8ca9d59166f93e8e7dcc00fa6991a Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Wed, 28 Feb 2024 09:59:01 -0300 Subject: [PATCH 10/16] Modify docker file to trigger ci --- chain-cli/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chain-cli/docker/Dockerfile b/chain-cli/docker/Dockerfile index 72a1c2edc..ae75852bf 100644 --- a/chain-cli/docker/Dockerfile +++ b/chain-cli/docker/Dockerfile @@ -13,7 +13,7 @@ RUN npm install -g @gala-chain/cli # Install Nodemon globally RUN npm install -g nodemon -# Initialize a project with galachain +# Initialize a project with a default name of "chaincode-template" RUN galachain init chaincode-template # Change working directory to the project directory From 76fbb420ab53b58a7b1fea6cd6696aef04291abf Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Wed, 28 Feb 2024 10:06:49 -0300 Subject: [PATCH 11/16] Use repository name as lowercase --- .github/workflows/publish-cli-image.yml | 9 +++++++-- chain-cli/docker/Dockerfile | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-cli-image.yml b/.github/workflows/publish-cli-image.yml index eb4de10f1..2f4a6fa54 100644 --- a/.github/workflows/publish-cli-image.yml +++ b/.github/workflows/publish-cli-image.yml @@ -6,7 +6,7 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + IMAGE_NAME: galachain/sdk jobs: build-and-push-image: @@ -23,9 +23,14 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Make the repository name lowercase + id: lower-repo + shell: pwsh + run: | + "::set-output name=repository::$($env:GITHUB_REPOSITORY.ToLowerInvariant())" - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: ./chain-cli/docker push: true - tags: galachain/${{ env.IMAGE_NAME }}:latest \ No newline at end of file + tags: ghcr.io/${{ steps.lower-repo.outputs.repository }}:latest \ No newline at end of file diff --git a/chain-cli/docker/Dockerfile b/chain-cli/docker/Dockerfile index ae75852bf..72a1c2edc 100644 --- a/chain-cli/docker/Dockerfile +++ b/chain-cli/docker/Dockerfile @@ -13,7 +13,7 @@ RUN npm install -g @gala-chain/cli # Install Nodemon globally RUN npm install -g nodemon -# Initialize a project with a default name of "chaincode-template" +# Initialize a project with galachain RUN galachain init chaincode-template # Change working directory to the project directory From 8d00b233dcf3f08cc43357c997c8bcf9c41ee8ea Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Wed, 28 Feb 2024 16:54:53 -0300 Subject: [PATCH 12/16] Add windows docker setup ci --- .github/workflows/ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41f54cb1f..7a097fa13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,6 +121,22 @@ jobs: exit 1 fi + windows-docker-setup: + name: Windows Docker Setup + runs-on: windows-latest + container: + image: ghcr.io/galachain/sdk:latest + ports: + - 3010:3010 + steps: + - name: Check the folders and files + shell: bash + run: | + ls -la + - name: Initialize the network + shell: bash + run: npm run network:start + chaincode-template-lint: name: Chaincode Template Lint runs-on: ubuntu-22.04 From dee676dea7b0fb38e24be969f40ccd3e8af18702 Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Thu, 29 Feb 2024 08:42:37 -0300 Subject: [PATCH 13/16] Remove container operation because it only work on linux runners --- .github/workflows/ci.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a097fa13..e953eec36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,18 +124,13 @@ jobs: windows-docker-setup: name: Windows Docker Setup runs-on: windows-latest - container: - image: ghcr.io/galachain/sdk:latest - ports: - - 3010:3010 steps: - - name: Check the folders and files - shell: bash + - name: Run Docker SDK image + run: docker run --privileged -d -p 3010:3010 -it --name template ghcr.io/galachain/sdk:latest + - name: Open the container with bash run: | - ls -la - - name: Initialize the network - shell: bash - run: npm run network:start + docker exec -ti template /bin/bash + ls chaincode-template-lint: name: Chaincode Template Lint From 1c0ba9674d448043656fe6f7f3a3e5d47a17978a Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Thu, 29 Feb 2024 08:43:45 -0300 Subject: [PATCH 14/16] Remove non supported privileged mode --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e953eec36..908140c44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,7 +126,7 @@ jobs: runs-on: windows-latest steps: - name: Run Docker SDK image - run: docker run --privileged -d -p 3010:3010 -it --name template ghcr.io/galachain/sdk:latest + run: docker run -d -p 3010:3010 -it --name template ghcr.io/galachain/sdk:latest - name: Open the container with bash run: | docker exec -ti template /bin/bash From 675cfa4265d718b892e5531f2d2334f71e0c3b75 Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Thu, 29 Feb 2024 08:49:09 -0300 Subject: [PATCH 15/16] Remove windows setup job --- .github/workflows/ci.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 908140c44..41f54cb1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,17 +121,6 @@ jobs: exit 1 fi - windows-docker-setup: - name: Windows Docker Setup - runs-on: windows-latest - steps: - - name: Run Docker SDK image - run: docker run -d -p 3010:3010 -it --name template ghcr.io/galachain/sdk:latest - - name: Open the container with bash - run: | - docker exec -ti template /bin/bash - ls - chaincode-template-lint: name: Chaincode Template Lint runs-on: ubuntu-22.04 From 5dd54322f68618f0933b2987c792e03214c84c1d Mon Sep 17 00:00:00 2001 From: Felipe Fuerback Date: Thu, 29 Feb 2024 14:45:09 -0300 Subject: [PATCH 16/16] Add Troubleshooting section to docs and increase the version to 1.0.16 --- chain-api/package.json | 2 +- chain-cli/README.md | 2 +- chain-cli/chaincode-template/package.json | 12 ++++----- chain-cli/oclif.manifest.json | 2 +- chain-cli/package.json | 4 +-- chain-client/package.json | 4 +-- chain-test/package.json | 6 ++--- chaincode/package.json | 4 +-- docs/getting-started.md | 33 +++++++++++++++++++++++ licenses/licenses.csv | 12 ++++----- package-lock.json | 24 ++++++++--------- package.json | 2 +- 12 files changed, 70 insertions(+), 37 deletions(-) diff --git a/chain-api/package.json b/chain-api/package.json index b44fed67c..2e5111a19 100644 --- a/chain-api/package.json +++ b/chain-api/package.json @@ -1,6 +1,6 @@ { "name": "@gala-chain/api", - "version": "1.0.15", + "version": "1.0.16", "description": "Common types, DTOs (Data Transfer Objects), APIs, signatures, and utils for GalaChain.", "license": "Apache-2.0", "dependencies": { diff --git a/chain-cli/README.md b/chain-cli/README.md index a95ce1f66..604268ddd 100644 --- a/chain-cli/README.md +++ b/chain-cli/README.md @@ -18,7 +18,7 @@ $ npm install -g @gala-chain/cli $ galachain COMMAND running command... $ galachain (--version) -@gala-chain/cli/1.0.15 linux-x64 node-v18.17.0 +@gala-chain/cli/1.0.16 linux-x64 node-v18.17.0 $ galachain --help [COMMAND] USAGE $ galachain COMMAND diff --git a/chain-cli/chaincode-template/package.json b/chain-cli/chaincode-template/package.json index e18eaaf83..afbabdc22 100644 --- a/chain-cli/chaincode-template/package.json +++ b/chain-cli/chaincode-template/package.json @@ -1,6 +1,6 @@ { "name": "@galachain/product", - "version": "1.0.15", + "version": "1.0.16", "description": "Product Chaincode", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", @@ -21,16 +21,16 @@ "update-snapshot": "jest --updateSnapshot" }, "dependencies": { - "@gala-chain/api": "1.0.15", - "@gala-chain/chaincode": "1.0.15", + "@gala-chain/api": "1.0.16", + "@gala-chain/chaincode": "1.0.16", "dotenv": "^16.0.1", "fabric-contract-api": "2.4.2", "fabric-shim": "2.4.2" }, "devDependencies": { - "@gala-chain/cli": "1.0.15", - "@gala-chain/client": "1.0.15", - "@gala-chain/test": "1.0.15", + "@gala-chain/cli": "1.0.16", + "@gala-chain/client": "1.0.16", + "@gala-chain/test": "1.0.16", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/axios": "^0.14.0", "@types/jest": "^29.5.12", diff --git a/chain-cli/oclif.manifest.json b/chain-cli/oclif.manifest.json index 4a58ecc11..b88c06cdb 100644 --- a/chain-cli/oclif.manifest.json +++ b/chain-cli/oclif.manifest.json @@ -1,5 +1,5 @@ { - "version": "1.0.15", + "version": "1.0.16", "commands": { "connect": { "id": "connect", diff --git a/chain-cli/package.json b/chain-cli/package.json index 0ff677e0c..70def0e58 100644 --- a/chain-cli/package.json +++ b/chain-cli/package.json @@ -1,6 +1,6 @@ { "name": "@gala-chain/cli", - "version": "1.0.15", + "version": "1.0.16", "description": "CLI for GalaChain to manage and deploy chaincodes", "license": "Apache-2.0", "bin": { @@ -14,7 +14,7 @@ "/oclif.manifest.json" ], "dependencies": { - "@gala-chain/api": "1.0.15", + "@gala-chain/api": "1.0.16", "@noble/secp256k1": "^1.7.1", "@oclif/core": "^2", "@oclif/plugin-help": "^2", diff --git a/chain-client/package.json b/chain-client/package.json index bda5079b9..4750b505f 100644 --- a/chain-client/package.json +++ b/chain-client/package.json @@ -1,6 +1,6 @@ { "name": "@gala-chain/client", - "version": "1.0.15", + "version": "1.0.16", "description": "GalaChain client library", "license": "Apache-2.0", "scripts": { @@ -21,7 +21,7 @@ "lib" ], "dependencies": { - "@gala-chain/api": "1.0.15", + "@gala-chain/api": "1.0.16", "axios": "^1.6.0", "jsonschema": "^1.4.1", "tslib": "^2.6.2", diff --git a/chain-test/package.json b/chain-test/package.json index 4d885f83e..778cd3e28 100644 --- a/chain-test/package.json +++ b/chain-test/package.json @@ -1,10 +1,10 @@ { "name": "@gala-chain/test", - "version": "1.0.15", + "version": "1.0.16", "description": "Unit testing and integration testing for GalaChain", "license": "Apache-2.0", "dependencies": { - "@gala-chain/client": "1.0.15", + "@gala-chain/client": "1.0.16", "nanoid": "^3.3.6", "tslib": "^2.6.2", "path": "0.12.7", @@ -12,7 +12,7 @@ "@jest/globals": "29.7.0" }, "peerDependencies": { - "@gala-chain/api": "1.0.15", + "@gala-chain/api": "1.0.16", "bignumber.js": "*", "class-transformer": "*", "elliptic": "*", diff --git a/chaincode/package.json b/chaincode/package.json index 08186ebea..e97a9faf0 100644 --- a/chaincode/package.json +++ b/chaincode/package.json @@ -1,6 +1,6 @@ { "name": "@gala-chain/chaincode", - "version": "1.0.15", + "version": "1.0.16", "description": "Framework for building chaincodes on GalaChain", "license": "Apache-2.0", "type": "commonjs", @@ -21,7 +21,7 @@ "test": "jest" }, "dependencies": { - "@gala-chain/api": "1.0.15", + "@gala-chain/api": "1.0.16", "fabric-contract-api": "2.4.2", "fabric-shim": "2.4.2", "nanoid": "^3.3.6", diff --git a/docs/getting-started.md b/docs/getting-started.md index 0eb5fd4c5..5cdb3fb45 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -195,3 +195,36 @@ npm run test:e2e Navigate to [http://localhost:3010/blocks](http://localhost:3010/blocks) to see our block browser which allows you to see what's saved on your local GalaChain network. Navigate to [http://localhost:3010/graphiql](http://localhost:3010/graphiql) to interact with GraphQL and execute queries. + +# Troubleshooting + +## Docker Desktop on Windows + +#### If you are using Windows with WSL don't forget to enable integration with WSL on Docker Desktop. +``` +Docker Desktop > Settins > Resources > WSL Integration +``` + +#### Docker: image operating system "linux" cannot be used on this platform: operating system is not supported. + +Some versions of the Docker Desktop for Windows have a bug that prevents the use of Linux images. If you are facing this issue, you can use the WSL2 backend to run Docker. To do so, go to Docker Desktop > Settings > General and select WSL2 as the default backend. + +#### Docker: "no matching manifest for windows/amd64 in the manifest list entries". + +To bypass this issue you can run the Docker daemon in experimental mode: + +``` +Docker Desktop > Settins > Docker Engine > Edit the Docker daemon file > Set the "experimental": true > Apply & Restart +``` + +## Docker + +#### Docker: Error response from daemon: Conflict. The container name "/" is already in use by container "". + +You have to remove (or rename) that container to be able to reuse that name. + +## WSL + +#### ./fablo-target/fabric-config/configtx.yaml: no such file or directory + +Make sure you are running it as a administrator of the cmd or powershell. diff --git a/licenses/licenses.csv b/licenses/licenses.csv index 427bd87a3..aea280385 100644 --- a/licenses/licenses.csv +++ b/licenses/licenses.csv @@ -138,12 +138,12 @@ "@eslint/js@8.55.0","@eslint/js","8.55.0","https://github.com/eslint/eslint","ESLint JavaScript language implementation","MIT" "@fidm/asn1@1.0.4","@fidm/asn1","1.0.4","https://github.com/fidm/asn1","ASN.1/DER, PEM for Node.js","MIT" "@fidm/x509@1.2.1","@fidm/x509","1.2.1","https://github.com/fidm/x509","Pure JavaScript X509 certificate tools for Node.js","MIT" -"@gala-chain/api@1.0.15","@gala-chain/api","1.0.15","","Common types, DTOs (Data Transfer Objects), APIs, signatures, and utils for GalaChain.","Apache-2.0" -"@gala-chain/chaincode@1.0.15","@gala-chain/chaincode","1.0.15","","Framework for building chaincodes on GalaChain","Apache-2.0" -"@gala-chain/cli@1.0.15","@gala-chain/cli","1.0.15","","CLI for GalaChain to manage and deploy chaincodes","Apache-2.0" -"@gala-chain/client@1.0.15","@gala-chain/client","1.0.15","","GalaChain client library","Apache-2.0" -"@gala-chain/sdk@1.0.15","@gala-chain/sdk","1.0.15","","Welcome to developing with GalaChain! GalaChain SDK is a set of TS tools to help you develop on GalaChain:","UNLICENSED" -"@gala-chain/test@1.0.15","@gala-chain/test","1.0.15","","Unit testing and integration testing for GalaChain","Apache-2.0" +"@gala-chain/api@1.0.16","@gala-chain/api","1.0.16","","Common types, DTOs (Data Transfer Objects), APIs, signatures, and utils for GalaChain.","Apache-2.0" +"@gala-chain/chaincode@1.0.16","@gala-chain/chaincode","1.0.16","","Framework for building chaincodes on GalaChain","Apache-2.0" +"@gala-chain/cli@1.0.16","@gala-chain/cli","1.0.16","","CLI for GalaChain to manage and deploy chaincodes","Apache-2.0" +"@gala-chain/client@1.0.16","@gala-chain/client","1.0.16","","GalaChain client library","Apache-2.0" +"@gala-chain/sdk@1.0.16","@gala-chain/sdk","1.0.16","","Welcome to developing with GalaChain! GalaChain SDK is a set of TS tools to help you develop on GalaChain:","UNLICENSED" +"@gala-chain/test@1.0.16","@gala-chain/test","1.0.16","","Unit testing and integration testing for GalaChain","Apache-2.0" "@gar/promisify@1.1.3","@gar/promisify","1.1.3","https://github.com/wraithgar/gar-promisify","Promisify an entire class or object","MIT" "@grpc/grpc-js@1.9.7","@grpc/grpc-js","1.9.7","https://github.com/grpc/grpc-node/tree/master/packages/grpc-js","gRPC Library for Node - pure JS implementation","Apache-2.0" "@grpc/proto-loader@0.6.13","@grpc/proto-loader","0.6.13","https://github.com/grpc/grpc-node","gRPC utility library for loading .proto files","Apache-2.0" diff --git a/package-lock.json b/package-lock.json index 3fa703ddd..cb4d172a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gala-chain/sdk", - "version": "1.0.15", + "version": "1.0.16", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@gala-chain/sdk", - "version": "1.0.15", + "version": "1.0.16", "license": "Apache-2.0", "workspaces": [ "chain-cli", @@ -51,7 +51,7 @@ }, "chain-api": { "name": "@gala-chain/api", - "version": "1.0.15", + "version": "1.0.16", "license": "Apache-2.0", "dependencies": { "bignumber.js": "^9.0.2", @@ -74,10 +74,10 @@ }, "chain-cli": { "name": "@gala-chain/cli", - "version": "1.0.15", + "version": "1.0.16", "license": "Apache-2.0", "dependencies": { - "@gala-chain/api": "1.0.15", + "@gala-chain/api": "1.0.16", "@noble/secp256k1": "^1.7.1", "@oclif/core": "^2", "@oclif/plugin-help": "^2", @@ -409,10 +409,10 @@ }, "chain-client": { "name": "@gala-chain/client", - "version": "1.0.15", + "version": "1.0.16", "license": "Apache-2.0", "dependencies": { - "@gala-chain/api": "1.0.15", + "@gala-chain/api": "1.0.16", "axios": "^1.6.0", "jsonschema": "^1.4.1", "process": "0.11.10", @@ -439,10 +439,10 @@ }, "chain-test": { "name": "@gala-chain/test", - "version": "1.0.15", + "version": "1.0.16", "license": "Apache-2.0", "dependencies": { - "@gala-chain/client": "1.0.15", + "@gala-chain/client": "1.0.16", "@jest/globals": "29.7.0", "nanoid": "^3.3.6", "path": "0.12.7", @@ -450,7 +450,7 @@ "tslib": "^2.6.2" }, "peerDependencies": { - "@gala-chain/api": "1.0.15", + "@gala-chain/api": "1.0.16", "bignumber.js": "*", "class-transformer": "*", "elliptic": "*", @@ -461,10 +461,10 @@ }, "chaincode": { "name": "@gala-chain/chaincode", - "version": "1.0.15", + "version": "1.0.16", "license": "Apache-2.0", "dependencies": { - "@gala-chain/api": "1.0.15", + "@gala-chain/api": "1.0.16", "fabric-contract-api": "2.4.2", "fabric-shim": "2.4.2", "nanoid": "^3.3.6", diff --git a/package.json b/package.json index cdcf343ce..14de7abfb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gala-chain/sdk", - "version": "1.0.15", + "version": "1.0.16", "license": "Apache-2.0", "scripts": { "lint": "nx run-many -t lint",