Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 94 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,12 @@ ssl:

### Database Configuration

File metadata storage settings.
File metadata storage settings. Armor supports SQLite, PostgreSQL, and MySQL databases.

#### SQLite Configuration (Default)
```yaml
database:
dialect: "sqlite" # Database type (sqlite only)
dialect: "sqlite" # Database type
storage: "/var/lib/armor/database/armor.db"
logging: false # Enable SQL query logging
pool:
Expand All @@ -180,6 +181,70 @@ database:
idle: 10000 # Idle timeout (ms)
```

#### PostgreSQL Configuration
```yaml
database:
dialect: "postgres"
host: "localhost"
port: 5432
database: "armor_db"
username: "armor_user"
password: "armor_password"
logging: false
pool:
max: 10
min: 2
idle: 30000
```

#### MySQL Configuration
```yaml
database:
dialect: "mysql"
host: "localhost"
port: 3306
database: "armor_db"
username: "armor_user"
password: "armor_password"
logging: false
pool:
max: 10
min: 2
idle: 30000
```

#### PostgreSQL Configuration
```yaml
database:
dialect: "postgres"
host: "localhost"
port: 5432
database: "armor_db"
username: "armor_user"
password: "armor_password"
logging: false
pool:
max: 10
min: 2
idle: 30000
```

#### MySQL Configuration
```yaml
database:
dialect: "mysql"
host: "localhost"
port: 3306
database: "armor_db"
username: "armor_user"
password: "armor_password"
logging: false
pool:
max: 10
min: 2
idle: 30000
```

### Swagger UI Configuration

API documentation interface settings.
Expand Down Expand Up @@ -276,6 +341,14 @@ export ARMOR_SSL_KEY_FILE=/path/to/key.pem
export ARMOR_SSL_CERT_FILE=/path/to/cert.pem

# Database configuration
export ARMOR_DATABASE_DIALECT=postgres
export ARMOR_DATABASE_HOST=localhost
export ARMOR_DATABASE_PORT=5432
export ARMOR_DATABASE_NAME=armor_db
export ARMOR_DATABASE_USERNAME=armor_user
export ARMOR_DATABASE_PASSWORD=armor_password

# SQLite specific
export ARMOR_DATABASE_STORAGE=/custom/path/database.db

# Security configuration
Expand Down Expand Up @@ -345,10 +418,29 @@ Armor validates configuration on startup and will:
- Test with basic auth: `curl -k -u admin:admin123 https://localhost/`

**Database Issues**

**SQLite Issues**
- Check SQLite file permissions: `sudo chown armor:armor /var/lib/armor/database/`
- Verify disk space available
- Test database: `sqlite3 /var/lib/armor/database/armor.db .tables`

**PostgreSQL Issues**
- Check connection: `psql -h localhost -U armor_user -d armor_db`
- Verify schema ownership: `psql -d armor_db -c "\dn+"`
- If ENUM creation fails: `sudo -u postgres psql -d armor_db -c "ALTER SCHEMA public OWNER TO armor_user;"`
- Check PostgreSQL service: `sudo systemctl status postgresql`

**MySQL Issues**
- Check connection: `mysql -h localhost -u armor_user -p armor_db`
- Verify user privileges: `SHOW GRANTS FOR 'armor_user'@'localhost';`
- Check MySQL service: `sudo systemctl status mysql`

**General Database Issues**
- Verify database dependencies are installed (`pg` for PostgreSQL, `mysql2` for MySQL)
- Check database service is running
- Verify network connectivity and firewall settings
- Review Armor logs: `sudo journalctl -u armor -f`

---

For more help, see [Support Documentation](../support/) or [open an issue](https://github.com/STARTcloud/armor_private/issues).
5 changes: 3 additions & 2 deletions docs/guides/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ This guide will walk you through setting up Armor for the first time, from insta
Before starting, ensure you have:

- **Node.js 22+** - Required for running Armor server
- **SQLite3** - For file metadata storage
- **Database** - SQLite3 (default), PostgreSQL, or MySQL for file metadata storage
- **Database Dependencies** - `pg` package for PostgreSQL, `mysql2` for MySQL (install via npm)
- **OpenSSL** - For SSL certificate generation
- **Network Access** - For HTTPS file serving

Expand Down Expand Up @@ -55,7 +56,7 @@ cd armor_private
npm ci

# Configure
cp config.yaml.example config.yaml
cp dev.config.yaml config.yaml
# Edit config.yaml with your settings

# Start server
Expand Down
86 changes: 86 additions & 0 deletions docs/guides/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,92 @@ ssl:
cert_file: "/etc/letsencrypt/live/armor.yourdomain.com/fullchain.pem"
```

## Database Setup

Armor supports SQLite (default), PostgreSQL, and MySQL databases.

### SQLite (Default)

No additional setup required. SQLite database is created automatically.

```yaml
database:
dialect: "sqlite"
storage: "/var/lib/armor/database/armor.db"
logging: false
```

### PostgreSQL Setup

#### Install Dependencies

```bash
# Add PostgreSQL support
npm install pg
```

#### Create Database and User

```bash
# Create database and user
sudo -u postgres createdb armor_db
sudo -u postgres createuser armor_user
sudo -u postgres psql -c "ALTER USER armor_user WITH PASSWORD 'armor_password';"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE armor_db TO armor_user;"

# Critical: Set schema ownership for ENUM creation
sudo -u postgres psql -d armor_db -c "ALTER SCHEMA public OWNER TO armor_user;"
```

#### Configure Armor

```yaml
database:
dialect: "postgres"
host: "localhost"
port: 5432
database: "armor_db"
username: "armor_user"
password: "armor_password"
logging: false
```

### MySQL Setup

#### Install Dependencies

```bash
# Add MySQL support
npm install mysql2
```

#### Create Database and User

```bash
# Connect to MySQL as root
mysql -u root -p

# Create database and user
CREATE DATABASE armor_db;
CREATE USER 'armor_user'@'localhost' IDENTIFIED BY 'armor_password';
GRANT ALL PRIVILEGES ON armor_db.* TO 'armor_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
```

#### Configure Armor

```yaml
database:
dialect: "mysql"
host: "localhost"
port: 3306
database: "armor_db"
username: "armor_user"
password: "armor_password"
logging: false
```

## Service Configuration

### DEBIAN/Ubuntu (systemd)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ graph TD
B -- File Operations --> C[File System];
B -- Real-time Updates --> D[WebSocket/SSE];
B -- Authentication --> E[JWT/API Keys];
B -- File Metadata --> F[SQLite Database];
B -- File Metadata --> F[Database (SQLite/PostgreSQL/MySQL)];
G[CLI Tools] -- HTTP Basic Auth --> B;
H[API Clients] -- Bearer Tokens --> B;
```
Expand Down
Loading