Make 'nix run' spin up the whole stack in one command
This commit is contained in:
1 parent
c8b08fe258
commit
4d77464988
3 files changed
+56
-26
No files matched your search
@@ -8,15 +8,25 @@ Two Laravel 10 apps sharing one MySQL database (`greaterc_db2024`):
|
||||
|
||||
## Local development
|
||||
|
||||
Requires [Nix](https://nixos.org) with flakes (direnv optional: `.envrc` → `use flake`).
|
||||
Requires [Nix](https://nixos.org) with flakes.
|
||||
|
||||
```sh
|
||||
nix develop # php 8.3 + composer + mariadb + node on PATH
|
||||
dev setup # composer install both apps, init MariaDB under .dev/
|
||||
dev db import dump.sql # load a production dump — the article/category schema only exists in prod
|
||||
dev up # http://127.0.0.1:8000 (site), http://127.0.0.1:8001 (CMS); Ctrl-C stops all
|
||||
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`.
|
||||
|
||||
|
||||
Reference in new issue
Block a user