Setting up the Gas API is essential for managing billing, provisioning, and integration of nodes and devices within your network. This guide walks you through the installation process, ensuring you have the necessary components to get started with network management.
Before you start
- Ensure you have Go installed on your system.
- Have access to a PostgreSQL database.
- Ensure you have Helm installed for deployment.
- Have access to a Kubernetes cluster.
Steps to Install Gas API
-
Install Go Dependencies
Open your terminal and navigate to the directory where you want to install the Gas API. Run the following command to install necessary Go dependencies:go mod tidy -
Configure the Database
Set up your PostgreSQL database using the provided migration files. Run the migration scripts to initialize the database schema:go run main.go migrate up -
Set Up the Development Environment
Configure your environment by setting up the necessary configuration files. Ensure you have the correct database connection settings and API endpoint configurations. -
Deploy the Application
Use Helm to deploy the application on your Kubernetes cluster. Run the following command:helm install gas-api ./helm/gas-api -
Verify the Installation
Check the status of your deployment to ensure everything is running smoothly. Use the following command to verify:kubectl get pods
Example Configuration
Here is an example of a configuration snippet you might use in your config.yaml:
database:
host: "localhost"
port: 5432
user: "yourusername"
password: "yourpassword"
name: "gasapidb"
api:
endpoint: "http://localhost:8080"
If something goes wrong
-
Database Connection Issues: If you encounter errors connecting to the database, double-check your database credentials and ensure the database server is running.
-
Helm Deployment Fails: If the Helm deployment fails, verify that your Kubernetes cluster is accessible and that Helm is correctly installed.
-
Pods Not Running: If the pods are not running, use
kubectl describe pod [pod-name]to check for error messages and troubleshoot accordingly.