Skip to content

Commit

Permalink
Merge pull request #179 from nsg/bump/v1.104.0
Browse files Browse the repository at this point in the history
Bump v1.104.0
  • Loading branch information
nsg committed May 20, 2024
2 parents 4375225 + 96e0aac commit f8158aa
Show file tree
Hide file tree
Showing 20 changed files with 192 additions and 128 deletions.
47 changes: 32 additions & 15 deletions .github/workflows/system-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,32 @@ on:
workflow_dispatch:

jobs:
build:
name: Build and Test Snap Package
build-snap:
name: Build Snap Package
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build snap package
uses: snapcore/action-build@v1
id: build

- name: Save snap artifact
uses: actions/upload-artifact@v4
with:
name: development-snap-package
if-no-files-found: error
path: |
${{ steps.build.outputs.snap }}
run-tests:
name: Run System Tests
runs-on: ubuntu-latest

needs: build-snap

services:
selenium:
image: selenium/standalone-chrome:latest
Expand All @@ -34,29 +56,24 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Build snap package
uses: snapcore/action-build@v1
id: build
- name: Download snap artifact
uses: actions/download-artifact@v4
with:
name: development-snap-package

- name: TEST | Install package
run: sudo snap install --dangerous ${{ steps.build.outputs.snap }}
run: |
find .
sudo snap install --dangerous *.snap
- name: TEST | Install requirements
run: pip install -r tests/requirements.txt

- name: TEST | Run Selenium Tests
run: make ci -C tests

- name: Save snap artifact
uses: actions/upload-artifact@v3
with:
name: development-snap-package
if-no-files-found: error
path: |
${{ steps.build.outputs.snap }}
- name: Upload test report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: selenium-test-report
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.103.1
v1.104.0
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions docs/docs/news/posts/2024/05/acme-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
date: 2024-05-16 10:00:00
authors: [nsg]
---

# ACME port conflict

I noticed from the logs of the ACME client (lego) that there was a port conflict preventing new certificates from being issued. I uses port `8081` since last year. About two months ago Immich started to use the same port to expose metrics.

To resolve the port conflict preventing new certificates from being issued, I decided to change the port used by the ACME client (lego). While the ACME thing is something internal that users do not need to worry about, the Immich metrics ports could be utilized by my users. Therefore, I made the decision to switch the Lego port instead of the Immich port.

## The problem with new ports

Initially I just [changed the Lego port to `8181`](https://github.com/nsg/immich-distribution/commit/aa2793164347a2f1c092ffd36485e2d00704216b) and [explicitly configured Immich to use `8081`](https://github.com/nsg/immich-distribution/commit/519bc64716bc90d4808be3bec91a43d43391ba97). The problem with new ports and an automatically updating application is that I have no idea if a user have additional software already installed utilizing `8181`. I thought about picking a higher port, reducing the risk of a port conflict to almost 0 but I choose a more programmatic approach.

## Dynamic port assignment

Last year [I introduced](https://github.com/nsg/immich-distribution/pull/118) two new configuration options that [allowed the user to change](../../../../configuration/haproxy.md) the HTTP (default `80`) and HTTPS (default `443`) ports. I already had the code for most of the logic, so I wrote a simple function to detect a free port in the `34000-36000` port range and used that port by default.

```sh
sudo snap get immich-distribution acme-port
34000
```

On my system I got port `34000` and most likely, so did you. to change the port use this command:

```sh
sudo snap set immich-distribution acme-port=1234
```

## The future

I plan to utilize this new functionality to assign internal ports for Immich (`3001-3003`), as well as the database ports `5432` (postgres) and `6379` (redis). My goal is to make the installation of Immich Distributions easier on systems that have other services running.
195 changes: 97 additions & 98 deletions docs/poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion parts/immich-web/patches/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=v1.103.1
VERSION=v1.104.0
SOURCE_FILE_PATH=https://raw.githubusercontent.com/immich-app/immich/${VERSION}/web/src/lib/components/shared-components/version-announcement-box.svelte

download-patch:
Expand Down
2 changes: 1 addition & 1 deletion parts/machine-learning/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IMMICH_VERSION := v1.103.1
IMMICH_VERSION := v1.104.0

# Use our own Python, over the older included one
export PATH := ${CRAFT_PART_BUILD}/../../python/install/usr/local/bin:$(PATH)
Expand Down
6 changes: 3 additions & 3 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: immich-distribution
title: Immich Distribution
version: "v1.103.1"
version: "v1.104.0"
base: core22
grade: stable
confinement: strict
Expand Down Expand Up @@ -188,7 +188,7 @@ parts:
server:
plugin: nil
source: https://github.com/immich-app/immich.git
source-tag: v1.103.1
source-tag: v1.104.0
override-build: |
craftctl default
Expand Down Expand Up @@ -250,7 +250,7 @@ parts:
web:
plugin: nil
source: https://github.com/immich-app/immich.git
source-tag: v1.103.1
source-tag: v1.104.0
override-build: |
# Patch version announcement box with a version that refers to the snap instead of Docker
patch -p0 -i ${CRAFT_PART_SRC}/../../parts-web/src/patches/001-version-announcement-box.patch
Expand Down
33 changes: 24 additions & 9 deletions tests/tests_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@ def wait_for_empty_job_queue():
time.sleep(1)
running_or_paused_jobs = 0
for _, job_data in get_all_jobs().items():
paused = job_data['queueStatus']['isPaused']
active = job_data['queueStatus']['isActive']
paused = True
active = True

# Validate the API response, we got a integer inside queueStatus instead of a dict
if isinstance(job_data, dict) and 'queueStatus' in job_data and isinstance(job_data['queueStatus'], dict):
paused = job_data['queueStatus']['isPaused']
active = job_data['queueStatus']['isActive']

if paused or active:
running_or_paused_jobs += 1

Expand Down Expand Up @@ -298,16 +304,25 @@ def test_100_verify_image_exitdata(self):

def test_100_verify_people_detected(self):
"""
Query the API to get a list of assets, this mainly tests that:
* The ML model works and detects people
* Typesese works (used to generate embeddings)
Query the API to verify that people were detected in the images.
This test will try 10 times if there are no people detected in the images.
* The face recognition model works
* Pgvector extension works
"""

wait_for_empty_job_queue()

with open("secret.txt", "r") as f:
secret = f.read()

headers = { "X-API-KEY": secret }

# query the API to get a list of people
r = requests.get(f"http://{get_ip_address()}/api/person", headers=headers)
people = r.json()
self.assertGreater(people['total'], 2)
for _ in range(10):
r = requests.get(f"http://{get_ip_address()}/api/person", headers=headers)
people = r.json()

if people['total'] == 0:
time.sleep(2)
continue

self.assertGreater(people['total'], 2)

0 comments on commit f8158aa

Please sign in to comment.