aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: eb7dca9284c51c3483d50daad4c1231e90455d08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

# kagapics

A lightweight, self-hosted photo gallery for collecting trip photos from friends. Single Go binary, no database, no runtime dependencies.

## Build

```sh
go build -o gallery .
```

## Usage

### Create a gallery

```sh
./gallery create <name> <password> [--data ./gallery-data] [--no-thumbs]
```

### Delete a gallery

```sh
./gallery delete <name> [--data ./gallery-data]
```

Removes the gallery from the config and deletes its folder (photos + thumbnails). Asks for confirmation before deleting.

### Start the server

```sh
./gallery serve [--addr :8080] [--data ./gallery-data]
```

### Caddy reverse proxy

```caddy
{
    supervisor {
        ./gallery serve --addr :8020 --data ./gallery-data {
            dir /home/ubuntu
            restart_policy always
        }
    }
}

pics.example.com {
    reverse_proxy localhost:8020
}
```

## Test

```sh
go test ./...
```

## Deploy

The VPS runs the gallery as a Docker Compose service behind Caddy at
`https://pics.kagamino.dev`. The replacement service starts with a fresh local
`./gallery-data` folder next to the VPS Compose file; the former systemd data is
archived separately and is not imported.

Authenticate the local and VPS Docker clients once, then deploy with:

```sh
docker login container.registry.kagamino.dev
ssh ubuntu@feed.kagamino.dev "sudo docker login container.registry.kagamino.dev"
mise run deploy
```

Create a new gallery in the empty deployment from the VPS:

```sh
ssh ubuntu@feed.kagamino.dev \
  "sudo docker compose exec gallery /app/gallery create <name> '<password>' --data /app/data"
```