Deployment Overview of Chainstack on Server¶
Prerequisites and Basic Requirements¶
To successfully deploy the Chainstack Control Panel, the server must meet the following operating system, hardware, and network requirements:
-
Operating System: Ubuntu Linux (tested with APT package manager).
-
Privileges: Root access or a user with
sudoprivileges is required. -
Architecture: 64-bit AMD64 (x86_64) or ARM64 (aarch64). 32-bit architectures are not supported.
-
Network: Access to the internet is required to download binaries, container images, and certificates.
-
Ports: The application listens on port
80for HTTP and port443for HTTPS (via Traefik). Port6443is used internally by the Kubernetes API. -
Swap Space: A swap file of
24Gis automatically configured to ensure sufficient memory for blockchain nodes.
FQDN of the Final Panel¶
The Chainstack Control Panel is accessible via the hostkey.in domain. The fully qualified domain name follows the format:
chainstack<Server ID>.hostkey.in
The panel is served over HTTPS using a custom domain or the default temporary domain. The primary URL is configured as https://{{ final_domain }}. If a temporary domain is assigned during deployment, it is also accessible via HTTPS.
File and Directory Structure¶
The deployment places core binaries, configurations, and data in specific directories. The following structure represents the final state of the installation:
-
Installation Directory:
/opt/chainstack- Contains the
cpctlbinary used for managing the Chainstack installation.
- Contains the
-
Kubernetes Configuration:
/etc/rancher/k3s/k3s.yaml- The primary kubeconfig file for the k3s cluster.
-
Root Kubeconfig:
/root/.kube/config- A copy of the kubeconfig for root user access.
-
Credentials File:
/root/chainstack_admin_credentials.txt- Stores the bootstrap admin password and panel URLs (mode
0600).
- Stores the bootstrap admin password and panel URLs (mode
-
Sysctl Configuration:
/etc/sysctl.d/99-chainstack.conf- Contains kernel parameter tuning for blockchain nodes.
-
Traefik TLS Configuration:
/var/lib/rancher/k3s/server/manifests/traefik-config.yaml- HelmChartConfig for Let's Encrypt certificate management.
-
Swap File:
/swapfile- System swap file allocated for memory management.
Application Installation Process¶
The Chainstack Control Panel is installed using the cpctl installer, which deploys the application into a Kubernetes cluster running k3s.
-
Container Runtime: The server uses k3s, a lightweight Kubernetes distribution.
-
Version: The deployment targets version
v1.0.0of Chainstack. -
Namespace: All components are installed within the
control-panelnamespace. -
Storage Class: The deployment utilizes the
local-pathstorage class for persistent volumes. -
Installation Command: The
cpctlbinary is executed to install the Control Plane with the following parameters: -
Dependencies: The installation process installs the following tools:
-
kubectl: For Kubernetes interaction. -
helm: For package management and deploying charts. -
yq: For YAML processing. -
Python client libraries (
kubernetes,openshift,PyYAML) for ingress configuration.
-
Access Rights and Security¶
The deployment implements specific security measures to control access and manage resources:
-
Kyverno Policy: A
ClusterPolicynamedchainstack-node-resourcesis applied to enforce resource limits on blockchain nodes.-
Applies to Pods in the
control-panelnamespace with labelapp.kubernetes.io/component: node. -
CPU Limits: Set to
2cores. -
Memory Limits: Set to
8Gi.
-
-
Credentials:
-
The bootstrap password for the admin user is stored in
/root/chainstack_admin_credentials.txt. -
The file is owned by
rootwith permissions0600.
-
-
User Access: The default administrator username is
admin. -
Firewall: The k3s installation and Traefik ingress expose standard web ports (80, 443) externally. Internal communication occurs over port
6443.
Databases¶
The Chainstack Control Panel utilizes internal database services managed within the Kubernetes cluster.
-
Connection Method: Services connect to the database via internal Kubernetes DNS resolution within the
control-panelnamespace. -
Storage Location: Data is stored on the node using the
local-pathstorage class. -
Configuration: Database settings are managed by the Helm chart and Kubernetes resources defined in the
control-panelnamespace. Specific connection strings are injected via environment variables or ConfigMaps within the cluster.
Docker Containers and Their Deployment¶
The application is deployed using Kubernetes resources, not standalone Docker containers. The core components include:
-
API Backend:
cp-cp-deployments-apiservice, exposed on port8080. -
User Interface:
cp-cp-uiservice, exposed on port80. -
Ingress Controller: Traefik is used as the ingress controller to route traffic to the UI and API backends.
-
Node Resources: Blockchain nodes deployed by the user via the control panel are subject to the Kyverno policy resource constraints (2 CPU, 8Gi RAM).
-
Management: Deployments are managed via
kubectland thecpctlinstaller. The installer waits for all deployments to reach theAvailablecondition before completing.
Proxy Servers¶
Traefik is configured as the reverse proxy and ingress controller for the Chainstack Control Panel.
-
SSL/TLS: Let's Encrypt is used to automatically generate and renew SSL certificates.
-
Resolver:
le -
Email:
[email protected] -
Storage:
/data/acme.jsonwithin the Traefik deployment. -
Challenge Type: TLS-ALPN (configured via
--certificatesresolvers.le.acme.tlschallenge=true).
-
-
Routing:
-
Root Path (
/): Routes to thecp-cp-uiservice (port80). -
API Path (
/api): Routes to thecp-cp-deployments-apiservice (port8080). A middleware namedchainstack-api-stripstrips the/apiprefix before forwarding to the backend.
-
-
Domains:
-
Ingress rules are created for the final domain (
chainstack<Server ID>.hostkey.in). -
If a temporary domain is provided, an additional ingress rule is created for that host.
-
Permission Settings¶
File and directory permissions are set to ensure security and proper functionality of the installed components:
-
Install Directory (
/opt/chainstack): Mode0755, Ownerroot:root. -
cpctl Binary: Mode
0755(executable). -
Sysctl Config (
/etc/sysctl.d/99-chainstack.conf): Mode0644, Ownerroot:root. -
Swap File (
/swapfile): Mode0600, Ownerroot:root. -
Kubeconfig (
/root/.kube/config): Mode0600. -
Credentials File (
/root/chainstack_admin_credentials.txt): Mode0600, Ownerroot:root. -
Traefik Config Manifest: Mode
0644.
Location of Configuration Files and Data¶
All configuration files and runtime data are located in the following paths:
-
Chainstack Config: Managed within Kubernetes ConfigMaps in the
control-panelnamespace. -
UI Configuration: The
cp-cp-ui-configConfigMap contains theconfig.jsondata, settingapiBaseUrlto/api. -
Node Policy: The Kyverno policy file
chainstack-node-policy.yamlis applied to the cluster to manage node resources. -
Kernel Tuning:
/etc/sysctl.d/99-chainstack.confdefines kernel parameters for blockchain node performance. -
Certificates: Managed by Traefik in
/data/acme.json(inside the Traefik pod volume).
Available Ports for Connection¶
The following ports are open and utilized by the deployment:
-
Port 80 (HTTP): Used for initial Let's Encrypt challenge and redirection to HTTPS.
-
Port 443 (HTTPS): The primary port for accessing the Chainstack Control Panel UI and API.
-
Port 6443: Internal Kubernetes API server port.
-
Port 8080: Internal API backend service port (accessed via Traefik proxy).
-
Port 80: Internal UI service port (accessed via Traefik proxy).
Starting, Stopping, and Updating¶
The Chainstack application and underlying infrastructure are managed using standard Kubernetes commands and service management tools.
-
Start/Restart: The k3s service manages the lifecycle of the Kubernetes cluster.
-
Command to start k3s:
systemctl start k3s -
Command to enable k3s on boot:
systemctl enable k3s
-
-
Service Management:
-
The
cpctlbinary in/opt/chainstack/cpctlis used for installation and version management. -
To verify the version of the installed
cpctlbinary:
-
-
Updating Deployments:
-
Updates to the Chainstack Control Panel can be triggered by modifying the Helm release or restarting deployments via
kubectl. -
Example to restart the UI deployment:
-
-
Checking Status:
-
Check if the Kubernetes node is ready:
-
Check the status of all deployments in the control-panel namespace:
-
-
Kernel Parameters: To apply new sysctl settings immediately: