Deployment Overview of Chainstack on Server¶
Prerequisites and Basic Requirements¶
The deployment of the Chainstack Control Panel requires a Linux server running Ubuntu. The installation process assumes the following system configurations and privileges:
- Operating System: Ubuntu (specific version not restricted, but standard Ubuntu repositories are used).
- Privileges: Root access or
sudoprivileges are required to install system packages, configure the kernel, and manage services. - Domain Configuration: A valid domain name is required for the ingress controller to issue SSL certificates via Let's Encrypt. The default zone is
hostkey.in. - Ports: The application listens on port
80for HTTP traffic, which is automatically redirected to HTTPS. The Kubernetes API listens on port6443locally. - Swap Space: A swap file of
24Gis created and enabled at/swapfileto ensure sufficient memory for blockchain node operations. - Kernel Parameters: Specific
sysctlparameters are applied to optimize network and memory performance for blockchain workloads.
FQDN of the Final Panel¶
The fully qualified domain name (FQDN) for accessing the Chainstack Control Panel follows the format defined by the zone and prefix variables.
- Zone:
hostkey.in - Prefix:
chainstack - Format:
chainstack<Server ID>.hostkey.in - Protocol: HTTPS is enforced via the Traefik ingress controller.
- Example: If the server ID is
123, the URL would behttps://chainstack123.hostkey.in.
File and Directory Structure¶
The deployment creates specific directories and files to manage the application, configuration, and data storage.
- Installation Directory:
/opt/chainstack - Contains the
cpctlinstaller script. - Kubernetes Configuration:
- Kubeconfig:
/etc/rancher/k3s/k3s.yaml - User Kubeconfig:
/root/.kube/config - System Configuration:
- Sysctl settings:
/etc/sysctl.d/99-chainstack.conf - Swap file:
/swapfile - Credentials:
- Admin credentials file:
/root/chainstack_admin_credentials.txt - Traefik Configuration:
- Helm chart config for TLS:
/var/lib/rancher/k3s/server/manifests/traefik-config.yaml - Helm Values:
- Stored in
/root/.config/cp-suite/(specificallycp-control-panel-*.yaml).
Application Installation Process¶
The Chainstack Control Panel is installed using the cpctl installer script within the Kubernetes environment provided by k3s.
- Base Dependencies: Essential tools such as
curl,wget,git,jq,ca-certificates, andopensslare installed viaapt. - Kubernetes Tools:
kubectlis installed to/usr/local/bin/kubectl.Helmis installed to/usr/local/bin/helm.yqis installed to/usr/local/bin/yq.
- k3s Installation: The k3s lightweight Kubernetes distribution is installed with the argument
--write-kubeconfig-mode 644. - Chainstack Control Plane:
- The
cpctlscript is copied to/opt/chainstack/cpctl. - The installation command executed is:
- This installs the Chainstack version
v1.0.0using thelocal-pathstorage class.
- The
- Kyverno: The Kyverno policy engine is installed via Helm into the
kyvernonamespace to enforce resource mutation policies.
Access Rights and Security¶
Security measures are implemented at the system and application levels to restrict access and manage resources.
- File Permissions:
- The installation directory
/opt/chainstackis set to mode0755. - The credentials file
/root/chainstack_admin_credentials.txtis set to mode0600and owned byroot. - The kubeconfig file
/root/.kube/configis set to mode0600. - User Access:
- The default administrative username is
admin. - The bootstrap password is generated during installation and stored in the credentials file.
- Firewall: The deployment assumes the server firewall allows incoming traffic on ports
80and443. - Kernel Security:
vm.swappinessis set to1to minimize swapping unless necessary.vm.vfs_cache_pressureis set to50to optimize inode and dentry cache.
Databases¶
The Chainstack Control Panel utilizes persistent storage for its database and state management.
- Storage Class:
local-path - Namespace:
control-panel - Release Name:
cp - Connection: The database is managed internally by the Helm release and is not exposed as a standalone service for external connection. Data persistence is handled via the
local-pathprovisioner within the Kubernetes cluster.
Docker Containers and Their Deployment¶
The application runs within a k3s Kubernetes cluster rather than as standalone Docker containers. The deployment utilizes the following components:
- Orchestration: k3s (Kubernetes)
- Package Manager: Helm
- Namespace:
control-panel - Key Deployments:
cp-cp-deployments-api: Handles API requests.cp-cp-ui: Handles the user interface.- Policy Engine: Kyverno is deployed in the
kyvernonamespace to manage cluster policies.
Proxy Servers¶
Traefik is used as the ingress controller to manage external traffic, SSL termination, and routing.
- Ingress Class:
traefik - SSL/TLS:
- Managed via Let's Encrypt (ACME).
- Email for certificate registration:
[email protected]. - Storage for ACME data:
/data/acme.json. - Challenge type:
tlschallenge. - Routing Rules:
- Path
/apiis routed to thecp-cp-deployments-apiservice on port8080. - Path
/is routed to thecp-cp-uiservice on port80. - Middleware:
- A middleware named
chainstack-api-stripis created to strip the/apiprefix before forwarding requests to the backend service. - Configuration:
- Traefik configuration is applied via a HelmChartConfig manifest located at
/var/lib/rancher/k3s/server/manifests/traefik-config.yaml.
Permission Settings¶
Specific permissions are applied to critical files and directories to ensure security and proper operation.
| File/Directory | Owner | Group | Mode | Description |
|---|---|---|---|---|
/opt/chainstack | root | root | 0755 | Installation directory |
/opt/chainstack/cpctl | root | root | 0755 | Installer script |
/root/.kube | root | root | 0700 | Kubeconfig directory |
/root/.kube/config | root | root | 0600 | Kubeconfig file |
/root/chainstack_admin_credentials.txt | root | root | 0600 | Admin credentials |
/swapfile | root | root | 0600 | Swap file |
/etc/sysctl.d/99-chainstack.conf | root | root | 0644 | Kernel tuning config |
/var/lib/rancher/k3s/server/manifests/traefik-config.yaml | root | root | 0644 | Traefik config |
Location of Configuration Files and Data¶
Configuration files and data are stored in the following locations:
- Sysctl Configuration:
/etc/sysctl.d/99-chainstack.conf - Traefik TLS Configuration:
/var/lib/rancher/k3s/server/manifests/traefik-config.yaml - Helm Values:
/root/.config/cp-suite/cp-control-panel-*.yaml - Kubernetes Manifests: Managed via k3s server manifests directory.
- Credentials:
/root/chainstack_admin_credentials.txt
Available Ports for Connection¶
The following ports are utilized for external and internal communication:
- Port 80: HTTP traffic (redirected to HTTPS).
- Port 443: HTTPS traffic for the Chainstack Control Panel UI and API.
- Port 6443: Kubernetes API server (local access only).
- Port 8080: Internal API service port (exposed via Ingress).
- Port 80: Internal UI service port (exposed via Ingress).
Starting, Stopping, and Updating¶
The Chainstack Control Panel is managed as a Kubernetes deployment. Service management is handled via kubectl and helm commands.
- Check Deployment Status:
- Wait for Deployment Readiness:
- Restart UI Deployment: The UI deployment can be restarted by patching the deployment with a restart annotation:
- Update Version: To update the Chainstack version, the
cpctlinstaller is re-run with the new version flag: - Service Management: The underlying k3s service can be managed using standard systemd commands: