diff --git a/README.md b/README.md index 663ff63..5a3fe08 100644 --- a/README.md +++ b/README.md @@ -13,20 +13,31 @@ This starts the container and installs all plugins listed in `plugins.txt` via G Other commands: ``` -make start # start the container -make stop # stop the container -make install-plugins # (re)install plugins from plugins.txt +make start # start the container +make stop # stop the container +make install-plugins # (re)install plugins from plugins.txt ``` Site runs at http://localhost:8080. ## Repository structure +This project uses two git repositories: + +| Repo | Contents | Purpose | +|------|----------|---------| +| `natascha-rieter-nl` (this repo) | Docker setup, Makefile, scripts | Local dev and server management | +| `natascha-rieter.nl-user` | Contents of `user/` | Deployed to production, synced with Git Sync | + +The `user/` folder in this repo is linked to the user repo via git subtree. + +### What goes where + | Path | Description | In git | |------|-------------|--------| -| `user/config/` | Site and plugin configuration | yes | -| `user/pages/` | Page content | yes (see deployment note) | -| `user/themes/natascha/` | Custom theme | yes | +| `user/config/` | Site and plugin configuration | user repo | +| `user/pages/` | Page content | user repo | +| `user/themes/natascha/` | Custom theme | user repo | | `user/plugins/` | Plugins (see plugins.txt) | no | | `user/accounts/` | Admin credentials | no | | `user/data/` | Runtime data | no | @@ -34,16 +45,45 @@ Site runs at http://localhost:8080. ## Deployment -Production is shared hosting. Deploy via FTP. +Production runs on a VPS with Apache. The user repo is cloned into the Grav `user/` folder on the server and kept in sync via the Git Sync plugin. -### Initial deploy -Upload the full `user/` directory (including locally installed plugins from `user/plugins/`). +### Server config -### Subsequent deploys -**Only upload** `user/themes/` and `user/config/`. Do **not** overwrite `user/pages/` — content is managed online by editors after go-live and a deploy would overwrite their changes. +Copy `.env.example` to `.env` and fill in your values (gitignored): -> **Future improvement**: once the site is live and content is stable, move `user/pages/` to `.gitignore` entirely (Option 1). Content backups should be handled separately (e.g. a server-side backup solution), not via git. +``` +SERVER=user@example.com +WEBROOT=/path/to/public_html +USER_REPO=ssh://git@gitea.example.com/user/repo.git +``` + +### First-time server install + +``` +make server-install +``` + +This SSHes into the server and runs `scripts/server-install.sh`, which installs Grav and clones the user repo. + +### Deploying changes + +``` +make deploy # push local user/ changes to the user repo on Gitea +make pull-content # pull editor's content changes back locally +``` + +After `make deploy`, the Git Sync plugin on the server pulls the changes automatically via webhook. + +### Server maintenance + +``` +make server-install-plugins # install/update plugins from plugins.txt on server +make server-upgrade-grav # upgrade Grav core on server +``` ## Plugins -Plugins are not committed to git. The full list is in `plugins.txt`. To install locally, run `make install-plugins`. On the production server, plugins must be uploaded manually (no CLI access on shared hosting). +Plugins are not committed to git. The full list is in `plugins.txt`. + +- Locally: `make install-plugins` +- On server: `make server-install-plugins`