Skip to content

Commit

Permalink
Review docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Aug 21, 2024
1 parent 9800975 commit aca07fe
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 31 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ To learn more about SubQuery, [see their docs](https://academy.subquery.network)
- [2. Generate types](#2-generate-types)
- [3. Run](#3-run)
- [Localnet ONLY](#localnet-only)
- [4.1 Debugging, errors running \& building](#41-debugging-errors-running--building)
- [4.2 Using a pre-built image](#42-using-a-pre-built-image)
- [4.3 Available Scripts breakdown](#43-available-scripts-breakdown)
- [3.1 Debugging, errors running \& building](#31-debugging-errors-running--building)
- [3.2 Using a pre-built image](#32-using-a-pre-built-image)
- [3.3 Available Scripts breakdown](#33-available-scripts-breakdown)
- [3.4 Using k8s](#34-using-k8s)

## Usage & Query Docs

Expand Down Expand Up @@ -214,7 +215,7 @@ Or Stop & clean up (delete postgres data):
yarn run docker:clean:development
```

#### 4.1 Debugging, errors running & building
#### 3.1 Debugging, errors running & building

If you're hitting errors with the above command, do a nuclear clean of all potential issues:

Expand All @@ -226,7 +227,7 @@ docker context use default

Now pick up from the `yarn run docker:build` step above.

#### 4.2 Using a pre-built image
#### 3.2 Using a pre-built image

If you are unable to build locally, a pre-built image is available on Docker Hub: [bryanchriswhite/pocketdex-subquery-node:latest](https://hub.docker.com/r/bryanchriswhite/pocketdex-subquery-node).

Expand All @@ -251,7 +252,7 @@ services:
...
```

#### 4.3 Available Scripts breakdown
#### 3.3 Available Scripts breakdown

* `preinstall` - Enforces the use of Yarn as the package manager.
* `postinstall` - Executes the `env:prepare` script after the installation process.
Expand All @@ -278,3 +279,7 @@ services:
* `docker:ps:<environment>` - Shows the status of services for the specified environment.
* `docker:stop:<environment>` - Stops all active services for the specified environment without removing them.
* `docker:clean:<environment>` - Stops and removes all services, volumes, and networks for the specified environment.

#### 3.4 Using k8s

See the instructions in [docs/kubernetes.md](./docs/kubernetes.md) for deploying using Kubernetes.
66 changes: 41 additions & 25 deletions docs/kubernetes.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,66 @@
### Requirements
# Local Kubernetes Deployment <!-- omit in toc -->

1. **Kubernetes Cluster**
* If you are already running Shannon in `Localnet`, you can work with it.
2. **Helm** & **PostgreSQL** (optional if you already have PostgreSQL)
- [Requirements](#requirements)
- [Deploy it](#deploy-it)
- [1. \[Optional\] Set Up PostgreSQL](#1-optional-set-up-postgresql)
- [2. Update Database Secrets](#2-update-database-secrets)
- [3. Configure the Application](#3-configure-the-application)
- [4. Deploy Indexer and Query Components](#4-deploy-indexer-and-query-components)
- [Explore Locally](#explore-locally)
- [Expose Publically](#expose-publically)
- [Watch the Logs](#watch-the-logs)

### Deploy it:
## Requirements

**NOTE:** Before proceeding, ensure that the Kubernetes deployment has access to the PocketDex image.
You can build the image by following the instructions in the README.md file.
Then, either load it into your Kubernetes cluster using `kind local docker-images <image:tag>`(if you're using it) or
push it to your preferred container registry.
1. **Kubernetes Cluster**; if you are already running Shannon in `Localnet`, you can work with it.
1. **Helm** & **PostgreSQL**; optional if you already have PostgreSQL

#### 1. (Optional) Set Up PostgreSQL:
## Deploy it

If you need to deploy PostgreSQL, add the Bitnami Helm repository and install PostgreSQL. Skip this step if you already
have a PostgreSQL instance running.
**NOTE**: Before proceeding, ensure that the Kubernetes deployment has access to the Pocketdex image. You can build the image by following the instructions in the main [README](../README.md) file.

Then, do one of the following:

1. Load it into your Kubernetes cluster using `kind local docker-images <image:tag>`(if you're using it)
2. Push it to your preferred container registry

### 1. [Optional] Set Up PostgreSQL

**NOTE**: Skip this step if you already have a PostgreSQL instance running.

Add the Bitnami Helm repository:

```shell
helm repo add bitnami https://charts.bitnami.com/bitnami
```

Replace all the `CHANGEME` placeholders in `kubernetes/postgresql-values.yaml`.

Install PostgreSQL:
Replace all the `CHANGEME` placeholders in `kubernetes/postgresql-values.yaml` and then run:

```shell
helm install postgresql bitnami/postgresql --version 15.5.23 -f kubernetes/postgresql-values.yaml
```

#### 2. Update Database Secrets:
#### 2. Update Database Secrets

Replace all the `CHANGEME` placeholders in `kubernetes/db-secrets.yaml`.

Replace `CHANGEME` placeholders in `kubernetes/db-secrets.yaml` and deploy them:
Deploy them using:

```shell
kubectl apply -f kubernetes/db-secrets.yaml
```

#### 3. Configure the Application:
#### 3. Configure the Application

Review/Edit and deploy the ConfigMap found in `kubernetes/configmap.yaml`:

```shell
kubectl apply -f kubernetes/configmap.yaml
```

#### 4. Deploy Indexer and Query Components:
#### 4. Deploy Indexer and Query Components

Create the indexer deployment and service:

Expand All @@ -59,7 +74,7 @@ Create the query deployment and service:
kubectl apply -f kubernetes/query-deployment.yaml
```

### Explore Locally:
### Explore Locally

To explore the application locally, you can access the query playground using a simple `port-forward`:

Expand All @@ -69,24 +84,25 @@ kubectl port-forward svc/pocketdex-query --address 127.0.0.1 3000:3000

Navigate to `http://localhost:3000`, and you should see the GraphQL Playground.

### Expose to the World:
### Expose Publically

If you need to permanently expose this to the world, you will need an Ingress Controller like:
If you need to permanently expose this to the world, you will need an Ingress controller.
Any Ingress controller should work, but here are a few popular ones:

* [HAProxy Ingress](https://artifacthub.io/packages/helm/haproxy-ingress/haproxy-ingress)
* [NGINX Ingress](https://artifacthub.io/packages/helm/nginx-ingress-chart/nginx-ingress)
- [HAProxy Ingress](https://artifacthub.io/packages/helm/haproxy-ingress/haproxy-ingress)
- [NGINX Ingress](https://artifacthub.io/packages/helm/nginx-ingress-chart/nginx-ingress)

Or any other ingress controller of your choice.
Once the ingress controller is set up, you can use the example Ingress configuration located at
`kubernetes/ingress.yaml`.
Please note, this file is just an example. You should review and edit it as needed before deploying it.

**NOTE**: This file is just an example. You should review and edit it as needed before deploying it.
If you need TLS support, ensure your Ingress Controller is configured to handle it in front of the query service.

```shell
kubectl apply -f kubernetes/ingress.yaml
```

### Watch the Logs:
### Watch the Logs

To watch the logs for both the Indexer and Query components:

Expand Down

0 comments on commit aca07fe

Please sign in to comment.