Skip to content

Commit

Permalink
Update docs and deployment on
Browse files Browse the repository at this point in the history
Signed-off-by: David VIEJO <[email protected]>
  • Loading branch information
dviejokfs committed Aug 1, 2024
1 parent 371dc35 commit 79d96ad
Show file tree
Hide file tree
Showing 57 changed files with 425 additions and 462 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
AUTH_SECRET="pkUz8HbyyGXXPVjic4M5I++dGEkrHr6tr9o9O7ZmyUg="
PASSWORD_SALT=
GH_CLIENT_ID=
GH_CLIENT_SECRET=
RESEND_API_KEY=
4 changes: 2 additions & 2 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ jobs:

- name: Build Docusaurus website
run: |
cd apps/fabriclaunch-docs
cd apps/docs
bun run build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./apps/fabriclaunch-docs/build
publish_dir: ./apps/docs/build
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ We focus on baremetal deployment because:

## Next Steps

Documentation coming soon. You can find the markdowns on the [GitHub repository](https://github.com/kfsoftware/fabriclaunch/tree/main/apps/fabriclaunch-docs/docs).
Documentation coming soon. You can find the markdowns on the [GitHub repository](https://github.com/kfsoftware/fabriclaunch/tree/main/apps/docs/docs).
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions apps/docs/docs/deployments/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"label": "Deployment options"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
---
sidebar_position: 1
---

# Deployment on DigitalOcean

## Terraform project

### main.tf

To provision virtual machines on DigitalOcean, you can use Terraform. Terraform is an open-source infrastructure as code software tool that provides a consistent CLI workflow to manage hundreds of cloud services. Terraform codifies cloud APIs into declarative configuration files.

```hcl title="main.tf"
terraform {
required_providers {
digitalocean = {
Expand Down Expand Up @@ -130,3 +143,60 @@ output "droplet_ips" {
droplet.name => droplet.ipv4_address
}
}
```
### variables.tf

Then, you need to declare the variables in a `variables.tf` file:

```hcl title="variables.tf"
variable "do_token" {
description = "DigitalOcean API Token"
type = string
sensitive = true
}
variable "regions" {
description = "List of regions for droplet deployment"
type = list(string)
default = ["nyc1", "fra1", "blr1"]
}
variable "vm_names" {
description = "List of VM names"
type = list(string)
}
```

To avoid hardcoding the DigitalOcean API token in the `terraform.tfvars` file, you can use the `TF_VAR_do_token` environment variable:

```bash
export TF_VAR_do_token="your_digitalocean_api_token"
```

Finally, you can create a `terraform.tfvars` file to specify the values for the variables:

```hcl title="terraform.tfvars"
regions = ["nyc1", "fra1", "blr1"]
vm_names = ["org1", "org2", "org3"]
```

## Execute Terraform

To execute the Terraform project, you can run the following commands:

```bash
terraform init
terraform apply
```

Then, you can access the virtual machines using the private key file `id_rsa`:

```bash
ssh -i id_rsa root@<droplet_ip>
```

Each of the virtual machines will have the FabricLaunch CLI installed. You can use the FabricLaunch CLI to create nodes and networks on the virtual machines.


You can see the [`Getting started`](../getting-started.md) guide to learn how to deploy the FabricLaunch CLI. The IPs is the only thing that changes, apart from not using the 'localho.st' domain, in this case, you need to use the ip as the domain.
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,14 @@ fabriclaunch channel propose multilocation \

# at this point, a notification should be sent to the other organizations to accept the channel proposal

export CHANNEL_PROPOSAL_ID="prop_multilocation_1721134780228"
export CHANNEL_PROPOSAL_ID="<CHANNEL_PROPOSAL_ID_FROM_PREV_STEP>"

fabriclaunch channel accept "${CHANNEL_PROPOSAL_ID}" -o NYCMSP --tenant ${TENANT_NAME}

export CHANNEL_PROPOSAL_ID="prop_multilocation_1721134780228"
fabriclaunch channel accept "${CHANNEL_PROPOSAL_ID}" -o FRAMSP --tenant ${TENANT_NAME}

export CHANNEL_PROPOSAL_ID="prop_multilocation_1721134780228"
fabriclaunch channel accept "${CHANNEL_PROPOSAL_ID}" -o BLRMSP --tenant ${TENANT_NAME}

export CHANNEL_PROPOSAL_ID="prop_multilocation_1721134780228"

fabriclaunch consensus create "${CHANNEL_PROPOSAL_ID}" -o NYCMSP --tenant ${TENANT_NAME}
fabriclaunch consensus create "${CHANNEL_PROPOSAL_ID}" -o FRAMSP --tenant ${TENANT_NAME}
Expand All @@ -254,7 +252,7 @@ fabriclaunch chaincode propose fabcar --mspId=NYCMSP --chaincodePath=$PWD/chainc
--pdc="$PWD/pdc.json"


export CH_PROPOSAL_ID="prop_multilocation_fabcar_7_1720979349091"
export CH_PROPOSAL_ID="<CH_PROPOSAL_ID_FROM_PREV_STEP>"

fabriclaunch chaincode accept ${CH_PROPOSAL_ID} -o NYCMSP --chaincodeAddress="127.0.0.1:20000" --tenant ${TENANT_NAME}
fabriclaunch chaincode accept ${CH_PROPOSAL_ID} -o FRAMSP --chaincodeAddress="127.0.0.1:20000" --tenant ${TENANT_NAME}
Expand All @@ -263,13 +261,10 @@ fabriclaunch chaincode accept ${CH_PROPOSAL_ID} -o BLRMSP --chaincodeAddress="12
# this line commits the chaincode to the channel
fabriclaunch chaincode commit ${CH_PROPOSAL_ID} -o NYCMSP --tenant ${TENANT_NAME}

export CH_PROPOSAL_ID="prop_multilocation_fabcar_7_1720979349091"
fabriclaunch chaincode run ${CH_PROPOSAL_ID} --tenant ${TENANT_NAME} --mode=systemd --download --org=NYCMSP --chaincodeAddress="127.0.0.1:20000"

export CH_PROPOSAL_ID="prop_multilocation_fabcar_7_1720979349091"
fabriclaunch chaincode run ${CH_PROPOSAL_ID} --tenant ${TENANT_NAME} --mode=systemd --download --org=FRAMSP --chaincodeAddress="127.0.0.1:20000"

export CH_PROPOSAL_ID="prop_multilocation_fabcar_7_1720979349091"
fabriclaunch chaincode run ${CH_PROPOSAL_ID} --tenant ${TENANT_NAME} --mode=systemd --download --org=BLRMSP --chaincodeAddress="127.0.0.1:20000"


Expand Down
68 changes: 68 additions & 0 deletions apps/docs/docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
sidebar_position: 3
---
# Installation

At the time of writing, fabriclaunch has only been tested with Ubuntu 22.04 and 24.04.

These are the tools you'll need to install:

- **cfssl**: to generate certificates and certificate authorities (CAs)
- **Golang**: to run chaincodes
- **Fabric tools**: to interact with the Hyperledger Fabric network, including:
+ **peer**: to run peers
+ **orderer**: to run orderers
+ **osnadmin**: to join the ordering service nodes to the channel
+ **discover**: to discover peers in the channel
- **fabriclaunch**: to create and manage your Hyperledger Fabric network


## Install cfssl

To install cfssl, run the following commands:

```bash{"title": "xx"}
wget https://github.com/cloudflare/cfssl/releases/download/v1.6.5/cfssl_1.6.5_linux_amd64 -O /usr/local/bin/cfssl
wget https://github.com/cloudflare/cfssl/releases/download/v1.6.5/cfssljson_1.6.5_linux_amd64 -O /usr/local/bin/cfssljson
chmod +x /usr/local/bin/cfssl
chmod +x /usr/local/bin/cfssljson
```

## Install Golang

To install Golang, run the following commands:

```bash
wget "https://go.dev/dl/go1.22.5.linux-amd64.tar.gz"
sudo tar -C /usr/local -xzf go*.tar.gz
export PATH=$PATH:/usr/local/go/bin
```

## Install Fabric tools

To install the Fabric tools, run the following commands:

```bash
curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh
chmod +x install-fabric.sh
./install-fabric.sh --fabric-version 2.5.9 binary

# and then move the binaries to your PATH

mv bin/discover /usr/local/bin/discover
mv bin/orderer /usr/local/bin/orderer
mv bin/osnadmin /usr/local/bin/osnadmin
mv bin/peer /usr/local/bin/peer
```


## Install fabriclaunch

To install fabriclaunch, run the following commands:

```bash
wget https://fabriclaunch.com/fabriclaunch
chmod +x fabriclaunch
mv fabriclaunch /usr/local/bin/fabriclaunch
```

File renamed without changes.
3 changes: 3 additions & 0 deletions apps/docs/docs/platform/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"label": "Platform deployment"
}
89 changes: 89 additions & 0 deletions apps/docs/docs/platform/docker-compose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
sidebar_position: 2
---

# Using Docker Compose

## Prerequisites:

1. Ensure Docker and Docker Compose are installed on your system.
2. Git should be installed to clone the repository.

## Step-by-step Instructions:

1. Clone the repository:
```bash
git clone https://github.com/kfsoftware/fabriclaunch.git
cd fabriclaunch
```

2. Set up environment variables:
```bash
cp .env.example .env
```
Edit the `.env` file and fill in the required values:
- `AUTH_SECRET` is already set, but you can generate a new one with:
```bash
openssl rand -hex 32
```
- Set `PASSWORD_SALT` (you can use the same method as `AUTH_SECRET`)
- Add your GitHub OAuth credentials for `GH_CLIENT_ID` and `GH_CLIENT_SECRET`
- Add your Resend API key for `RESEND_API_KEY`

3. Build the Docker images:
```bash
docker-compose build
```

4. Start the services:
```bash
docker-compose up
```
Or in detached mode:
```bash
docker-compose up -d
```

5. Wait for the services to start up. You should see logs indicating that the services are ready.

6. Open a web browser and navigate to:
```
http://localhost:3000/dashboard
```
7. If everything is working correctly, you should see the dashboard of your FabricLaunch application.
## Troubleshooting:
- Check Docker logs:
```bash
docker-compose logs
```
- Check logs for a specific service:
```bash
docker-compose logs web
```
- Ensure ports 3000, 5432, 9000, and 9001 are not in use by other applications.
- If you make changes, rebuild the images:
```bash
docker-compose build
docker-compose up
```

## Platform-specific notes:

- Windows: Use PowerShell or Command Prompt. Ensure Docker Desktop is running.
- Mac: Use Terminal. Ensure Docker Desktop is running.
- Linux: You might need to use `sudo` before docker commands, depending on your setup.

## Stopping the services:

```bash
docker-compose down
```
To remove volumes as well:
```bash
docker-compose down -v
```

By following these steps, you should be able to launch FabricLaunch on any machine (Linux, Windows, or Mac) and access the dashboard at http://localhost:3000/dashboard to verify that it's working correctly.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const config: Config = {
copyright: `Copyright © ${new Date().getFullYear()} FabricLaunch. Built with Docusaurus.`,
},
prism: {
additionalLanguages: ['bash'],
additionalLanguages: ['bash', 'hcl'],
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
Loading

0 comments on commit 79d96ad

Please sign in to comment.