> ## Documentation Index
> Fetch the complete documentation index at: https://docs.argyros.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-hosting Argyros

> Deploy the Argyros community binary with Docker or a raw binary, then harden it with nginx, SSL, and systemd.

# Self-hosting Argyros

This guide walks through a production deployment of the Argyros community binary — from first credential to an instance running behind nginx with SSL and auto-restart on reboot.

<Info>
  New to self-hosting? Start with the [self-hosted overview](/get-started/self-hosted) to understand requirements and the quickest path to a running instance.
</Info>

<Steps>
  <Step title="Get a FluxRPC key">
    Sign up at [fluxrpc.com](https://fluxrpc.com?ref=ARGYROS) and copy your API key. You'll use the same key for both `RPC_URL` and `YELLOWSTONE_TOKEN`. The binary makes a live RPC call at startup to validate the key — it won't start with an invalid or missing one.
  </Step>

  <Step title="Get a community license key">
    Register at [license.argyros.xyz](https://license.argyros.xyz). After signup your license key (`argycom_...`) appears on the dashboard. The binary fetches your plan's rate limits from the license server at startup and enforces them on every request.
  </Step>

  <Step title="Deploy">
    <Tabs>
      <Tab title="Docker Compose">
        ```bash theme={"theme":"github-dark"}
        # Download the env template and compose file
        curl -O https://raw.githubusercontent.com/argyros-ag/argyros-community/main/.env.example
        curl -O https://raw.githubusercontent.com/argyros-ag/argyros-community/main/docker-compose.yml
        cp .env.example .env

        # Fill in your credentials
        nano .env

        # Start
        docker compose up -d
        docker compose logs -f
        ```

        Verify the service is up:

        ```bash theme={"theme":"github-dark"}
        curl http://localhost:8080/health
        # → {"status":"ok"}
        ```
      </Tab>

      <Tab title="Binary">
        ```bash theme={"theme":"github-dark"}
        # Download for your platform (use linux-arm64 on ARM servers)
        curl -L https://github.com/argyros-ag/argyros-community/releases/latest/download/argyros-community-linux-amd64 \
          -o argyros-community && chmod +x argyros-community

        # Download and fill the env template
        curl -O https://raw.githubusercontent.com/argyros-ag/argyros-community/main/.env.example
        cp .env.example .env && nano .env

        # Run
        set -a; source .env; set +a
        ./argyros-community
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Configure">
    All configuration is via environment variables in `.env`. The full reference:

    | Variable                 | Required | Default   | Description                                              |
    | ------------------------ | -------- | --------- | -------------------------------------------------------- |
    | `COMMUNITY_MODE`         | yes      | —         | Must be `true`                                           |
    | `CHAIN`                  | no       | `fogo`    | Chain selection (`fogo` only for now)                    |
    | `RPC_URL`                | yes      | —         | FluxRPC Fogo endpoint with your API key                  |
    | `YELLOWSTONE_URL`        | yes      | —         | Yellowstone gRPC endpoint                                |
    | `YELLOWSTONE_TOKEN`      | yes      | —         | Your FluxRPC API key                                     |
    | `COMMUNITY_LICENSE_KEY`  | yes      | —         | License key from license.argyros.xyz                     |
    | `COMMUNITY_LICENSE_API`  | yes      | —         | `https://license.argyros.xyz`                            |
    | `LICENSE_CHECK_INTERVAL` | no       | `6h`      | How often to re-validate the license                     |
    | `REFERRER_WALLET`        | no       | —         | Wallet address for referral fees (dApp builders only)    |
    | `ALLOWED_IPS`            | no       | —         | Comma-separated CIDRs to allowlist; empty = unrestricted |
    | `HTTP_PORT`              | no       | `8080`    | HTTP listen port                                         |
    | `HTTP_HOST`              | no       | `0.0.0.0` | HTTP listen host                                         |
    | `LUT_AUTHORITY_KEY_FOGO` | no       | —         | Private key for Address Lookup Table provisioning        |

    <Warning>
      `LUT_AUTHORITY_KEY_FOGO` holds a Solana private key that must carry SOL for LUT rent. Treat it as a secret: `chmod 600` its file, never commit it, and never expose it in logs or process listings.
    </Warning>
  </Step>

  <Step title="Set up nginx and SSL">
    To expose the API publicly over HTTPS, proxy it behind nginx with a Let's Encrypt certificate. A ready-to-use config is in the [argyros-community repo](https://github.com/argyros-ag/argyros-community/blob/main/examples/nginx.conf).

    ```bash theme={"theme":"github-dark"}
    apt install -y nginx certbot python3-certbot-nginx

    # Download the reference nginx config
    curl -o /etc/nginx/sites-available/argyros.conf \
      https://raw.githubusercontent.com/argyros-ag/argyros-community/main/examples/nginx.conf

    # Edit server_name to your domain
    nano /etc/nginx/sites-available/argyros.conf

    ln -s /etc/nginx/sites-available/argyros.conf /etc/nginx/sites-enabled/
    nginx -t && systemctl reload nginx

    # Issue certificate
    certbot --nginx -d your-domain.com
    ```

    After this, the engine is reachable at `https://your-domain.com/api/v1/...`.
  </Step>

  <Step title="Referral fees (dApp builders only)">
    If you are building a dApp or UI that routes swaps for end users, set `REFERRER_WALLET` to your wallet address. The engine appends your ATA to every swap transaction; the on-chain program automatically splits a portion of the protocol fee to you.

    ```env theme={"theme":"github-dark"}
    REFERRER_WALLET=YourBase58WalletAddress
    ```

    Leave `REFERRER_WALLET` unset if you are running the engine for your own bot or internal trades. There is no "referrer" in that case — setting it when you are both the router and the swapper has no effect.
  </Step>

  <Step title="Run as a systemd service">
    To start the engine automatically on boot and restart it on failure:

    ```bash theme={"theme":"github-dark"}
    # Create a dedicated user (optional but recommended)
    useradd -r -s /bin/false argyros

    # Install the binary and env file
    cp argyros-community /opt/argyros/
    cp .env /opt/argyros/.env
    chmod 600 /opt/argyros/.env
    chown -R argyros:argyros /opt/argyros

    # Create the unit file
    cat > /etc/systemd/system/argyros.service << 'EOF'
    [Unit]
    Description=Argyros Community
    After=network.target

    [Service]
    EnvironmentFile=/opt/argyros/.env
    ExecStart=/opt/argyros/argyros-community
    Restart=always
    RestartSec=5
    User=argyros

    [Install]
    WantedBy=multi-user.target
    EOF

    systemctl daemon-reload
    systemctl enable --now argyros
    journalctl -u argyros -f
    ```
  </Step>
</Steps>

<Info>
  **Solana support coming soon.** The community binary currently runs on Fogo only (`CHAIN=fogo`). See [Supported Chains](/concepts/chains).
</Info>
