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
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ No need to be a Linux wizard! Follow these simple steps.
* A server/computer running Linux (Debian 11/12 or Ubuntu 22.04+ recommended).
* "Root" (administrator) access.

### 🚀 Quick Installation
### 🚀 Quick Installation (One Click)

1. **Download the binary** (or build it if you don't have the pre-compiled binary).
2. **Start the installation** with a single command:
The easiest way to install Server Manager on a fresh VM (Google Cloud, AWS, etc.) is to use the bootstrap script. It handles everything: sudo access, dependencies, and compiling the tool.

```bash
sudo ./server_manager install
curl -sL https://raw.githubusercontent.com/Cylae/server_script/main/install.sh | bash
```

That's it! 🎉
Expand Down Expand Up @@ -162,13 +161,12 @@ Pas besoin de connaître Linux sur le bout des doigts ! Suivez ces étapes simpl
* Un serveur/ordinateur sous Linux (Debian 11/12 ou Ubuntu 22.04+ recommandés).
* Un accès "root" (administrateur).

### 🚀 Installation Rapide
### 🚀 Installation Rapide (Un Clic)

1. **Téléchargez le binaire** (ou compilez-le si vous n'avez pas le binaire pré-compilé).
2. **Lancez l'installation** avec une seule commande :
La méthode la plus simple pour installer Server Manager sur une VM vierge (Google Cloud, AWS, etc.) est d'utiliser le script de bootstrap. Il gère tout : accès sudo, dépendances et compilation.

```bash
sudo ./server_manager install
curl -sL https://raw.githubusercontent.com/Cylae/server_script/main/install.sh | bash
```

C'est tout ! 🎉
Expand Down
72 changes: 72 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash
set -e

# "One Click" Server Manager Installer
# Designed for fresh Debian/Ubuntu VMs (GCP, AWS, DigitalOcean, etc.)

# 1. Ensure Root Privileges
if [ "$EUID" -ne 0 ]; then
echo "Elevating privileges... (sudo)"

# Check if running via pipe/stdin
if [ -t 0 ]; then
# Interactive execution: re-run self with sudo
sudo "$0" "$@"
exit $?
else
# Piped execution: download script to temp file and run with sudo
TEMP_SCRIPT=$(mktemp)
# We can't access $0 content easily if piped, so we re-download or copy logic.
# But since we are likely running 'curl ... | bash', $0 is bash.
# To support this robustly, we should assume the user is piping from the URL.
# We will re-curl the script.

echo "Downloading installer to temporary file for elevation..."
curl -sL https://raw.githubusercontent.com/Cylae/server_script/main/install.sh -o "$TEMP_SCRIPT"
chmod +x "$TEMP_SCRIPT"
sudo "$TEMP_SCRIPT" "$@"
rm -f "$TEMP_SCRIPT"
exit $?
fi
fi

echo "=== Server Manager Bootstrap ==="
echo "Starting installation on $(hostname)..."

# 2. Basic Dependencies (for bootstrapping)
# We need git to clone the repo (if running via curl) and build-essential for Rust compilation
echo "Installing bootstrap dependencies..."
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get install -y -qq git build-essential curl libssl-dev pkg-config

# 3. Clone Repository (if not already local)
# If the script is run from inside the repo, we use the current dir.
# If run via curl, we clone to /opt/server_manager_source
if [ -d "server_manager" ] && [ -f "server_manager/Cargo.toml" ]; then
echo "Running from source directory..."
SRC_DIR=$(pwd)
else
echo "Cloning repository..."
SRC_DIR="/opt/server_manager_source"
if [ -d "$SRC_DIR" ]; then
rm -rf "$SRC_DIR"
fi
git clone https://github.com/Cylae/server_script.git "$SRC_DIR"
fi

cd "$SRC_DIR/server_manager"

# 4. Install Rust (if missing)
if ! command -v cargo &> /dev/null; then
echo "Installing Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
fi

# 5. Build and Run Server Manager
echo "Building Server Manager..."
cargo build --release

echo "Launching Server Manager Installer..."
./target/release/server_manager install
5 changes: 3 additions & 2 deletions server_manager/src/services/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ impl Service for NextcloudService {
let config_dir = Path::new("./config/nextcloud");
fs::create_dir_all(config_dir).context("Failed to create nextcloud config dir")?;

let db_pass = secrets.nextcloud_db_password.clone().unwrap_or_default();
let admin_pass = secrets.nextcloud_admin_password.clone().unwrap_or_default();
let escape_php = |s: &str| s.replace('\\', "\\\\").replace('"', "\\\"");
let db_pass = escape_php(&secrets.nextcloud_db_password.clone().unwrap_or_default());
let admin_pass = escape_php(&secrets.nextcloud_admin_password.clone().unwrap_or_default());

let php_config = format!(r#"<?php
$AUTOCONFIG = array(
Expand Down
Loading