35 lines
1.0 KiB
Markdown
35 lines
1.0 KiB
Markdown
# NAS Git Deploy (sample)
|
|
|
|
This folder contains a sample `post-receive` hook for deploying the app on a NAS via a bare git repository.
|
|
|
|
Quick setup (example):
|
|
|
|
1. On the NAS, create directories and a bare repo:
|
|
|
|
```bash
|
|
mkdir -p /srv/njts-accounting/repo.git
|
|
git init --bare /srv/njts-accounting/repo.git
|
|
mkdir -p /srv/njts-accounting/app
|
|
```
|
|
|
|
2. Copy the `post-receive` hook into the bare repo hooks and make it executable:
|
|
|
|
```bash
|
|
cp deploy/post-receive /srv/njts-accounting/repo.git/hooks/post-receive
|
|
chmod +x /srv/njts-accounting/repo.git/hooks/post-receive
|
|
```
|
|
|
|
3. On your local machine, add a remote and push:
|
|
|
|
```bash
|
|
git remote add nas ssh://user@nas:/srv/njts-accounting/repo.git
|
|
git push nas main
|
|
```
|
|
|
|
4. Ensure Docker and Docker Compose are installed on the NAS and `/srv/njts-accounting/docker-compose.yml` points to the code in `/srv/njts-accounting/app`.
|
|
|
|
Notes:
|
|
|
|
- Adjust paths and permissions according to your NAS environment.
|
|
- The sample hook runs `docker compose up -d --build` and may require the user to be in the `docker` group or run via sudo.
|