Skip to content

Commit a8e7cf9

Browse files
committed
refactor: rename yml to yaml, standardize pkg templates, add Base category
1 parent 0e26d56 commit a8e7cf9

7 files changed

Lines changed: 223 additions & 82 deletions

File tree

File renamed without changes.

Containerfile

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Immich PostgreSQL - layers pgvector + VectorChord on top of postgres:14
2-
# Drop-in compatible with official Immich PostgreSQL image
3-
41
ARG BASE_VERSION=15
52
ARG PG_VERSION=14
63

@@ -28,7 +25,7 @@ RUN fetch -qo /tmp/ports.tar.zst \
2825
WORKDIR /usr/ports/databases/pgvector
2926
RUN make DEFAULT_VERSIONS+=pgsql=${PG_VERSION} BATCH=yes install clean
3027

31-
# Build VectorChord from source (not in ports)
28+
# Build VectorChord from source
3229
ARG VECTORCHORD_VERSION=0.4.3
3330
RUN fetch -qo /tmp/vectorchord.tar.gz \
3431
"https://github.com/tensorchord/VectorChord/archive/refs/tags/${VECTORCHORD_VERSION}.tar.gz" && \
@@ -37,25 +34,30 @@ RUN fetch -qo /tmp/vectorchord.tar.gz \
3734
gmake build && \
3835
gmake install
3936

40-
# Production image - layer on postgres:14
41-
ARG PG_VERSION
37+
# Production image
4238
FROM ghcr.io/daemonless/postgres:${PG_VERSION}
4339

4440
ARG FREEBSD_ARCH=amd64
4541
ARG VECTORCHORD_VERSION=0.4.3
42+
ARG HEALTHCHECK_ENDPOINT="pg_isready -U postgres"
43+
44+
ENV HEALTHCHECK_CMD="${HEALTHCHECK_ENDPOINT}"
4645

46+
# --- Metadata (Injected by Generator) ---
4747
LABEL org.opencontainers.image.title="Immich PostgreSQL" \
48-
org.opencontainers.image.description="PostgreSQL 14 with pgvector + VectorChord for Immich" \
49-
org.opencontainers.image.source="https://github.com/daemonless/immich-postgres" \
50-
org.opencontainers.image.url="https://immich.app/" \
51-
org.opencontainers.image.licenses="PostgreSQL" \
52-
org.opencontainers.image.vendor="daemonless" \
53-
org.opencontainers.image.authors="daemonless" \
54-
io.daemonless.port="5432" \
55-
io.daemonless.arch="${FREEBSD_ARCH}" \
56-
io.daemonless.category="Databases" \
57-
io.daemonless.vectorchord-version="${VECTORCHORD_VERSION}" \
58-
org.freebsd.jail.allow.sysvipc="required"
48+
org.opencontainers.image.description="PostgreSQL 14 with pgvector/pgvecto.rs extensions for Immich." \
49+
org.opencontainers.image.source="https://github.com/daemonless/immich-postgres" \
50+
org.opencontainers.image.url="https://immich.app/" \
51+
org.opencontainers.image.licenses="PostgreSQL" \
52+
org.opencontainers.image.vendor="daemonless" \
53+
org.opencontainers.image.authors="daemonless" \
54+
io.daemonless.category="Databases" \
55+
io.daemonless.port="5432" \
56+
io.daemonless.volumes="/var/lib/postgresql/data" \
57+
io.daemonless.arch="${FREEBSD_ARCH}" \
58+
io.daemonless.vectorchord-version="${VECTORCHORD_VERSION}" \
59+
io.daemonless.healthcheck-cmd="${HEALTHCHECK_ENDPOINT}" \
60+
org.freebsd.jail.allow.sysvipc="required"
5961

6062
# Copy built extensions from builder
6163
COPY --from=builder /usr/local/lib/postgresql/vector.so /usr/local/lib/postgresql/
@@ -69,7 +71,14 @@ RUN chmod 644 /usr/local/share/postgresql/extension/vchord* && \
6971

