CasaOS

repository·main·Indexed 13 days ago

https://github.com/icewhaletech/casaos

An open-source personal cloud platform for home scenarios. CasaOS provides a user-friendly interface to manage files and hardware, and install Docker-based applications such as Nextcloud, HomeAssistant, and Jellyfin. It supports amd64/x86-64, arm64, and armv7 architectures on operating systems including Debian 12, Ubuntu Server 20.04, and Raspberry Pi OS.

Tokens
1.7K
Snippets
10
Records
13
Agent score
98%

What's inside CasaOS

  1. Update CasaOS

    main

    You can update CasaOS using the User Interface (UI) by navigating to Settings ... Update.

    Alternatively, you can update via a terminal session (SSH or direct attachment). Note that terminal updates cannot be performed from the terminal window inside the CasaOS UI; they must be run from a standard system shell.

    # Update to the latest release via terminal
    wget -qO- https://get.casaos.io/update | sudo bash
    
    # or
    
    curl -fsSL https://get.casaos.io/update | sudo bash
  2. Uninstall CasaOS

    main

    The uninstallation method depends on the version of CasaOS you are running.

    # For v0.3.3 or newer
    casaos-uninstall
    
    # For versions older than v0.3.3
    curl -fsSL https://get.icewhale.io/casaos-uninstall.sh | sudo bash
  3. Install CasaOS development dependencies

    main

    After cloning the repository into your Go workspace, you must install both the frontend (UI) dependencies using yarn and the backend Go dependencies. The UI build process is a prerequisite for a complete development environment.

    cd UI
    yarn install
    yarn build
    cd ..
    go get
  4. Install CasaOS via one-liner command

    main

    To perform a quick setup on a freshly installed system, run one of the following commands in your terminal. CasaOS is compatible with Ubuntu, Debian, Raspberry Pi OS, and CentOS. It supports amd64 / x86-64, arm64, and armv7 architectures.

    wget -qO- https://get.casaos.io | sudo bash

    or

    curl -fsSL https://get.casaos.io | sudo bash
  5. Set up a CasaOS development environment

    main

    To develop for CasaOS, you must first ensure your system meets the language requirements and then follow a specific directory structure within your Go workspace to ensure compatibility with Go's module resolution and submodules.

    ### Pre-requisites
    - Go > v1.17.0
    - yarn
    - node.js
    
    ### 1. Fork the Repo
    Fork the repo onto your own GitHub account.
    
    ### 2. Clone the repo down
    1. Navigate into your go workspace (check with `go env GOPATH`).
    2. Navigate to the appropriate path for github. It should look something like this: `<path from GOPATH>/github.com/<GitHub Username>/`. If it doesn't exist create it.
    3. Clone down the repo with the following:
    ```bash
    git clone --recurse-submodules --remote-submodules https://github.com/<your GitHub Username>/CasaOS.git

    3. Install dependencies

    cd UI
    yarn install
    yarn build
    cd ..
    go get
  6. CasaOS System and Hardware Compatibility

    main

    Hardware Architectures

    • amd64 / x86-64
    • arm64
    • armv7

    Officially Supported Operating Systems

    • Debian 12 (Tested, Recommended)
    • Ubuntu Server 20.04 (Tested)
    • Raspberry Pi OS (Tested)

    Community Supported Operating Systems

    • Elementary 6.1 (Tested)
    • Armbian 22.04 (Tested)
    • Alpine (Not Fully Tested)
    • OpenWrt (Not Fully Tested)
    • ArchLinux (Not Fully Tested)
  7. Initialize a new Resty client with NewRestyClient()

    main

    Use NewRestyClient() to create a pre-configured *resty.Client instance suitable for driver communication. The returned client includes the following default settings:

    • A standard user-agent header (set to a Chrome/Windows string).
    • A retry count of 3.
    • A default timeout of 30 seconds (DefaultTimeout).
    import "github.com/icewhaletech/icewhaletech/casaos/drivers/base"
    
    client := base.NewRestyClient()
    // Use client for HTTP requests
  8. Reference base client configuration constants

    main

    The base package provides several exported variables to control or inspect default HTTP behavior:

    • RestyClient: A singleton instance of a pre-configured *resty.Client.
    • HttpClient: A pointer to a standard http.Client.
    • UserAgent: The default string used for the user-agent header.
    • DefaultTimeout: The default time.Duration (30 seconds) used for client timeouts.
    var (
    	NoRedirectClient *resty.Client
    	RestyClient      *resty.Client
    	HttpClient       *http.Client
    	UserAgent        string
    	DefaultTimeout   time.Duration
    )
  9. CasaOS API Routing Structure

    main

    CasaOS exposes its functionality through multiple API versions and specialized routers. The service uses a HandlerMultiplexer to route requests based on path prefixes:

    • /v1: Core API routes (e.g., /v1/sys, /v1/file, /v1/port, /v1/image, /v1/samba).
    • /v2: Version 2 API routes.
    • /v3: File-related routing.
    • /doc: API documentation (generated from OpenAPI specs and embedded HTML).
  10. Run CasaOS with CLI flags

    main

    The CasaOS binary accepts several command-line flags to configure its execution environment, specifically for the configuration file location and the SQLite database path.

    • -c: Specify the configuration address/path.
    • -db: Specify the path to the SQLite database file.
    • -v: Display the current version and exit.
    go run main.go -c /path/to/config.conf -db /path/to/casaos.db
    go run main.go -v