Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOT FOR MERGE rebuild photoview image #910

Conversation

kkovaletp
Copy link
Contributor

@kkovaletp kkovaletp commented Jan 28, 2024

This PR is not for merging.
It is created as a workaround for the fact that the project is on hold, so the image on the Docker Hub was built a long time ago, which leads to some bugs and vulnerabilities not being fixed in the base image and installed 3rd-party components.

With this PR anyone could easily rebuild the Photoview image locally based on the project source code and the latest available 3rd-party components according to the dependencies defined in the project.

See the README in this PR for the step-by-step guide. Here is the copy of the guide for your convenience:

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 provided Makefile, 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 the Makefile, located in the backup section for more details.

  1. Clone this repo to the folder on your server, where you expect to host the Photoview internal data (database and cache files).
    • cd <path to the folder on your server, where you expect to host the Photoview internal data>
    • git clone https://github.com/kkovaletp/photoview.git .
    • git checkout NOT-FOR-MERGE-rebuild-photoview-image
    • git pull
  2. Rename docker-compose.example.yml and example.env files and remove the example from their names (so, you need to have .env and docker-compose.yml files).
  3. Open these files and the Makefile in a text editor and read them. Modify where needed according to the documentation comments to properly match your setup. It is better to go through the files in the next order: .env, docker-compose.yml, and Makefile.
  4. 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 the Makefile 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.
  5. 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

NOTE:
This sequence will build the Photoview image from local sources replacing the original
viktorstrate/photoview:latest image, published on the docker hub by the repo owner.
This is a workaround of the fact that the project is not actively maintained,
and that image is pretty outdated, having some vulnerabilities and old software.
If you want to use the original image, do not build the local one
(exclude the build step from the sequence in the Makefile)
and remove the local viktorstrate/photoview:latest image.
Next time you start the service, the original image will be pulled from the docker hub.

