36 lines
1.3 KiB
Markdown
36 lines
1.3 KiB
Markdown
# think.greaterchiangmai.com
|
|
|
|
Two Laravel 10 apps sharing one MySQL database (`greaterc_db2024`):
|
|
|
|
- `think.greaterchiangmai.com/` — public site
|
|
- `think-backend.greaterchiangmai.com/` — CMS (`/login`)
|
|
- `upload-large-file/` — standalone S3 multipart upload helper (Node)
|
|
|
|
## Local development
|
|
|
|
Requires [Nix](https://nixos.org) with flakes.
|
|
|
|
```sh
|
|
nix run # installs vendors on first run, starts MariaDB, serves both apps; Ctrl-C stops all
|
|
```
|
|
|
|
- site: http://127.0.0.1:8000
|
|
- CMS: http://127.0.0.1:8001
|
|
|
|
The site's article pages need the production schema, which only exists in the prod DB:
|
|
|
|
```sh
|
|
mysqldump greaterc_db2024 > dump.sql # on the server
|
|
nix run . -- db import dump.sql
|
|
```
|
|
|
|
`nix run . -- <cmd>` forwards to the `dev` script; `nix develop` drops you into a shell with
|
|
`dev`, `php`, `composer`, `mariadb`, `node` on PATH (direnv: `.envrc` → `use flake`).
|
|
|
|
Other commands: `dev db start|stop|status|shell`, `dev serve frontend|backend`,
|
|
`dev artisan <app> ...`, `dev down`. See `dev help`.
|
|
|
|
The local DB listens on `127.0.0.1:3307` (override with `DEV_DB_PORT`); the `dev` script
|
|
injects `DB_*`, `APP_DEBUG=true`, `TEST_LOCAL=true` via the process environment so each
|
|
app's `.env` is left untouched. Ports: `DEV_FRONTEND_PORT`, `DEV_BACKEND_PORT`.
|