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
35 changes: 10 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

LocalDevStack provides an easy-to-use Docker-based development environment for your projects.
All modules are **selective** and can be enabled via environment settings (Compose profiles).
Supports **multiple domains** and local TLS (mkcert).
Supports **multiple domains** and local TLS.

> 1) Local development only.
> 2) Your domain(s) must be resolvable on your host:
Expand All @@ -28,12 +28,19 @@ git clone https://github.com/infocyph/LocalDevStack.git
cd LocalDevStack
````

### 2) Permissions (Linux/macOS)
### 2) Setup global shortcut and Permissions

On Linux/Mac,
```bash
chmod +x ./lds 2>/dev/null || true
sudo ./lds setup permissions
```
On Windows,
```cmd
./lds setup permissions
```

Once ran, it will add a globally available shortcut (lds). And necessary permissions(linux/mac) will be assigned as well.

### 3) Start the stack

Expand All @@ -53,28 +60,6 @@ lds setup domain
sudo lds certificate install
```

### 6) Reload HTTP (after vhost/cert changes)

```bash
lds http reload
```

---

## Minimal configuration

Most setups only need:

* `PROJECT_DIR` (where your apps live)
* `COMPOSE_PROFILES` (what to run)

Example:

```dotenv
PROJECT_DIR=../application
COMPOSE_PROFILES=nginx,php,php84,tools,mariadb,redis
```

---

## CLI help (built-in “man”)
Expand All @@ -92,7 +77,7 @@ lds help certificate

This README stays intentionally short.

* Full documentation: **Read the Docs** (Sphinx docs in `docs/`)
* Full documentation: https://docs.infocyph.com/projects/LocalDevStack
* Quick reference: `lds help ...`

---
Expand Down
40 changes: 36 additions & 4 deletions lds
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,40 @@ http_reload() {
###############################################################################
# 2. PERMISSIONS FIX-UP
###############################################################################
add_to_windows_path() {
[[ "$OSTYPE" =~ (msys|cygwin) ]] || return 0
command -v cygpath >/dev/null 2>&1 || return 0

# Only add if lds.bat exists where we think it is
[[ -f "$DIR/lds.bat" ]] || return 0

local win_repo
win_repo="$(cygpath -w "$DIR")"

powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "
\$t = '$win_repo'
\$cur = [Environment]::GetEnvironmentVariable('Path','User')
if ([string]::IsNullOrWhiteSpace(\$cur)) { \$cur = '' }

# Normalize (trim + case-insensitive compare) to avoid duplicates
\$parts = \$cur -split ';' | ForEach-Object { \$_.Trim() } | Where-Object { \$_ }
\$exists = \$false
foreach (\$p in \$parts) { if (\$p.ToLowerInvariant() -eq \$t.ToLowerInvariant()) { \$exists = \$true; break } }

if (-not \$exists) {
\$new = (\$parts + \$t) -join ';'
[Environment]::SetEnvironmentVariable('Path', \$new, 'User')
}
" >/dev/null 2>&1 || true
}

fix_perms() {
[[ "$OSTYPE" =~ (msys|cygwin) ]] && return
if [[ "$OSTYPE" =~ (msys|cygwin) ]]; then
add_to_windows_path
printf "%bWindows PATH configured.%b\n" "$GREEN" "$NC"
return 0
fi

((EUID == 0)) || die "Please run with sudo."

chmod 755 "$DIR"
Expand Down Expand Up @@ -387,7 +419,7 @@ modify_profiles() {
}

# ─────────────────────────────────────────────────────────────────────────────
# Profiles (merged from docker/utilities/profiles)
# Profiles
# ─────────────────────────────────────────────────────────────────────────────

declare -A SERVICES=(
Expand Down Expand Up @@ -1934,12 +1966,12 @@ ${CYAN}Core commands:${NC}
up / start Start docker stack (quiet pull by default)
stop / down Stop stack
reload / restart Restart stack + reload HTTP
rebuild all|<svc...> Rebuild/pull services (no full down)
rebuild [all|<svc...>] Rebuild/pull services (no full down)
config Validate compose
tools Enter SERVER_TOOLS container
lzd | lazydocker Start LazyDocker
http reload Reload Nginx/Apache
core <domain> Open bash in PHP container for <domain>
core [domain] Open bash in container for <domain>

${CYAN}Setup commands:${NC}
setup init Initialize Primaries!
Expand Down
15 changes: 12 additions & 3 deletions lds.bat
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,20 @@ if not exist "%DEVHOME%\lds" (
)

where docker.exe >nul 2>&1
if errorlevel 1 echo %WARN% docker.exe not found on Windows PATH. It may fail.
if errorlevel 1 goto :run
if errorlevel 1 goto :no_docker

docker info >nul 2>&1
if errorlevel 1 echo %WARN% Docker installed but NOT running/reachable (docker info failed). Start Docker Desktop / engine.
if errorlevel 1 goto :docker_not_running

goto :run

:no_docker
echo %WARN% docker.exe not found on Windows PATH
exit /b 10

:docker_not_running
echo %WARN% Docker is installed but NOT running/reachable (docker info failed)
exit /b 11

:run
"%BASH_EXE%" -lc "set -euo pipefail; export TERM=xterm-256color; DEVHOME_WIN=\"$1\"; CALLER_WIN=\"$2\"; DEVHOME=$(cygpath -u \"$DEVHOME_WIN\"); CALLER=$(cygpath -u \"$CALLER_WIN\"); cd \"$DEVHOME\"; chmod +x ./lds >/dev/null 2>&1 || true; cd \"$CALLER\"; shift 2; exec \"$DEVHOME/lds\" --__win_workdir \"$CALLER_WIN\" \"$@\"" bash "%DEVHOME%" "%WORKDIR%" %*
Expand Down