Add migration scripts and other fixes
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
# Utility Scripts
|
||||
|
||||
These scripts support the EternityMail Docker Compose deployment. Run them from the repository root.
|
||||
|
||||
## `generate-des-key.sh`
|
||||
|
||||
Generates a random 24-character alphanumeric value for Roundcube's `RC_DES_KEY` setting.
|
||||
|
||||
Requirements:
|
||||
|
||||
- Linux, macOS, or another Unix-like shell
|
||||
- `/dev/urandom`
|
||||
|
||||
Usage:
|
||||
|
||||
```bash
|
||||
chmod +x scripts/generate-des-key.sh
|
||||
scripts/generate-des-key.sh
|
||||
```
|
||||
|
||||
Copy the printed value into `.env`:
|
||||
|
||||
```dotenv
|
||||
RC_DES_KEY=<generated-value>
|
||||
```
|
||||
|
||||
Keep this value stable after Roundcube has been deployed. Changing it can make existing encrypted session data unreadable.
|
||||
|
||||
## `generate-des-key.ps1`
|
||||
|
||||
Generates the same type of 24-character key using PowerShell.
|
||||
|
||||
Requirements:
|
||||
|
||||
- PowerShell 5.1 or PowerShell 7+
|
||||
|
||||
Usage from PowerShell:
|
||||
|
||||
```powershell
|
||||
.\scripts\generate-des-key.ps1
|
||||
```
|
||||
|
||||
Copy the printed value into `RC_DES_KEY` in `.env`.
|
||||
|
||||
## `setup-data-dirs.sh`
|
||||
|
||||
Creates the host directories used by the Stalwart and Roundcube containers and assigns ownership of the Stalwart directories to uid/gid `2000`, which is the user used by the Stalwart image.
|
||||
|
||||
Requirements:
|
||||
|
||||
- Linux or another Unix-like host
|
||||
- Permission to create and change ownership under `DATA_ROOT`
|
||||
|
||||
The script does not read `.env` automatically. Set `DATA_ROOT` explicitly when running it:
|
||||
|
||||
```bash
|
||||
chmod +x scripts/setup-data-dirs.sh
|
||||
sudo DATA_ROOT=/opt/eternitymail ./scripts/setup-data-dirs.sh
|
||||
```
|
||||
|
||||
When `DATA_ROOT` is omitted, the script uses `/opt/eternitymail`.
|
||||
|
||||
The created directories are:
|
||||
|
||||
- `$DATA_ROOT/stalwart/etc`
|
||||
- `$DATA_ROOT/stalwart/data`
|
||||
- `$DATA_ROOT/stalwart/certs`
|
||||
- `$DATA_ROOT/roundcube-db`
|
||||
- `$DATA_ROOT/roundcube-config`
|
||||
|
||||
Only `$DATA_ROOT/stalwart` is changed to uid/gid `2000:2000`; the MariaDB container manages its own data-directory permissions.
|
||||
|
||||
## Typical order
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
scripts/generate-des-key.sh
|
||||
sudo DATA_ROOT=/opt/eternitymail ./scripts/setup-data-dirs.sh
|
||||
docker compose config --quiet
|
||||
docker compose up -d
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Creates the host data directories for stalwart/roundcube and sets ownership
|
||||
# expected by each container (stalwart runs as uid/gid 2000).
|
||||
set -euo pipefail
|
||||
|
||||
DATA_ROOT="${DATA_ROOT:-/opt/eternitymail}"
|
||||
|
||||
mkdir -p \
|
||||
"$DATA_ROOT/stalwart/etc" \
|
||||
"$DATA_ROOT/stalwart/data" \
|
||||
"$DATA_ROOT/stalwart/certs" \
|
||||
"$DATA_ROOT/roundcube-db" \
|
||||
"$DATA_ROOT/roundcube-config"
|
||||
|
||||
chown -R 2000:2000 "$DATA_ROOT/stalwart"
|
||||
|
||||
echo "Data directories ready under $DATA_ROOT"
|
||||
Reference in New Issue
Block a user