Skip to content

Commit

Permalink
Add new postgres container for immich
Browse files Browse the repository at this point in the history
  • Loading branch information
rounakdatta committed Jan 19, 2024
1 parent 6180605 commit 71b4140
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
3 changes: 3 additions & 0 deletions roles/launch-nomad-jobs/templates/immich.nomad.j2
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ job "immich_job" {
env = {
NODE_ENV = "production"
DB_HOSTNAME = "{{ Hostname }}"
DB_PORT = "5433"
DB_USERNAME = "{{ ImmichUsername }}"
DB_PASSWORD = "{{ ImmichPassword }}"
DB_DATABASE_NAME = "{{ ImmichDatabase }}"
Expand Down Expand Up @@ -100,6 +101,7 @@ job "immich_job" {
env = {
NODE_ENV = "production"
DB_HOSTNAME = "{{ Hostname }}"
DB_PORT = "5433"
DB_USERNAME = "{{ ImmichUsername }}"
DB_PASSWORD = "{{ ImmichPassword }}"
DB_DATABASE_NAME = "{{ ImmichDatabase }}"
Expand Down Expand Up @@ -136,6 +138,7 @@ job "immich_job" {
env = {
NODE_ENV = "production"
DB_HOSTNAME = "{{ Hostname }}"
DB_PORT = "5433"
DB_USERNAME = "{{ ImmichUsername }}"
DB_PASSWORD = "{{ ImmichPassword }}"
DB_DATABASE_NAME = "{{ ImmichDatabase }}"
Expand Down
37 changes: 35 additions & 2 deletions roles/launch-nomad-jobs/templates/postgresql.nomad.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ job "postgresql_job" {
to = 5432
host_network = "tailscale"
}

port "immich_postgresql_port" {
static = 5433
to = 5433
host_network = "tailscale"
}
}

volume "postgresql_volume" {
Expand All @@ -19,6 +25,12 @@ job "postgresql_job" {
read_only = false
}

volume "immich_postgresql_volume" {
type = "host"
source = "immich_postgresql_hdd_volume"
read_only = false
}

restart {
attempts = 2
interval = "10m"
Expand All @@ -41,12 +53,33 @@ job "postgresql_job" {
}

config {
image = "rounakdatta/pgvecto-rs:pg14-v0.1.11"

image = "rounakdatta/postgres:14.5"
ports = ["postgresql_port"]

}
}


task "immich_postgresql_server" {
driver = "docker"

env = {
POSTGRES_USER = "{{ DatabaseRootUser }}"
POSTGRES_PASSWORD = "{{ DatabaseRootPassword }}"
}

volume_mount {
volume = "immich_postgresql_volume"
destination = "/var/lib/postgresql/data"
read_only = false
}

config {
image = "rounakdatta/postgres:14.5"
ports = ["immich_postgresql_port"]

}
}

}
}
4 changes: 4 additions & 0 deletions roles/launch-orchestrators/templates/nomad.hcl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ client {
path = "{{ hdd_mount_path }}/homelab/postgresql"
}

host_volume "immich_postgresql_hdd_volume" {
path = "{{ hdd_mount_path }}/homelab/immich_postgresql"
}

host_volume "monica_hdd_volume" {
path = "{{ hdd_mount_path }}/homelab/monica"
}
Expand Down

0 comments on commit 71b4140

Please sign in to comment.