Skip to content

Commit

Permalink
Merge pull request #491 from hyperledger-labs/publish-docker-ghcr
Browse files Browse the repository at this point in the history
Update Fablo Docker image registry to GHCR
  • Loading branch information
dzikowski authored Sep 17, 2024
2 parents e26f374 + 4d59aa2 commit 882d50c
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 35 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/publish-docker-on-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
branches:
- main

env:
IMAGE_NAME: softwaremill/fablo

jobs:
publish-docker:
runs-on: ubuntu-latest
Expand All @@ -21,11 +18,12 @@ jobs:
with:
driver: docker-container

- name: Login to DockerHub
uses: docker/login-action@v1
- name: Login to GHCR
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Publish Docker image
run: |
FABLO_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json")
docker push softwaremill/fablo:"$FABLO_VERSION"
docker push ghcr.io/hyperledger-labs/fablo:"$FABLO_VERSION"
- name: Create GitHub Release
uses: "marvinpinto/action-automatic-releases@latest"
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
## 0.3.0

### Features
* Add [Fablo REST](https://github.com/softwaremill/fablo-rest/) support
* Add [Fablo REST](https://github.com/fablo-io/fablo-rest/) support
* By default all peers are anchor peers
* Support `postGenerate` hook
* Added support for [Orderer sharding](https://github.com/hyperledger-labs/fablo/issues/220) (multiple orderer groups).
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Fablo supports:
* RAFT and solo consensus protocols
* Multiple organizations and channels
* Chaincode installation and upgrade
* REST API client for CA and chaincodes ([Fablo REST](https://github.com/softwaremill/fablo-rest))
* REST API client for CA and chaincodes ([Fablo REST](https://github.com/fablo-io/fablo-rest))
* [Blockchain Explorer](https://github.com/hyperledger/blockchain-explorer) which can be enabled for each organization

## See it in action
Expand Down Expand Up @@ -42,7 +42,7 @@ To create a local Hyperledger Fabric network with Node.js chaincode and REST API
```

After a few minutes the whole network will be set up and running.
You can check the running nodes via `docker ps` or `docker stats`, and you can query the network with command line (via `cli.org1.example.com` container) or REST API client (via [Fablo REST](https://github.com/softwaremill/fablo-rest)).
You can check the running nodes via `docker ps` or `docker stats`, and you can query the network with command line (via `cli.org1.example.com` container) or REST API client (via [Fablo REST](https://github.com/fablo-io/fablo-rest)).

## Basic usage

Expand Down Expand Up @@ -78,7 +78,7 @@ Good step to start your adventure with Fablo or set up a fast prototype.

Fablo `init` command takes three parameters (the order does not matter):
* Option `node` makes Fablo to generate a sample Node.js chaincode as well.
* Option `rest` enables simple REST API with [Fablo REST](https://github.com/softwaremill/fablo-rest) as standalone Docker container.
* Option `rest` enables simple REST API with [Fablo REST](https://github.com/fablo-io/fablo-rest) as standalone Docker container.
* Option `dev` enables running peers in dev mode (so the hot reload for chaincode is possible).

Sample command:
Expand Down Expand Up @@ -570,9 +570,9 @@ You can find them in `fablo-target/fablo-config/connection-profiles` directory i
### REST API
Fablo is integrated with simple REST API for CA and chaincodes, supported by [Fablo REST](https://github.com/softwaremill/fablo-rest).
Fablo is integrated with simple REST API for CA and chaincodes, supported by [Fablo REST](https://github.com/fablo-io/fablo-rest).
If you want to use it, provide for your organization `"tools": { "fabloRest": true }`.
Visit the [Fablo REST](https://github.com/softwaremill/fablo-rest) project for more documentation.
Visit the [Fablo REST](https://github.com/fablo-io/fablo-rest) project for more documentation.
### Blockchain Explorer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,7 @@ fi
exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = `
"FABLO_VERSION=1.2.1-unstable.0
FABLO_BUILD=<date with git hash>
FABLO_REST_VERSION=0.1.0
FABLO_REST_VERSION=0.1.2
HYPERLEDGER_EXPLORER_VERSION=1.1.8
COUCHDB_VERSION=3.1
Expand Down Expand Up @@ -2034,7 +2034,7 @@ services:
fablo-rest.org1.example.com:
container_name: fablo-rest.org1.example.com
image: softwaremill/fablo-rest:\${FABLO_REST_VERSION}
image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION}
environment:
- PORT=8000
- MSP_ID=Org1MSP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ fi
exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = `
"FABLO_VERSION=1.2.1-unstable.0
FABLO_BUILD=<date with git hash>
FABLO_REST_VERSION=0.1.0
FABLO_REST_VERSION=0.1.2
HYPERLEDGER_EXPLORER_VERSION=1.1.8
COUCHDB_VERSION=3.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,7 @@ fi
exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = `
"FABLO_VERSION=1.2.1-unstable.0
FABLO_BUILD=<date with git hash>
FABLO_REST_VERSION=0.1.0
FABLO_REST_VERSION=0.1.2
HYPERLEDGER_EXPLORER_VERSION=1.1.8
COUCHDB_VERSION=3.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3020,7 +3020,7 @@ fi
exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = `
"FABLO_VERSION=1.2.1-unstable.0
FABLO_BUILD=<date with git hash>
FABLO_REST_VERSION=0.1.0
FABLO_REST_VERSION=0.1.2
HYPERLEDGER_EXPLORER_VERSION=1.1.8
COUCHDB_VERSION=3.1
Expand Down Expand Up @@ -4091,7 +4091,7 @@ services:
fablo-rest.org1.example.com:
container_name: fablo-rest.org1.example.com
image: softwaremill/fablo-rest:\${FABLO_REST_VERSION}
image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION}
environment:
- PORT=8000
- MSP_ID=Org1MSP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3316,7 +3316,7 @@ fi
exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = `
"FABLO_VERSION=1.2.1-unstable.0
FABLO_BUILD=<date with git hash>
FABLO_REST_VERSION=0.1.0
FABLO_REST_VERSION=0.1.2
HYPERLEDGER_EXPLORER_VERSION=1.1.8
COUCHDB_VERSION=3.1
Expand Down
6 changes: 3 additions & 3 deletions fablo-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo " FABLO_HOME: $FABLO_HOME"
echo " FABLO_VERSION: $FABLO_VERSION"
echo " VERSION_DETAILS: $VERSION_DETAILS"

IMAGE_BASE_NAME="softwaremill/fablo:$FABLO_VERSION"
IMAGE_BASE_NAME="ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION"

if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then
set +e
Expand All @@ -37,13 +37,13 @@ if [ "${1:-''}" = "--push" ]; then
docker buildx build \
--build-arg VERSION_DETAILS="$VERSION_DETAILS" \
--platform linux/amd64,linux/arm64 \
--tag "softwaremill/fablo:$FABLO_VERSION" \
--tag "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" \
--push \
"$FABLO_HOME"
else
docker build \
--build-arg VERSION_DETAILS="$VERSION_DETAILS" \
--tag "$IMAGE_BASE_NAME" "$FABLO_HOME"

docker tag "$IMAGE_BASE_NAME" "softwaremill/fablo:$FABLO_VERSION"
docker tag "$IMAGE_BASE_NAME" "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION"
fi
2 changes: 1 addition & 1 deletion fablo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

FABLO_VERSION=1.2.1-unstable.0
FABLO_IMAGE_NAME="softwaremill/fablo"
FABLO_IMAGE_NAME="ghcr.io/hyperledger-labs/fablo"
FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION"

COMMAND="$1"
Expand Down
15 changes: 8 additions & 7 deletions src/repositoryUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import got from "got";

const repositoryName = "softwaremill/fablo";
const repositoryTagsListUrl = `https://registry.hub.docker.com/v2/repositories/${repositoryName}/tags`;
const repositoryTagsListUrl = `https://api.github.com/repos/hyperledger-labs/fablo/releases`;

const incrementVersionFragment = (versionFragment: string) => {
if (versionFragment.includes("-")) {
Expand Down Expand Up @@ -55,21 +54,23 @@ const version = (v: string): Version => ({
},
});

const requestVersionNames = (): Promise<{ results: { name: string }[] }> => {
const requestVersionNames = (): Promise<{ tag_name: string }[]> => {
const params = {
searchParams: {
tag_status: "active",
page_size: 1024,
},
};
return got(repositoryTagsListUrl, params).json<{ results: { name: string }[] }>();
return got(repositoryTagsListUrl, params).json<{ tag_name: string }[]>();
};

const versionRegex = /^v\d+\.\d+\.\d+(-[a-zA-Z0-9-]+)?$/;

const getAvailableTags = async (): Promise<string[]> => {
try {
const versionNames = (await requestVersionNames()).results
.filter((v) => v.name !== "latest")
.map((tag) => tag.name);
const versionNames = (await requestVersionNames())
.filter((release) => versionRegex.test(release.tag_name))
.map((release) => release.tag_name.slice(1));
return sortVersions(versionNames);
} catch (err) {
console.log(`Could not check for updates. Url: '${repositoryTagsListUrl}' not available`);
Expand Down
2 changes: 1 addition & 1 deletion src/setup-docker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default class SetupDockerGenerator extends Generator {
paths: global.paths,
fabloVersion: config.fabloVersion,
fabloBuild: getBuildInfo(),
fabloRestVersion: "0.1.0",
fabloRestVersion: "0.1.2",
hyperledgerExplorerVersion: "1.1.8",
fabricCouchDbVersion: "0.4.18",
couchDbVersion: "3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ services:
<%_ if (org.tools.fabloRest) { _%>
<%= org.tools.fabloRest.address %>:
container_name: <%= org.tools.fabloRest.address %>
image: softwaremill/fablo-rest:${FABLO_REST_VERSION}
image: ghcr.io/fablo-io/fablo-rest:${FABLO_REST_VERSION}
environment:
- PORT=8000
- MSP_ID=<%= org.tools.fabloRest.mspId %>
Expand Down
2 changes: 1 addition & 1 deletion src/setup-k8s/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default class SetupDockerGenerator extends Generator {
paths: global.paths,
fabloVersion: config.fabloVersion,
fabloBuild: getBuildInfo(),
fabloRestVersion: "0.1.0",
fabloRestVersion: "0.1.2",
hyperledgerExplorerVersion: "1.1.8",
fabricCouchDbVersion: "0.4.18",
couchDbVersion: "3.1",
Expand Down

0 comments on commit 882d50c

Please sign in to comment.