webappAIO/README.md

87 lines
3.7 KiB
Markdown

# Laravel LXC Bootstrap
Spin up a fully configured Laravel development container in one step: SSH, Apache/PHP/MariaDB or SQLite, Composer, a Laravel project, [code-server](https://code-server.dev), and [Claude Code](https://docs.claude.com/en/docs/claude-code) — all from a single command pasted into a fresh Proxmox LXC.
## Quick start
In an **empty, freshly created LXC**, logged in as root:
```bash
curl -fsSL https://git.innovator.bh/ghassan/laravel-project/raw/branch/main/bootstrap.sh -o bootstrap.sh && bash bootstrap.sh
```
You'll be prompted for:
- Laravel project name
- Git repository to clone (leave blank to scaffold a brand-new Laravel project instead)
- Database: `mysql` or `sqlite`
- MariaDB username/password/database (only if you chose `mysql`)
When it finishes you'll have a running Laravel site, code-server, and Claude Code installed.
## Fully unattended install
Skip every prompt by exporting variables before running the script (useful for scripted LXC provisioning):
```bash
APP_NAME=myapp \
GIT_REPO="" \
DB_TYPE=sqlite \
INSTALL_CODE_SERVER=yes \
INSTALL_CLAUDE_CODE=yes \
bash bootstrap.sh
```
| Variable | Description | Default |
|---|---|---|
| `APP_NAME` | Project directory name under `/var/www` | `laravel-app` |
| `GIT_REPO` | Git URL to clone; blank creates a new Laravel project | *(blank)* |
| `DB_TYPE` | `mysql` or `sqlite` | `sqlite` |
| `DB_USER` | MariaDB username (`mysql` only) | `laravel_user` |
| `DB_PASS` | MariaDB password (`mysql` only) | random |
| `DB_NAME` | MariaDB database name (`mysql` only) | `laravel_db` |
| `INSTALL_CODE_SERVER` | Install code-server | `yes` |
| `INSTALL_CLAUDE_CODE` | Install Node.js + Claude Code | `yes` |
| `FIX_SSHD` | Auto-relax sshd config (TurnKey TCP forwarding / Ubuntu root login) | `yes` |
## What the script does
1. **Base system**`apt update/upgrade`, installs `sudo curl git wget unzip`.
2. **SSH** — installs and enables `openssh-server`; on TurnKey Core containers enables `AllowTcpForwarding`, on other distros enables `PermitRootLogin yes` (needed for VS Code Remote-SSH / port tunneling).
3. **Laravel stack** — Apache, PHP + required extensions, MariaDB or SQLite, Composer, clones or scaffolds the Laravel project, sets permissions, configures an Apache vhost, generates `.env`, runs `key:generate` and `migrate`.
4. **code-server** — browser-based VS Code, so you can edit the app over SSH without a local editor.
5. **Claude Code** — installs Node.js LTS, then `npm install -g @anthropic-ai/claude-code`.
6. Prints a summary with the app path, DB type, container IP, and next steps.
## After install
- **Edit the app:** `code-server /var/www/<app-name>` then open the tunneled port (8080) in your browser.
- **Use Claude Code:** `cd /var/www/<app-name> && claude`
## Manual SSH config notes (if you skip `FIX_SSHD`)
**TurnKey Core:**
```bash
nano /etc/ssh/sshd_config.d/turnkey.conf
# set: AllowTcpForwarding yes
```
**Ubuntu:**
```bash
nano /etc/ssh/sshd_config
# set: PermitRootLogin yes
```
## Standard Claude Code project prompt
For a consistent architecture baseline (mobile-first React frontend, Laravel API backend, RBAC, MQTT real-time updates, SQLite↔PostgreSQL portability, security-first defaults), start every new Claude Code session in the project with [`claude-project-prompt.md`](./claude-project-prompt.md) as the system/instruction prompt.
## Legacy scripts
The original interactive, single-purpose scripts are still available if you don't want the full bootstrap:
- `install-laravel.sh` — Laravel + MySQL only, interactive prompts.
- `install-laravel-ad.sh` — Laravel + MySQL/SQLite choice, interactive prompts.
`bootstrap.sh` supersedes both and additionally installs SSH hardening, code-server, and Claude Code in one pass.