### Install PiGallery2 from Release Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/direct-install.md Downloads and installs PiGallery2 from a pre-built release zip file. This is a straightforward method for getting the application running. ```bash wget https://github.com/bpatrik/pigallery2/releases/download/3.0.0/pigallery2-release.zip unzip pigallery2-release.zip -d pigallery2 cd pigallery2 npm install ``` -------------------------------- ### Install Docker Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/docker.md Installs Docker on a system, typically a Raspberry Pi, using a convenience script. This command downloads and executes the Docker installation script. ```bash curl -sSL https://get.docker.com | sh ``` -------------------------------- ### Install PiGallery2 from Source Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/direct-install.md Installs PiGallery2 by cloning the source code and building it. This method requires more memory and time but allows for development or using the latest unreleased code. ```bash wget https://github.com/bpatrik/pigallery2/archive/master.zip unzip master.zip cd pigallery2-master npm install npm run build ``` -------------------------------- ### Install Dependencies Source: https://github.com/bpatrik/pigallery2/blob/master/docs/development/contributing.md Installs the necessary project dependencies using npm. ```bash npm install ``` -------------------------------- ### Run PiGallery2 App Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/direct-install.md Starts the PiGallery2 application after installation. Default credentials are admin/admin. ```bash npm start ``` -------------------------------- ### Server.ts Example with Imports Source: https://github.com/bpatrik/pigallery2/blob/master/docs/development/extensions.md Example of a server.ts file demonstrating how to import types from the extension kit, external packages like lodash, and main app packages using relative paths for local dependencies. ```typescript // Including dev-kit interfaces. It is not necessary, only helps development with types. // You need to prefix them with ./node_modules import { IExtensionObject } from "./node_modules/pigallery2-extension-kit"; // Including prod extension packages. You need to prefix them with ./node_modules // lodash does not have types // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore import * as _ from "./node_modules/lodash"; // Importing packages that are available in the main app (listed in the packages.json in pigallery2) import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm"; ``` -------------------------------- ### Recommended Extension Structure Source: https://github.com/bpatrik/pigallery2/blob/master/docs/development/extensions.md The recommended setup includes an optional package.js for dependencies and a required server.js for extension logic. ```plaintext /myextension/package.js <- this is optional. You can add extra npm packages here /myextension/server.js <- this is needed ``` -------------------------------- ### Set Configuration via CLI Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md Example of how to set a configuration value, such as 'MyConf', directly from the command line. ```bash --MyConf=5 ``` -------------------------------- ### Install Build Tools Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/direct-install.md Installs essential build tools required for compiling native Node.js modules. Use this command on Debian-based systems. ```bash sudo apt-get install build-essential libkrb5-dev gcc g++ ``` -------------------------------- ### Install Node.js Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/direct-install.md Installs Node.js version 22.x using NodeSource repository. This ensures the correct Node.js version for PiGallery2. ```bash curl -sL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt-get install -y nodejs ``` -------------------------------- ### Minimal Extension Setup Source: https://github.com/bpatrik/pigallery2/blob/master/docs/development/extensions.md A minimal PiGallery2 extension requires a server.js file exporting an init function. ```javascript server.js ``` -------------------------------- ### Create Configuration Directories Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/advanced/advanced-docker-npm-portainer.md Create necessary directories for Nginx Proxy Manager and PiGallery2 configurations. This helps in organizing and backing up your setup. ```bash mkdir -p ~/configs/nginx-proxy-manager/data mkdir -p ~/configs/nginx-proxy-manager/letsencrypt mkdir -p ~/configs/pigallery2/config ``` -------------------------------- ### Start MariaDB Test Container Source: https://github.com/bpatrik/pigallery2/blob/master/docs/development/contributing.md Start a MariaDB Docker container configured for Pigallery2 tests. This is required to run MySQL/MariaDB specific tests. ```bash docker run --name pigallery_test -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=pigallery_test -e MYSQL_USER=user -e MYSQL_PASSWORD=password -p3306:3306 -d mariadb:10.3 --log-bin --binlog-format=MIXED ``` -------------------------------- ### Install Docker Compose Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/docker.md Installs Docker Compose using pip3. This command installs the docker-compose package, which is used to manage multi-container Docker applications. ```bash sudo pip3 install docker-compose ``` -------------------------------- ### Map Path Group Configuration Example Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md Defines how map markers are grouped and themed. This example includes configurations for 'Transportation' (flight, drive, ship) and 'Sport' (run, walk, hike, bike) categories, each with specific matching rules and visual themes. ```json [{"name":"Transportation","matchers":[{"matchers":["flight","flying"],"theme":{"color":"var(--bs-orange)","dashArray":"4 8","svgIcon":{"viewBox":"0 0 567 512","items":""}}},{"matchers":["drive","driving"],"theme":{"color":"var(--bs-orange)","dashArray":"4 8","svgIcon":{"viewBox":"0 0 640 512","items":""}}},{"matchers":["ship","sailing","cruise"],"theme":{"color":"var(--bs-orange)","dashArray":"4 8","svgIcon":{"viewBox":"0 0 576 512","items":""}}}]},{"name":"Sport","matchers":[{"matchers":["(\\b|_|-)run"],"theme":{"color":"var(--bs-primary)","dashArray":"","svgIcon":{"viewBox":"0 0 417 512","items":""}}},{"matchers":["(\\b|_|-)walk"],"theme":{"color":"var(--bs-primary)","dashArray":"","svgIcon":{"viewBox":"0 0 320 512","items":""}}},{"matchers":["(\\b|_|-)hike","(\\b|_|-)hiking"],"theme":{"color":"var(--bs-primary)","dashArray":"","svgIcon":{"viewBox":"0 0 384 512","items":""}}},{"matchers":["(\\b|_|-)bike","(\\b|_|-)biking","(\\b|_|-)cycling"],"theme":{"color":"var(--bs-primary)","dashArray":"","svgIcon":{"viewBox":"0 0 640 512","items":""}}}]}] ``` -------------------------------- ### Directory Structure for Photos Source: https://github.com/bpatrik/pigallery2/blob/master/docs/blog/How do I use PiGallery2 2021.md This example shows a recommended directory structure for organizing photos before they are added to PiGallery2. It includes a hierarchical organization by year and event. ```text |-- Family |-- 2000 |-- 2001 |--2002 |--2002.01.01 Event name 1 |--2002.04.01 Event name 2 |--2002.05.01-10 A long event |-- Other |-- 2000 |-- 2000.05.02 Some event name ``` -------------------------------- ### Set Configuration via Environment Variable Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md Example of how to set a configuration value, such as 'MyConf', using an environment variable. This is specific to Windows SET command. ```bash SET MyConf=5 ``` -------------------------------- ### Start Docker Compose Services Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/docker.md Starts the Docker containers defined in the docker-compose.yml file in detached mode. The '-d' flag runs the containers in the background. ```bash docker-compose up -d ``` -------------------------------- ### Install Docker Compose Dependencies Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/docker.md Installs necessary dependencies for Docker Compose on Debian-based systems. This includes libraries for SSL and FFI, along with Python 3 and pip. ```bash sudo apt-get install libffi-dev libssl-dev sudo apt-get install -y python3 python3-pip sudo apt-remove python-configparser ``` -------------------------------- ### Server URL Base Configuration Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md Specifies the base URL if the gallery is accessed under a sub-path (e.g., https://mydomain.com/myGallery). Ensure the URL starts with a '/' if needed. ```bash --Server-urlBase ``` -------------------------------- ### Example Job Configuration Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md This snippet shows a configuration for a scheduled job within Pigallery 2. It includes job details, configuration parameters, and trigger conditions. ```json { "name": "Album Cover Filling", "jobName": "Album Cover Filling", "config": {}, "allowParallelRun": false, "trigger": { "type": "after", "periodicity": 7, "atTime": 0, "afterScheduleName": "Indexing" } } ``` ```json { "name": "Photo Converting", "jobName": "Photo Converting", "config": { "sizes": [ 320 ], "maxVideoSize": 800, "indexedOnly": true }, "allowParallelRun": false, "trigger": { "type": "after", "periodicity": 7, "atTime": 0, "afterScheduleName": "Album Cover Filling" } } ``` ```json { "name": "Video Converting", "jobName": "Video Converting", "config": { "indexedOnly": true }, "allowParallelRun": false, "trigger": { "type": "after", "periodicity": 7, "atTime": 0, "afterScheduleName": "Photo Converting" } } ``` ```json { "name": "GPX Compression", "jobName": "GPX Compression", "config": { "indexedOnly": true }, "allowParallelRun": false, "trigger": { "type": "after", "periodicity": 7, "atTime": 0, "afterScheduleName": "Video Converting" } } ``` ```json { "name": "Temp Folder Cleaning", "jobName": "Temp Folder Cleaning", "config": { "indexedOnly": true }, "allowParallelRun": false, "trigger": { "type": "after", "periodicity": 7, "atTime": 0, "afterScheduleName": "GPX Compression" } } ``` -------------------------------- ### Run PiGallery2 with Port Override Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/direct-install.md Starts the PiGallery2 application and overrides the default server port using a command-line switch. This is useful for quick configuration changes. ```bash npm start -- --Server-port=8080 ``` -------------------------------- ### Display Help and Options Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md Run this command to display all available meta CLI options and application CLI options for Pigallery 2. ```bash npm start -- --help ``` -------------------------------- ### Build Client (Development) Source: https://github.com/bpatrik/pigallery2/blob/master/docs/development/contributing.md Builds the client with English localization and watches for source file changes. This command runs continuously. ```bash npm run run-dev ``` -------------------------------- ### Create Configuration Directory Source: https://github.com/bpatrik/pigallery2/blob/master/docs/blog/[Tutorial] Pigallery2 From Zero To Hero 2025.md Create a central directory to store all service configuration files for easy backup and management. ```bash cd ~ mkdir config ``` -------------------------------- ### Sample config.json for PiGallery 2 Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md This JSON snippet shows a sample configuration file for PiGallery 2, illustrating various server settings like application title, public URL, API path, and custom HTML head content. ```json { "Server": { "applicationTitle": "PiGallery 2", "//[publicUrl]": "If you access the page from local network it's good to know the public url for creating sharing link.", "publicUrl": "", "//[urlBase]": "If you access the gallery under a sub url (like: https://mydomain.com/myGallery), set it here. If it is not working you might miss the '/' from the beginning of the url.", "urlBase": "", "//[apiPath]": "PiGallery api path.", "apiPath": "/pgapi", "//[customHTMLHead]": "Injects the content of this between the HTML tags of the app. (You can use it to add analytics or custom code to the app).", "customHTMLHead": "", "//[svgIcon]": "Sets the icon of the app. Rendered icons are cached in the tmp folder.", "svgIcon": { "//[viewBox]": "SVG path viewBox. See: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/viewBox", "viewBox": "0 0 512 512", "//[items]": "Content elements (paths, circles, rects) of the SVG icon. Icons used on the map: fontawesome.com/icons." ``` -------------------------------- ### Configure Photo Settings Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md Set the icon size for maps and the thumbnail size for person faces. ```json { "//[iconSize]": "Icon size (used on maps).", "iconSize": 45, "//[personThumbnailSize]": "Person (face) thumbnail size.", "personThumbnailSize": 200 } ``` -------------------------------- ### Obtain SSL Certificate with Certbot Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/docker.md Obtains a standalone SSL certificate for a domain using Certbot. This command is used to secure your PiGallery2 installation with HTTPS. ```bash certbot certonly --standalone -d yourdomain.com ``` -------------------------------- ### Enable Themes and Color Modes Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md Enable themes and color modes for the application. Sets the default theme mode. ```json { "//[enabled]": "Enable themes and color modes.", "enabled": true, "//[defaultMode]": "Sets the default theme mode that is used for the application.", "defaultMode": "auto", "//[selectedTheme]": "Selected theme to use on the site.", "selectedTheme": "classic" } ``` -------------------------------- ### Run a Specific Test File Source: https://github.com/bpatrik/pigallery2/blob/master/docs/development/contributing.md Execute a specific test file, such as the SettingsRouter integration tests in the backend. ```bash npx mocha ./test/backend/integration/routers/admin/SettingsRouter.js ``` -------------------------------- ### Portainer Docker Compose Configuration Source: https://github.com/bpatrik/pigallery2/blob/master/docs/blog/[Tutorial] Pigallery2 From Zero To Hero 2025.md Defines the Docker Compose setup for running the Portainer CE container, including volume mounts for persistent data and Docker socket access. ```yaml version: "3.9" services: homer: image: portainer/portainer-ce:lts container_name: portainer volumes: - /var/run/docker.sock:/var/run/docker.sock - portainer_data:/data ports: - 9443:9443 restart: always volumes: portainer_data: external: true ``` -------------------------------- ### Nginx Configuration for PiGallery2 Access Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/advanced/advanced-docker-npm-portainer.md This Nginx configuration restricts access to the PiGallery2 service to only GET requests for security purposes, while allowing other HTTP versions for proxying. It sets up the necessary headers for WebSocket upgrades. ```nginx location / { limit_except GET { deny all; } proxy_pass http://pigallery2:80; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } ``` -------------------------------- ### Download Release Artifact Source: https://github.com/bpatrik/pigallery2/blob/master/docs/development/docker-contributing.md Download the latest release zip file for building the Docker image. ```bash wget https://github.com/bpatrik/pigallery2/releases/download/3.1.0/pigallery2-release.zip unzip pigallery2-release.zip -d pigallery2 cd pigallery2 ``` -------------------------------- ### Build Backend Source: https://github.com/bpatrik/pigallery2/blob/master/docs/development/contributing.md Transpiles TypeScript files to JavaScript for Node.js execution. ```bash npm run build-backend ``` -------------------------------- ### Build Docker Image Locally Source: https://github.com/bpatrik/pigallery2/blob/master/docs/development/docker-contributing.md Build the PiGallery2 Docker image locally using the downloaded release files. This command uses plain progress output. ```bash $ sudo docker build --progress=plain -t local-pg . ``` -------------------------------- ### Configure Inline and Top Blog Settings Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md Control whether inline and top blog content automatically opens. These settings affect how blog posts are displayed by default. ```json { "//[InlineBlogStartsOpen]": "Makes inline blog (*.md files content) auto-open.", "InlineBlogStartsOpen": false, "//[TopBlogStartsOpen]": "Makes top blog (*.md files content) auto-open.", "TopBlogStartsOpen": false } ``` -------------------------------- ### Match Types for Searching Source: https://github.com/bpatrik/pigallery2/blob/master/docs/features.md Demonstrates different match types for searching photos, including exact, wildcard, and negation matches. ```bash person:"John" # exact match person:(John) # wildcard match person:John # same as person:(John) person!:John # negation ``` -------------------------------- ### Configure Sorting and Grouping Methods Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md Set the default sorting and grouping methods for photos and videos, both in directory listings and search results. This includes specifying the sorting/grouping criteria and order (ascending/descending). ```json { "SortingGrouping": { "//[defaultPhotoSortingMethod]": "Default sorting method for photo and video in a directory results.", "defaultPhotoSortingMethod": { "method": "Date", "ascending": true }, "//[defaultSearchSortingMethod]": "Default sorting method for photo and video in a search results.", "defaultSearchSortingMethod": { "method": "Date", "ascending": false }, "//[defaultPhotoGroupingMethod]": "Default grouping method for photo and video in a directory results.", "defaultPhotoGroupingMethod": { "method": "Date", "ascending": true }, "//[defaultSearchGroupingMethod]": "Default grouping method for photo and video in a search results.", "defaultSearchGroupingMethod": { "method": "Date", "ascending": false } } } ``` -------------------------------- ### Override Default Configuration via CLI Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md Demonstrates how to override a default configuration value, like 'MyConf', using the 'default-' prefix in the CLI command. ```bash --default-MyConf=5 ``` -------------------------------- ### Run PiGallery2 Docker Container (Before v1.7.0) Source: https://github.com/bpatrik/pigallery2/blob/master/docs/setup/docker.md This command is for running versions of PiGallery2 prior to v1.7.0. It requires specific paths for the config file and database, and uses an older image tag. Ensure the config file and database files exist before running. ```bash docker run \ -p 80:80 \ -e NODE_ENV=production \ -v /config.json:/pigallery2-release/config.json \ -v /sqlite.db:/pigallery2-release/sqlite.db \ -v :/pigallery2-release/demo/images \ -v :/pigallery2-release/demo/TEMP \ bpatrik/pigallery2:1.7.0-stretch ``` -------------------------------- ### Boolean Expressions for Searching Source: https://github.com/bpatrik/pigallery2/blob/master/docs/features.md Shows how to construct boolean expressions for complex photo searches using AND, OR, and N-of logic. ```text John and Kate # photos with "John" and "Kate" (any string match) John Kate # same as "John and Kate" John or Kate # photos with "John" or "Kate" (any string match) 2-of:(John, Kate, Steve) # lists photos that satisfy at least 2 out of the 3 names ``` -------------------------------- ### Configure Auto Update Settings Source: https://github.com/bpatrik/pigallery2/blob/master/docs/user-guide/configuration.md Enable and configure automatic polling for new photos and videos. Set the interval for checking updates. ```json { "//[AutoUpdate]": "makes the gallery poll the backend for new photos in the given directory or search", "AutoUpdate": { "//[enable]": "Enable auto polling for new photos and videos in the gallery.", "enable": false, "//[interval]": "Frequency of the auto polling in seconds.", "interval": 60 } } ```