eddb3badc9 | ||
---|---|---|
.github | ||
.husky | ||
api | ||
docker | ||
docker-compose example | ||
screenshots | ||
systemd | ||
ui | ||
.dockerignore | ||
.gitignore | ||
Dockerfile | ||
LICENSE.txt | ||
README.md | ||
codecov.yml |
README.md
Photoview is a simple and user-friendly photo gallery that's made for photographers and aims to provide an easy and fast way to navigate directories, with thousands of high-resolution photos.
You configure Photoview to look for photos and videos within a directory on your file system. The scanner automatically picks up your media and starts to generate thumbnail images to make browsing super fast.
When your media has been scanned, they show up on the website, organised in the same way as on the filesystem.
If you have questions regarding setup or development, feel free to join the Discord server https://discord.gg/jQ392948u9
Demo site
Visit https://photos.qpqp.dk/
Username: demo Password: demo
Contents
- Demo site
- Main features
- Supported Platforms
- Why yet another self-hosted photo gallery
- Getting started — Setup with Docker
- Advanced setup
- Set up development environment
- Sponsors
Main features
- Closely tied to the file system. The website presents the images found on the local filesystem of the server; directories are mapped to albums.
- User management. Each user is created along with a path on the local filesystem, photos within that path can be accessed by that user.
- Sharing. Albums, as well as individual media, can easily be shared with a public link, the link can optionally be password protected.
- Made for photography. Photoview is built with photographers in mind, and thus supports RAW file formats, and EXIF parsing.
- Video support. Many common video formats are supported. Videos will automatically be optimized for web.
- Face recognition. Faces will automatically be detected in photos, and photos of the same person will be grouped together.
- Performant. Thumbnails are automatically generated and photos first load when they are visible on the screen. In full screen, thumbnails are displayed until the high-resolution image has been fully loaded.
- Secure. All media resources are protected with a cookie-token, all passwords are properly hashed, and the API uses a strict CORS policy.
Supported platforms
- Docker
- Arch Linux Aur
- Unraid
- EmbassyOS: announcement, repo
- YunoHost
Why yet another self-hosted photo gallery
There exists a lot of open-source self-hosted photo galleries already. Here are some, just to mention a few.
So why another one? I love taking photos, and I store all of them on my local fileserver. This is great because I can organize my photos directly on the filesystem, so it's easy to move them or take backups. I want to be able to control where and how the photos are stored.
The problem is, however, that RAW images are extremely tedious to navigate from a fileserver, even over the local network.
My server holds a lot of old family pictures that I would like my family to have access to as well. And some of the pictures I would like to easily be able to share with other people without the hassle of them having to make an account first.
Thus, I need a solution that can do the following:
- A scan-based approach that automatically organises my photos
- Support RAW and EXIF parsing
- Have support for multiple users and ways to share albums and photos also publicly
- Be straightforward and fast to use
All the photo galleries can do a lot of what I need, but no single one can do it all.
Getting started — Setup with Docker
This section describes how to get Photoview up and running on your server with Docker. Make sure you have Docker and docker-compose installed and running on your server.
make
should be installed as well if you'd like to use providedMakefile
, which is optional (see step 4 for more details).7zz
should be installed in case, you'd like to use it in scope of the backup scenario instead of the default .tar.xz format. Read the comment in theMakefile
, located on top of thebackup
section for more details.
-
Download the content of the
docker-compose example
folder to the folder on your server, where you expect to host the Photoview internal data (database and cache files).Please note that this folder contains 2 versions of the docker-compose file:
docker-compose.example.yml
- the fully-functional and recommended for the most cases configdocker-compose.minimal.example.yml
- the minimal and simple config for those, who find the previous one too complex and difficult to understand and manage
When downloading files, you need to choose only one of them.
-
Rename downloaded files and remove the
example
from their names (so, you need to have.env
,docker-compose.yml
, andMakefile
files). If you choose thedocker-compose.minimal.example.yml
on previous step, make sure to rename it to thedocker-compose.yml
. -
Open these files in a text editor and read them. Modify where needed according to the documentation comments to properly match your setup. There are comments of 2 types: those, starting with
##
, are explanations and examples, which should not be uncommented; those, starting with#
, are optional or alternative configuration parts, which might be uncommented in certain circumstances, described in corresponding explanations. It is better to go through the files in the next order:.env
,docker-compose.yml
, andMakefile
. -
Make sure that your media library's root folder and all the files and subfolders are readable and searchable by other users: run the next command (or corresponding sequence of commands from the
Makefile
):make readable
If command(s) return
Permission denied
error, run them under the user, owning corresponding files and folders. Alternatively, run them addingsudo
before the command: this will switch the execution context toroot
user and ask for the root password. You have to have permission to runsudo
in the system.If you configured other mounts with media files from other locations on the host (like HOST_PHOTOVIEW_MEDIA_FAMILY or anything else), you need to run the same commands, as in the
Makefile
readable
target, for each media root folder on your host manually: copy each command to your shell and replace the variable with the absolute path to an additional media root folder without the trailing/
. Run both commands for each additional root folder. -
In case, you don't have
make
installed in your system or don't want to use it for the Photoview management activities, you could use the same commands from theMakefile
and run them in your shell directly, or create your own scripts. Make sure to apply or replace the variables from your.env
first in this case.Makefile
is provided just for your convenience and simplicity, but is optional. -
Start the server by running the following command (or corresponding sequence of commands from the
Makefile
):make all
If the endpoint or the port hasn't been changed in the docker-compose.yml
file, Photoview can now be accessed at http://localhost:8000
Initial Setup
If everything is set up correctly, you should be presented with an initial setup wizard when accessing the website the first time.
Enter a new username and password.
For the photo path, enter the path inside the docker container where your photos are located.
This can be set from the docker-compose.yml
file under photoview
-> volumes
.
The default location is /photos
.
A new admin user will be created, with access to the photos located at the path provided under the initial setup.
The photos will have to be scanned before they show up, you can start a scan manually, by navigating to Settings
and clicking on Scan All
Advanced setup
We suggest securing the Photoview instance before exposing it outside your local network: even while it provides read-only access to your media gallery and has basic user authentication functionality, it is not enough to protect your private media from malicious actors on the Internet.
Possible ways of securing a self-hosted service might be (but not limited to):
- Configure a Firewall on your local network's gateway and allow only the intended type of incoming traffic to pass.
- Use VPN to provide external access to local services.
- Setting up a Reverse proxy in front of the service and forwarding all the traffic through it, exposing HTTPS port with strong certificate and cipher suites to the Internet. This could be one of the next products or something else that you prefer:
- Configure an external Multi-Factor Authentication service to manage authentication for your service (part of Cloudflare services, but you can choose anything else).
- Configure Web Application Firewall to protect from common web exploits like SQL injection, cross-site scripting, and cross-site forgery requests (part of Cloudflare services, but you can choose anything else).
- Use Content Delivery Network as an additional level of DDoS prevention: it can securely cache your media and let it be accessible from a wide list of servers on the Internet (part of Cloudflare services, but you can choose anything else).
- Configure a Rate Limit of allowed number of requests from a user during specified time range to protect against DDoS attacks.
- Set up an Intrusion Detection/Prevention System to monitor network traffic for suspicious activity and issue alerts when such activity is discovered.
Setting up and configuring of all these protections depends on and requires a lot of info about your local network and self-hosted services. Based on this info, the configuration flow and resulting services architecture might differ a lot between cases. That is why in the scope of this project, we can only provide you with this high-level list of possible ways of webservice protection. You'll need to investigate them, find the best combination and configuration for your case, and take responsibility to configure everything in the correct and consistent way. We cannot provide you support for such highly secured setups, as a lot of things might work differently because of security limitations.
Set up development environment
Local setup
- Install a local mysql server, and make a new database
- Rename
/api/example.env
to.env
and update theMYSQL_URL
field - Rename
/ui/example.env
to.env
Start API server
Make sure golang is installed.
Some C libraries are needed to compile the API, see go-face requirements for more details. They can be installed as shown below:
# Ubuntu
sudo add-apt-repository ppa:strukturag/libheif
sudo add-apt-repository ppa:strukturag/libde265
sudo apt-get update
sudo apt-get install libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg-turbo8-dev libheif-dev
# Debian
sudo apt-get install libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg62-turbo-dev libheif-dev
# macOS
brew install dlib libheif
Then run the following commands:
cd ./api
go install
go run server.go
Start UI server
Make sure node is installed. In a new terminal window run the following commands:
cd ./ui
npm install
npm start
The site can now be accessed at localhost:1234. And the graphql playground at localhost:4001
Sponsors
@ericerkz |
@robin-moser |
@Revorge |
@deexno |
@FKrauss |
@jupblb |