# Installation guides

This guide walks you through the installation and initial configuration of the Bekane platform.

The installation process is divided into three main components:

* [**Backend**](#backend-installation) — Provides the API, authentication, scheduling system, and core services
* [**Frontend UI**](#frontend-ui-installation) — Delivers the web interface used to access and manage the platform
* [**Edge Service**](#edge-service-installation) — Handles remote execution, infrastructure interactions, and distributed operations

Each section includes the required packages, configuration steps, and verification procedures to help you quickly deploy a functional Bekane environment.

## Install Required Utilities

Some minimal Debian installations may not include the required tools by default.

Install `curl` and `gpg` before continuing:

```bash
sudo apt updatesudo apt install -y curl gpg
```

These utilities are required to:

* Download the repository signing key
* Import and manage APT trusted keys
* Configure the Bekane package repository

## Configure the APT Repositories

Before installing Bekane, you must configure the official APT repositories on your system.

Add the official Bekane repository:

```bash
REPO_URL="https://repo-community.bekane.fr"
REPO_DIST="stable"

sudo mkdir -p /usr/share/keyrings

curl -fsSL "$REPO_URL/repo-signing-key.gpg" \
  | gpg --dearmor \
  | sudo tee /usr/share/keyrings/bekane-standalone-archive-keyring.gpg >/dev/null

cat <<EOF_REPO | sudo tee /etc/apt/sources.list.d/bekane-standalone.list > /dev/null
deb [signed-by=/usr/share/keyrings/bekane-standalone-archive-keyring.gpg arch=amd64] $REPO_URL $REPO_DIST main
EOF_REPO

sudo apt update
```

## Backend installation

The backend component provides the core API, authentication system, task scheduler, and infrastructure management services used by Bekane.

### Install the Backend Package

Install the Bekane backend package using APT:

```bash
 sudo apt install bekane
```

### Run the Setup Wizard

Once the package installation is complete, launch the interactive setup wizard:

```bash
sudo bekane-setup --component bekane
```

The setup wizard will guide you through the backend configuration process, including:

* Database configuration
* Backend URL configuration
* Service initialization
* Environment setup
* Initial application settings

### Complete the Configuration

Follow the on-screen instructions to complete the installation.

<details>

<summary>Bekane Setup Tool Script</summary>

```bash
========================================
   BEKANE CORE CONFIGURATION
========================================
Project installation path [/opt/bekane/backend]: 
Virtualenv path [/opt/bekane/venv]:
## ...requirements installation...

Log directory [/var/log/bekane]: 

--- Database Configuration ---
Database name [bekane]: 
Database user [bekaneuser]: 
Database password (empty for random):

Generating .env file...

Configuring services...
Project FQDN [localhost]: 

Finalizing installation...
## ...Migrations application...
## ...Service installation (systemd / nginx)...

Create superuser? (y/n) [y]:

Creating OAuth2 Application for Frontend...

 Bekane Core is ready!

========================================
   OAUTH2 FRONTEND CREDENTIALS
========================================
Client ID:      client-id-to-save
Client Secret:  client-secret-to-save

Note: These credentials must be configured in your UI environment.
========================================
```

</details>

Once the setup is finished, the backend services will be automatically configured and started.

{% hint style="warning" %}
At the end of the setup process, the wizard will generate a **Client ID** and a **Client Secret**.

These credentials must be saved securely, as they will be required later during the frontend configuration process to allow the UI to authenticate against the Bekane backend.
{% endhint %}

## Frontend UI Installation

The frontend component provides the Bekane web interface used to access and manage the platform.

### Install the Frontend Package

Install the Bekane UI package using APT:

```bash
sudo apt install -y bekane-ui
```

### Run the Setup Wizard

Once the installation is complete, launch the frontend setup wizard:

```bash
sudo bekane-setup --component ui
```

The setup wizard will guide you through the frontend configuration process, including:

* Frontend URL configuration
* Backend API connection settings
* Authentication configuration
* Client ID and Client Secret registration
* Web server configuration

### Complete the Configuration

Follow the on-screen instructions to finalize the setup.

<details>

<summary>Bekane UI Setup Tool Script</summary>

```bash
========================================
   BEKANE UI CONFIGURATION
========================================
Web directory (deployment target) [/var/www/bekane-ui]: 
Backend API URL [http://localhost:8000]: 
OAuth2 Client ID: backend-client-id
OAuth2 Client Secret: backend-client-secret

## ...file deployments...

Configuring Nginx...
UI FQDN [localhost]:

## ...nginx configuration...

Bekane UI is ready!
```

</details>

Once completed, the frontend services and web server configuration will be automatically applied.

## Edge Service Installation

The Edge component is responsible for handling distributed operations, remote execution tasks, and infrastructure communication.

### Install the Edge Package

Install the Bekane Edge package using APT:

```bash
sudo apt install -y bekane-edge
```

### Run the Setup Wizard

Once the installation is complete, launch the Edge setup wizard:

```bash
sudo bekane-setup --component edge
```

The setup wizard will guide you through the Edge configuration process, including:

* Edge service URL configuration
* Service initialization
* Environment configuration

### Complete the Configuration

Follow the on-screen instructions to finalize the installation.

<details>

<summary>Bekane Edge Setup Tool</summary>

```bash
========================================
   BEKANE EDGE CONFIGURATION
========================================
Edge installation path [/opt/bekane/edge]: 
Virtualenv path [/opt/bekane/venv]: 

## ...requirements installation...

Log directory [/var/log/bekane]: 

Generating .env file...
Edge FQDN [localhost]:
Path to nft binary [/usr/sbin/nft]: 

Configuring services...

Configuring sysctl...

Finalizing installation...

## ...Migrations application...

Setting up database permissions...
Create superuser? (y/n) [y]: 
Username (leave blank to use 'root'):
Email address:
Password: 
Password (again): 
Superuser created successfully.
Configure a default Port Pool? (y/n) [y]:
Pool name [Default Pool]: 
Bind address [0.0.0.0]: 
Advertised host (FQDN or IP) [localhost]: 
Port range [40000-41000]: 

## ...Nginx configuration... 

Bekane Edge is ready!

========================================
   EDGE SHARED TOKEN
========================================
Token: edge-shared-token

Important: Use this token in Bekane Backend configuration.
========================================
```

</details>

Once completed, the Edge services will be automatically configured and started.

{% hint style="warning" %}
At the end of the setup process, the wizard will generate a **Token**.

This token must be saved securely, as they will be required later during the edge configuration process. See [Edge configuration](/aministrator-docs/server-setup/edge-configuration.md) page for more information.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.bekane.org/aministrator-docs/server-setup/installation-guides.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