WindLi001 and others added 24 commits February 10, 2023 10:42
…ting invalid. And use zoom:1 to show the global map.
…: reimplemented the docker-compose user setup to enhance product setup experience and cover much more cases.
Add missing labels
…mple.yml, as it is defined in the Dockerfile; optimized Dockerfile combining all RUN directives of PROD stage into 1, which will produce single layer and save some space; added Dockerfile-dev, docker-compose-dev.yml, and new "dev" and "dev-down" directives into Makefile, which allows to setup development env in Docker. Instructions of how to use it are in comments at the beginning of Dockerfile-dev and docker-compose-dev.yml files
Video playback starts faster in browsers.
… so that the image could be later run with non-root permissions and the app still be able to do needed operations in the FS
…` target and enhanced comments in the Makefile; commented out the `docker system prune -f` with the comment about the command and why it is there; added optional and commented by default `7zz` commands to the `backup` section of the Makefile
…om locally available source code using lates available dependencies
Copy link

codecov bot commented Jan 28, 2024

Codecov Report

Attention: Patch coverage is 21.31148% with 192 lines in your changes are missing coverage. Please review.

Project coverage is 56.78%. Comparing base (b2d591b) to head (ece1de2).
Report is 5 commits behind head on master.

Files Patch % Lines
ui/src/Pages/SettingsPage/Users/PasswordChange.tsx 22.37% 111 Missing ⚠️
ui/src/localization.ts 8.77% 52 Missing ⚠️
api/graphql/resolvers/user.go 0.00% 18 Missing ⚠️
api/graphql/models/user.go 63.63% 2 Missing and 2 partials ⚠️
ui/src/components/sidebar/SidebarDownloadMedia.tsx 60.00% 4 Missing ⚠️
ui/src/components/mapbox/MapboxMap.tsx 33.33% 2 Missing ⚠️
ui/src/Pages/SettingsPage/SettingsPage.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #910      +/-   ##
==========================================
- Coverage   57.34%   56.78%   -0.57%     
==========================================
  Files         196      197       +1     
  Lines       15607    15837     +230     
  Branches      533      533              
==========================================
+ Hits         8950     8993      +43     
- Misses       6408     6595     +187     
  Partials      249      249              
Flag Coverage Δ
api 25.15% <24.13%> (-0.04%) ⬇️
ui 69.06% <20.93%> (-0.94%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kkovaletp
Copy link
Contributor Author

I've just merged PR #874 to this branch to fix failing tests
I'm going to review and merge some other open PRs here to make this branch a better alternative to the master, containing the latest fixes and improvements until the repo owner returns and merges those PRs into the master.

@timbroder
Copy link

timbroder commented Feb 7, 2024

Any ideas why I might be getting errors like this?

ERROR: Invalid interpolation format for "build" option in service "photoview": "$(date +%Y-%m-%d)"

ERROR: Invalid interpolation format for "build" option in service "photoview": "$(git rev-parse --short HEAD)"

I'm running docker-compose version 1.29.2, build unknown on Ubuntu

@kkovaletp
Copy link
Contributor Author

Any ideas why I might be getting errors like this?

strange... no ideas. I tested the build on kubuntu 22.04 (amd64) and everything was working fine.
please double-check that you strictly follow the steps from the readme or the 1st post in this PR.
*BUILD_DATE and *COMMIT_SHA build args in docker-compose are resolved from the Makefile's build command's build-args, where they are defined as sub-shell commands, so they are executed in bash right at the moment, the value is going to be provided to the main command parameters. Make sure that this chain is not broken and works correctly on your env.

Comment on lines 17 to 20
BUILD_DATE: $(date +%Y-%m-%d)
REACT_APP_BUILD_DATE: $(date +%Y-%m-%d)
COMMIT_SHA: $(git rev-parse --short HEAD)
REACT_APP_BUILD_COMMIT_SHA: $(git rev-parse --short HEAD)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solved my issue here. Thanks!

Suggested change
BUILD_DATE: $(date +%Y-%m-%d)
REACT_APP_BUILD_DATE: $(date +%Y-%m-%d)
COMMIT_SHA: $(git rev-parse --short HEAD)
REACT_APP_BUILD_COMMIT_SHA: $(git rev-parse --short HEAD)
BUILD_DATE: $$(date +%Y-%m-%d)
REACT_APP_BUILD_DATE: $$(date +%Y-%m-%d)
COMMIT_SHA: $$(git rev-parse --short HEAD)
REACT_APP_BUILD_COMMIT_SHA: $$(git rev-parse --short HEAD)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I tested it and it works for me. Have no idea why it was working with 1 $ before...
I've pushed this change to the repo

@kkovaletp
Copy link
Contributor Author

I've merged here PR #917 with an improvement to thumbnail creation for video files.

@kkovaletp
Copy link
Contributor Author

I decided to add the vulnerabilities folder to this PR with the latest scan results from Anchore Syft and Grype of the source code and the built Docker image.

My main intention is to provide you with all the info about the product's security level, so you can self-host it with an adequate level of protection and isolation. But also, it would be great if these reports could trigger some new PRs from our community developers with updated dependencies to fix at least already patched ones.

Please note that the Grype report about the image contains components from the product, as well as from the base Docker image, which means that we can fix only the vulnerabilities from the product, while we rely on the base image maintainers to keep that image up-to-date and that is why I recommend to periodically rebuild your Photoview image even if there are no new updates here in the repo.

@kkovaletp
Copy link
Contributor Author

I've merged here PR #918, which adds the change password functionality to the settings page of non-admin accounts

@kkovaletp
Copy link
Contributor Author

As the project is back to active development, no new merges are expected in this PR.
We're going to merge all original PRs, which are part of this one, into the master and when it is done, so master contains all the same features and bugfixes, this PR will be closed. I'll add a new comment here before that

…MERGE-rebuild-photoview-image

# Conflicts:
#	api/scanner/scanner_album.go
#	docker-compose.example.yml
@kkovaletp kkovaletp added invalid This doesn't seem right wontfix This will not be worked on docker Related to deployment with Docker labels Apr 29, 2024
@kkovaletp kkovaletp closed this May 14, 2024
@kkovaletp
Copy link
Contributor Author

If you're still waiting for some fixes and improvements, not merged into the master compared to this PR, I'd recommend you to check my fork: https://github.com/kkovaletp/photoview - it already contains all the fixes and improvements from this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker Related to deployment with Docker invalid This doesn't seem right wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet