### Install K3s and Get Cluster Config Source: https://docs.canine.sh/docs/getting-started/set-up-a-kubernetes-cluster This snippet demonstrates how to install K3s, a lightweight Kubernetes distribution, on a server and then retrieve the cluster configuration file. The K3s installation is performed using a curl command, and the configuration is accessed via a cat command. ```bash curl -sfL https://get.k3s.io | sh -s - --disable traefik sudo cat /etc/rancher/k3s/k3s.yaml ``` -------------------------------- ### Install Canine using Shell Script Source: https://docs.canine.sh/docs/getting-started/optional-install-canine-locally This snippet downloads and executes the Canine installation script from GitHub using `curl`. Ensure Docker Compose is installed and functional before running this command. ```bash curl -sSL https://raw.githubusercontent.com/czhu12/canine/refs/heads/main/install/install.sh | bash ``` -------------------------------- ### Template canine.yml with ERB for Dynamic Configuration Source: https://docs.canine.sh/docs/basics/projects/preview-apps This example demonstrates using ERB templating within `canine.yml` to dynamically configure environment variables and scripts. It shows how to assign unique databases to preview apps and manage their creation and deletion. ```yaml environment_variables: - name: DATABASE_URL value: "postgres://postgres_url/preview_app_database_<%= number %>" # Have each preview app have its own database based on the pull request number scripts: predeploy: "/script-to-create-database" # Create the database when the preview app is first created postdestroy: "/script-to-drop-database" # Delete the database when the preview app is destroyed services: - name: web container_port: 6379 service_type: web_service ``` -------------------------------- ### Install K3s for Single Node Cluster with Canine Source: https://docs.canine.sh/docs/basics/clusters This command installs K3s, a lightweight Kubernetes distribution, for setting up a single-node cluster managed by Canine. This is recommended for staging or low-traffic environments. ```Bash curl -sfL https://get.k3s.io | sh - ``` -------------------------------- ### Configure Preview Apps with canine.yml Source: https://docs.canine.sh/docs/basics/projects/preview-apps This configuration file defines scripts, services, and environment variables for preview apps. It allows customization of pre-deployment, post-deployment, pre-destruction, and post-destruction scripts, as well as defining services and environment variables. ```yaml scripts: predeploy: echo "Pre deploy script" postdeploy: echo "Post deploy script" predestroy: echo "Pre destroy script" postdestroy: echo "Post destroy script" services: - name: web container_port: 6379 service_type: web_service - name: bg-worker container_port: 6379 service_type: background_worker environment_variables: - name: DATABASE_URL value: postgres://localhost/test ``` -------------------------------- ### Set REDIS_URL Environment Variable Source: https://docs.canine.sh/docs/getting-started/deploy-a-redis-database This snippet demonstrates how to set the REDIS_URL environment variable. It assumes you have already obtained the connection URL from the Redis add-on. ```Bash export REDIS_URL="your_redis_connection_url" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.