7072
# Copy init scripts for extensions
7173
COPY docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d/
74+
RUN chmod 644 /docker-entrypoint-initdb.d/*
7275

7376
# Immich-specific defaults
7477
ENV POSTGRES_DB=immich \
7578
POSTGRES_SHARED_PRELOAD_LIBRARIES=vchord
79+
80+
# --- Expose (Injected by Generator) ---
81+
EXPOSE 5432
82+
83+
# --- Volumes (Injected by Generator) ---
84+
VOLUME /var/lib/postgresql/data

Containerfile.j2

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
ARG BASE_VERSION=15
2+
ARG PG_VERSION=14
3+
4+
# Builder stage - compile extensions
5+
FROM ghcr.io/daemonless/base:${BASE_VERSION} AS builder
6+
ARG PG_VERSION
7+
8+
# Build dependencies
9+
RUN pkg update && pkg install -y \
10+
postgresql${PG_VERSION}-server postgresql${PG_VERSION}-contrib \
11+
FreeBSD-bmake FreeBSD-clibs-dev FreeBSD-clang FreeBSD-clang-dev FreeBSD-toolchain \
12+
FreeBSD-libexecinfo FreeBSD-libexecinfo-dev FreeBSD-runtime-dev FreeBSD-utilities-dev \
13+
rust gmake git-lite pkgconf \
14+
&& pkg clean -ay
15+
16+
# Fetch minimal ports tree for pgvector
17+
RUN fetch -qo /tmp/ports.tar.zst \
18+
"https://download.freebsd.org/ports/ports/ports.tar.zst" && \
19+
mkdir -p /usr/ports && \
20+
tar -xf /tmp/ports.tar.zst -C /usr/ports --strip-components=1 \
21+
ports/databases/pgvector ports/Mk ports/Templates ports/Keywords && \
22+
rm /tmp/ports.tar.zst
23+
24+
# Build pgvector for PostgreSQL 14
25+
WORKDIR /usr/ports/databases/pgvector
26+
RUN make DEFAULT_VERSIONS+=pgsql=${PG_VERSION} BATCH=yes install clean
27+
28+
# Build VectorChord from source
29+
ARG VECTORCHORD_VERSION=0.4.3
30+
RUN fetch -qo /tmp/vectorchord.tar.gz \
31+
"https://github.com/tensorchord/VectorChord/archive/refs/tags/${VECTORCHORD_VERSION}.tar.gz" && \
32+
tar -xzf /tmp/vectorchord.tar.gz -C /tmp && \
33+
cd /tmp/VectorChord-${VECTORCHORD_VERSION} && \
34+
gmake build && \
35+
gmake install
36+
37+
# Production image
38+
FROM ghcr.io/daemonless/postgres:${PG_VERSION}
39+
40+
ARG FREEBSD_ARCH=amd64
41+
ARG VECTORCHORD_VERSION=0.4.3
42+
{%- if ports %}
43+
ARG HEALTHCHECK_ENDPOINT="pg_isready -U postgres"
44+
{%- else %}
45+
ARG HEALTHCHECK_ENDPOINT="pg_isready -U postgres"
46+
{%- endif %}
47+
48+
ENV HEALTHCHECK_CMD="${HEALTHCHECK_ENDPOINT}"
49+
50+
# --- Metadata (Injected by Generator) ---
51+
LABEL org.opencontainers.image.title="{{ title }}" \
52+
org.opencontainers.image.description="{{ description }}" \
53+
org.opencontainers.image.source="{{ repo_url }}" \
54+
org.opencontainers.image.url="{{ web_url }}" \
55+
org.opencontainers.image.licenses="PostgreSQL" \
56+
org.opencontainers.image.vendor="daemonless" \
57+
org.opencontainers.image.authors="daemonless" \
58+
io.daemonless.category="{{ category }}" \
59+
{%- if ports %}
60+
io.daemonless.port="{{ ports[0].port }}" \
61+
{%- endif %}
62+
{%- if volumes %}
63+
io.daemonless.volumes="{{ volumes | map(attribute='path') | join(',') }}" \
64+
{%- endif %}
65+
{%- if mlock %}
66+
org.freebsd.jail.allow.mlock="required" \
67+
{%- endif %}
68+
io.daemonless.arch="${FREEBSD_ARCH}" \
69+
io.daemonless.vectorchord-version="${VECTORCHORD_VERSION}" \
70+
io.daemonless.healthcheck-cmd="${HEALTHCHECK_ENDPOINT}" \
71+
org.freebsd.jail.allow.sysvipc="required"
72+
73+
# Copy built extensions from builder
74+
COPY --from=builder /usr/local/lib/postgresql/vector.so /usr/local/lib/postgresql/
75+
COPY --from=builder /usr/local/share/postgresql/extension/vector* /usr/local/share/postgresql/extension/
76+
COPY --from=builder /usr/local/lib/postgresql/vchord.so /usr/local/lib/postgresql/
77+
COPY --from=builder /usr/local/share/postgresql/extension/vchord* /usr/local/share/postgresql/extension/
78+
79+
# Fix permissions
80+
RUN chmod 644 /usr/local/share/postgresql/extension/vchord* && \
81+
chmod 755 /usr/local/lib/postgresql/vchord.so
82+
83+
# Copy init scripts for extensions
84+
COPY docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d/
85+
RUN chmod 644 /docker-entrypoint-initdb.d/*
86+
87+
# Immich-specific defaults
88+
ENV POSTGRES_DB=immich \
89+
POSTGRES_SHARED_PRELOAD_LIBRARIES=vchord
90+
91+
# --- Expose (Injected by Generator) ---
92+
{%- if ports %}
93+
EXPOSE {{ ports | map(attribute='port') | join(' ') }}
94+
{%- endif %}
95+
96+
# --- Volumes (Injected by Generator) ---
97+
{%- if volumes %}
98+
VOLUME {{ volumes | map(attribute='path') | join(' ') }}
99+
{%- endif %}

README.md

Lines changed: 57 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,89 @@
1-
# immich-postgres
1+
# Immich PostgreSQL
22

3-
PostgreSQL 14 with pgvector + VectorChord for [Immich](https://immich.app/).
3+
PostgreSQL 14 with pgvector/pgvecto.rs extensions for Immich.
44

5-
!!! note "Part of the Immich Stack"
6-
This is just one component of Immich. For the complete setup (docker-compose, configuration, etc.), please see the [Daemonless Immich Stack](https://github.com/daemonless/immich).
5+
| | |
6+
|---|---|
7+
| **Port** | 5432 |
8+
| **Registry** | `ghcr.io/daemonless/immich-postgres` |
9+
| **Source** | [https://github.com/immich-app/immich](https://github.com/immich-app/immich) |
10+
| **Website** | [https://immich.app/](https://immich.app/) |
711

8-
Drop-in compatible with official Immich PostgreSQL image.
12+
## Deployment
913

10-
## Environment Variables
11-
12-
| Variable | Description | Default |
13-
|----------|-------------|---------|
14-
| `POSTGRES_USER` | Database superuser name | `postgres` |
15-
| `POSTGRES_PASSWORD` | Superuser password | `postgres` |
16-
| `POSTGRES_DB` | Default database to create | `immich` |
17-
| `PGDATA` | Data directory location | `/config/data` |
18-
19-
## Quick Start
20-
21-
```bash
22-
podman run -d --name immich-postgres \
23-
--annotation 'org.freebsd.jail.allow.sysvipc=true' \
24-
-p 5432:5432 \
25-
-e POSTGRES_PASSWORD=postgres \
26-
-e POSTGRES_DB=immich \
27-
-v /containers/immich/postgres:/config \
28-
ghcr.io/daemonless/immich-postgres:latest
29-
```
30-
31-
**Note:** The `org.freebsd.jail.allow.sysvipc=true` annotation is required for PostgreSQL shared memory. This requires a patched version of `ocijail`. See the [ocijail patch guide](https://daemonless.io/guides/ocijail-patch/) for build instructions.
32-
33-
## podman-compose
14+
### Podman Compose
3415

3516
```yaml
3617
services:
3718
immich-postgres:
3819
image: ghcr.io/daemonless/immich-postgres:latest
3920
container_name: immich-postgres
4021
environment:
22+
- POSTGRES_USER=postgres
4123
- POSTGRES_PASSWORD=postgres
4224
- POSTGRES_DB=immich
4325
volumes:
44-
- /data/config/postgres:/config
26+
- /path/to/containers/immich-postgres/var/lib/postgresql/data:/var/lib/postgresql/data
4527
ports:
4628
- 5432:5432
47-
annotations:
48-
org.freebsd.jail.allow.sysvipc: "true"
4929
restart: unless-stopped
5030
```
5131
52-
## Tags
32+
### Podman CLI
5333
54-
| Tag | Source | Description |
55-
|-----|--------|-------------|
56-
| `:latest` | `databases/postgresql14-server` | FreeBSD latest packages (Alias for :pkg-latest) |
57-
| `:pkg` | `databases/postgresql14-server` | FreeBSD quarterly packages |
58-
| `:pkg-latest` | `databases/postgresql14-server` | FreeBSD latest packages |
34+
```bash
35+
podman run -d --name immich-postgres \
36+
-p 5432:5432 \
37+
-e POSTGRES_USER=postgres \
38+
-e POSTGRES_PASSWORD=postgres \
39+
-e POSTGRES_DB=immich \
40+
-v /path/to/containers/immich-postgres/var/lib/postgresql/data:/var/lib/postgresql/data \
41+
ghcr.io/daemonless/immich-postgres:latest
42+
```
43+
Access at: `http://localhost:5432`
5944

60-
## Volumes
45+
### Ansible
6146

62-
| Path | Description |
63-
|------|-------------|
64-
| `/config` | Configuration and data directory (PGDATA is in `/config/data`) |
47+
```yaml
48+
- name: Deploy immich-postgres
49+
containers.podman.podman_container:
50+
name: immich-postgres
51+
image: ghcr.io/daemonless/immich-postgres:latest
52+
state: started
53+
restart_policy: always
54+
env:
55+
POSTGRES_USER: "postgres"
56+
POSTGRES_PASSWORD: "postgres"
57+
POSTGRES_DB: "immich"
58+
ports:
59+
- "5432:5432"
60+
volumes:
61+
- "/path/to/containers/immich-postgres/var/lib/postgresql/data:/var/lib/postgresql/data"
62+
```
6563
66-
## Ports
64+
## Configuration
6765
68-
| Port | Description |
69-
|------|-------------|
70-
| 5432 | PostgreSQL |
66+
### Environment Variables
7167
72-
## Features
68+
| Variable | Default | Description |
69+
|----------|---------|-------------|
70+
| `POSTGRES_USER` | `postgres` | Database superuser (default: postgres) |
71+
| `POSTGRES_PASSWORD` | `postgres` | Database password (default: postgres) |
72+
| `POSTGRES_DB` | `immich` | Database name (default: immich) |
7373

74-
- **PostgreSQL 14:** Matches official Immich requirements.
75-
- **pgvector:** 0.8.x extension installed (via ports).
76-
- **VectorChord:** 0.4.x extension installed (built from source).
77-
- **Auto-init:** Extensions enabled automatically on database creation.
74+
### Volumes
7875

79-
## Extensions
76+
| Path | Description |
77+
|------|-------------|
78+
| `/var/lib/postgresql/data` | Database data directory |
8079

81-
Extensions are automatically enabled:
80+
### Ports
8281

83-
```sql
84-
CREATE EXTENSION IF NOT EXISTS vector; -- pgvector
85-
CREATE EXTENSION IF NOT EXISTS vchord; -- VectorChord
86-
```
82+
| Port | Protocol | Description |
83+
|------|----------|-------------|
84+
| `5432` | TCP | PostgreSQL Port |
8785

8886
## Notes
8987

90-
- **User:** `bsd` (UID/GID set via PUID/PGID, default 1000)
91-
- **Base:** Built on `ghcr.io/daemonless/base-image` (FreeBSD)
92-
- **Migration:** Fully compatible with official Immich Postgres data.
93-
94-
## Links
95-
96-
- [Immich](https://immich.app/)
97-
- [PostgreSQL](https://www.postgresql.org/)
88+
- **User:** `postgres` (UID/GID set via PUID/PGID)
89+
- **Base:** Built on `ghcr.io/daemonless/base` (FreeBSD)

compose.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: immich-postgres
2+
3+
x-daemonless:
4+
title: "Immich PostgreSQL"
5+
icon: ":simple-postgresql:"
6+
category: "Databases"
7+
description: "PostgreSQL 14 with pgvector/pgvecto.rs extensions for Immich."
8+
upstream_url: "https://github.com/immich-app/immich"
9+
web_url: "https://immich.app/"
10+
freshports_url: "https://www.freshports.org/databases/postgresql14-server/"
11+
user: "postgres"
12+
mlock: false
13+
upstream_binary: true
14+
15+
docs:
16+
env:
17+
POSTGRES_USER: "Database superuser (default: postgres)"
18+
POSTGRES_PASSWORD: "Database password (default: postgres)"
19+
POSTGRES_DB: "Database name (default: immich)"
20+
POSTGRES_INITDB_ARGS: "Additional initdb arguments"
21+
volumes:
22+
/var/lib/postgresql/data: "Database data directory"
23+
ports:
24+
5432: "PostgreSQL Port"
25+
26+
services:
27+
immich-postgres:
28+
image: ghcr.io/daemonless/immich-postgres:latest
29+
container_name: immich-postgres
30+
restart: unless-stopped
31+
32+
environment:
33+
- POSTGRES_USER=postgres
34+
- POSTGRES_PASSWORD=postgres
35+
- POSTGRES_DB=immich
36+
37+
volumes:
38+
- /path/to/containers/immich/postgres:/var/lib/postgresql/data
39+
40+
ports:
41+
- "5432:5432"

0 commit comments

Comments
 (0)