update markdown files

This commit is contained in:
2026-01-28 22:23:58 +02:00
parent df1cdbd656
commit de17925241
2 changed files with 62 additions and 0 deletions

View File

@@ -10,6 +10,8 @@ The main script `sync-project.sh` downloads a project from a remote server via t
```
sync-project.sh # Main orchestrator - generates all helper scripts
sync-git-project.sh # Full project setup via git clone (--git mode)
shared.sh # Shared functions and variables
MANUAL # CLI help text (displayed by -h flag)
lazygit # Binary uploaded to server for git operations
scripts/ # Helper script templates
@@ -24,15 +26,35 @@ scripts/ # Helper script templates
## How It Works
### Default Mode (tar sync)
1. User runs `./sync-project.sh` from their projects directory (via symlink)
2. Script prompts for: server, password, path (default ~/public_leo), local folder
3. Creates tar archive on server, downloads and extracts locally
4. Generates helper scripts with embedded credentials (from templates in `scripts/`)
5. On full sync: syncs terminal info, uploads lazygit, updates .gitignore
### Git Mode (`--git`)
1. User runs `./sync-project.sh --git`
2. Script prompts for: server, password, path, local folder
3. Clones repository via git over SSH
4. Performs full project setup (12 steps):
- Clone repository, check for .npmrc
- Copy Docker env file (.docker/config/.env.local → .env)
- Clean Docker volumes (stop/remove containers and volumes)
- Run docker-setup.sh
- Copy server .env to .server.env
- Modify local .env (APP_NAME, APP_KEY from server)
- Create .env.prod.local with production credentials
- Add helper scripts (ssh.sh)
- Upload lazygit to server
- SSH key management (generate or download staging.key)
- Add staging.key to SSH agent
- Database setup (db:wipe + make db-sync)
## Modes
- **Default**: Full setup with all scripts, lazygit, terminfo sync
- **--git**: Full project setup via git clone with Docker, env, SSH keys, and database
- **--sftp-only**: Helper scripts only, no lazygit or .gitignore updates
- **--files-only**: Quick sync, excludes node_modules/vendor, no scripts generated
@@ -44,6 +66,13 @@ scripts/ # Helper script templates
- Conflict prevention uses `.remote-in-progress` flag file
- Terminal detection checks `$TERM` for "ghostty" or "kitty" substrings
## Shared Functions (shared.sh)
- `pause_for_user <message>` - Display message and wait for Enter key
- `get_env_value <file> <key>` - Extract value from .env file (strips quotes, CRLF)
- `set_env_value <file> <key> <value>` - Add or update value in .env file
- `add_to_gitignore <entry>` - Add entry to .gitignore if not present
## Generated Script Structure
Each helper script is built by:
@@ -55,3 +84,4 @@ Each helper script is built by:
- `-h` flag should display MANUAL and exit
- Path resolution requires valid SSH credentials
- Terminfo sync only runs on full sync (no flags) and requires infocmp
- See `verification.md` for comprehensive test cases for `--git` mode

View File

@@ -36,6 +36,7 @@ From your projects directory, run:
./sync-project.sh -h # Show help manual
./sync-project.sh --files-only # Quick sync (files only, no scripts)
./sync-project.sh --sftp-only # SFTP setup (no lazygit, no .gitignore updates)
./sync-project.sh --git # Full project setup via git clone
```
## What the Script Does
@@ -160,6 +161,34 @@ Full setup with all features:
- Uploads lazygit to server
- Updates `.gitignore`
### `--git` Mode
Full project setup via git clone with comprehensive environment configuration:
**What it does (12 steps):**
1. **Clone repository** via git over SSH, check for `.npmrc`
2. **Copy Docker env** from `.docker/config/.env.local` to `.env`
3. **Clean Docker** - stop/remove all containers and volumes
4. **Run docker-setup.sh** if present
5. **Copy server .env** to `.server.env` (marked assume-unchanged)
6. **Modify local .env** - extract APP_NAME and APP_KEY from server
7. **Create .env.prod.local** with production database credentials
8. **Add helper scripts** - generates `ssh.sh` with embedded credentials
9. **Upload lazygit** to server (marked assume-unchanged)
10. **SSH key management** - generates or downloads `staging.key`
11. **SSH-add** - adds staging.key to SSH agent
12. **Database setup** - runs `db:wipe` and `make db-sync`
**Generated files:**
- `ssh.sh` - SSH helper script (added to .gitignore)
- `staging.key` - SSH private key for server access (added to .gitignore)
- `.server.env` - Copy of server's .env file
- `.env.prod.local` - Production credentials for database sync
**Use cases:**
- Setting up a new development environment from scratch
- Cloning a project with full Docker and database configuration
- Projects that use git for version control on the server
### `--files-only` Mode
Quick sync for when you just need the files:
- Downloads project files (excludes `node_modules`, `vendor`)
@@ -182,6 +211,9 @@ Lightweight setup for SFTP workflows:
- **sshpass** - Password authentication
- **tar** - Archive creation
- **rsync** - File synchronization
- **git** - For `--git` mode
- **docker** - For `--git` mode
- **make** - For `--git` mode database sync
- **watchexec** (optional) - For watch mode scripts
### Install on macOS: