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

Docker-free installation process #57

Open
derneuere opened this issue Dec 31, 2020 · 48 comments
Open

Docker-free installation process #57

derneuere opened this issue Dec 31, 2020 · 48 comments
Labels
enhancement New feature or request

Comments

@derneuere
Copy link
Member

I got the request for a docker-free installation process.
Jellyfin for Example has docker images but also has binaries for windows, macOS and Linux.

I think we have to use pyinstaller for that. We have to bundle portable versions of the dependencies like PostgreSQL, Redis, Nginx and Node.js with it.

To build all the binaries we should probably have a CI/CD process in place.

We would also need to create an optional settings file where you can configure the parameters we currently set via docker-compose

@derneuere derneuere added the enhancement New feature or request label Dec 31, 2020
@strugee
Copy link
Contributor

strugee commented Dec 31, 2020

We have to bundle portable versions of the dependencies like PostgreSQL, Redis, Nginx and Node.js with it.

No no, don't do this. Or at least make it optional. Instead just let users point the code at their own Postgres, Redis, etc. and document how to configure the web server. I'm also interested in a Docker-free install, and while a big part of that is that I don't like Docker's security problems, another part of it is that operationally I want to be running one Postgres database, not a different Postgres database for every app that uses Postgres.

@ekianjo
Copy link

ekianjo commented Dec 31, 2020

also interested in a docker free install.

@atomicwrites
Copy link

@strugee I haven't tried it but the docker-compose file has variables that you can change for the Postgres host, port, user, password, and database name. I don't think anything is stopping you from using an existing shared postgres in a container or not in docker at all. You just need network connectivity.

@strugee
Copy link
Contributor

strugee commented Jan 1, 2021

Yeah, I saw that too. I'm manually deployed several Python apps before so I think I should be able to figure it out, but I need some hints as to what exactly needs to be deployed and where the code for those components is. There's the backend, the proxy, and the frontend right?

If someone gives me a quick overview of how you'd do it I can figure out the details and write up some install instructions.

(To clarify: I also don't like Docker for other reasons. Primarily the fact that many images are chock-full of security vulnerabilities and there's no good/non-hacky way to deal with that unless you're a company and have an entire team dedicated to keeping images up-to-date.)

@derneuere
Copy link
Member Author

@strugee You can find the frontend , backend and proxy here.
You can find the relevant backend settings here, I think the relevant file for the frontend are here, here, but I am not sure about the last one. Never worked on the proxy, if you have any concrete questions I can route them to @sim4city. He worked on it for a couple of commits.

@foobazbar123
Copy link

@strugee You can find the frontend , backend and proxy here.
You can find the relevant backend settings here, I think the relevant file for the frontend are here, here, but I am not sure about the last one. Never worked on the proxy, if you have any concrete questions I can route them to @sim4city. He worked on it for a couple of commits.

I'd agree that not building things shouldn't be done for a Docker deployment. That's the Docker way, after all :) There's no need to do so for VM or LXD style deployment and it would just create more overhead for you guys, for little real benefit.

I'm going through some of the files you linked to in your post, specifically the NGINX parts at the moment. I presume "backend" is a name that would resolve in the Docker environment to a particular container and "frontend" as well?

Based on that, is it correct to say that the backend process then listens on port 80, expecting http traffic and the frontend process listens on port 3000 by default? Is it expected that external clients, web users, are to be passed into the backend on the api and media end points?

I ask this as it would be nice to break the current dependency on nginx so a person could use caddy or whatever if they wanted. Shouldn't be hard to come up with an example caddy config based on what I'm seeing at the moment :)

@strugee I just wrote all I said above and then really read your comment. Looks like "proxy" is just NGINX in this case and nothing fancy, which makes things easier. @derneuere's post contains the bits for the front end dependencies, so I'm going to try and get that deployed today into an LXD container.

@foobazbar123
Copy link

Well, I have it up and running. Only thing is, the initial user isn't created so I can't login and test anything. Is there any way to force the creation of the user? I've got the ADMIN_USERNAME and ADMIN_PASSWORD environment variables set, but nothing is created. Thoughts?

@derneuere
Copy link
Member Author

The admin user is created in the entrypoint script: https://github.com/LibrePhotos/librephotos/blob/dev/entrypoint.sh
You could change it to force the creation of an admin acount.

@foobazbar123
Copy link

Ah, I see what I did wrong. I figured the migrations were doing that and totally over looked the bottom part there with manage.py shell part :)

@foobazbar123
Copy link

Okay, adding in the bits to create the account has it working properly. I'm going to feed it some photos and see if everything appears to be correct. If it does, I'll dump what I've done in another comment

@foobazbar123
Copy link

It's running, mostly. There are various issues resulting from, I believe, the "proxy" usage of NGINX. Is there expected to be multiple nginx things running in various directions? There's an nginx conf for the frontend, backend and the "proxy". Am I correct in thinking that with the current design three nginx instances are required?

@derneuere
Copy link
Member Author

derneuere commented Jan 1, 2021

AFAIK it is only one Nginx instance. The conf is here

I am pretty sure the other nginx.conf in the other repositories are not used.
@sim4city do you know if the other nginx.conf are used?

@strugee
Copy link
Contributor

strugee commented Jan 1, 2021

@foobazbar123 just skimmed through your comments on my phone - I'll probably hop on a computer in an hour or two and try setting things up too. Let's chat? I just created the #librephotos IRC channel on Freenode if that works for you

@strugee
Copy link
Contributor

strugee commented Jan 1, 2021

Oh, I forgot there was a Discord server... we could do that too although honestly because Discord does not respect my privacy or freedom it would be great to avoid it. I wonder how difficult it is to bridge Discord and IRC - I'll file a separate GitHub issue for that so we don't clutter this one up.

@foobazbar123
Copy link

Matrix is better at bridging things than IRC/Discord :)

@foobazbar123
Copy link

I have it fully working, so far as I can tell, now. I've got some working.. er.. instructions, if they can be called such, that will take one from a more or less blank LXD instance (with a couple of PPAs for Postgres and Node) to "working system"

It appears to one degree or another at least two nginx instances are probably desired, and possibly all three, in the Docker config. Consolidating the settings into one is possible in the LXD environment so I just did that. Prior to doing so, thumbnails and such wouldn't work

@thequailman
Copy link

thequailman commented Jan 10, 2021

I am also interested in doing this. I've read over the Makefiles and it seems pretty simple to build, however it would help me out immensely if you'd consider adding:

  1. Releases/tags consistent across the various component repos
  2. Combine everything into one repo (simplify the build process)

For sure until 1 is done, I don't think it's feasible to do this--there is no way to figure out what commits match.

@derneuere
Copy link
Member Author

@thequailman

Would be great if you want to tinker with it a bit 👍
If you want to build a binary you should look at the dockerfile. The makefile only creates a docker image.

  1. The latest dev commits are always compatible with each other.
  2. I don't think that we will merge the repos. Concerns should be separated to allow for greater modularity. It also should not be that hard to do it in a makefile. Git clone the repos in the makefile, and you will have all the code in one place.

@derneuere
Copy link
Member Author

You can now install librephotos locally under debian11: https://github.com/LibrePhotos/librephotos-linux

@foobazbar123
Copy link

foobazbar123 commented Mar 12, 2021 via email

@atomicwrites
Copy link

atomicwrites commented Mar 12, 2021

@foobazbar123 Talking specifically about the /usr/bin/bash issue, /bin is just a symlink to /usr/bin on most modern distros. It's called the /usr merge. According to https://wiki.debian.org/UsrMerge it is the default on new installations but the change has to be applied manually to existing ones. It is weird to call the command in /usr directly though, the symlinks are there to preserve compatibility and not using it will break your script on some systems as you found out.

@tomamplius
Copy link
Contributor

yes but maybe that the best way is use

/usr/bin/env bash

I will check compatibility with ubuntu 20.04 and take into account some input

@tomamplius
Copy link
Contributor

@foobazbar123 thanks for you test. It was only test on debian 11 before.
You can find a pull request to Ubuntu 20.04 LibrePhotos/librephotos-linux#2
If you can test and validate the new package from https://github.com/tomamplius/librephotos-linux/archive/ubuntu20.04.zip

About nodejs and npm are exclusive. Can you give me more information. I can't reproduce

@strugee
Copy link
Contributor

strugee commented Mar 13, 2021

I do have the NodeSource repository on my LXD test container, so that may be a local issue on my part.

This is indeed a local issue. NodeSource ships npm inside their nodejs package, but the nodejs package in the Debian/Ubuntu archives separates it out into the npm package.

@tomamplius
Copy link
Contributor

OK i understand.

@foobazbar123
Copy link

foobazbar123 commented Mar 14, 2021 via email

@foobazbar123
Copy link

foobazbar123 commented Mar 14, 2021 via email

@tomamplius
Copy link
Contributor

check the branch ubuntu20.04
I'ts not commit
https://github.com/tomamplius/librephotos-linux/tree/ubuntu20.04

@foobazbar123
Copy link

foobazbar123 commented Mar 14, 2021 via email

@foobazbar123
Copy link

foobazbar123 commented Mar 14, 2021 via email

@tomamplius
Copy link
Contributor

added on readme /usr/lib/librephotos/bin/librephotos-upgrade

@foobazbar123
Copy link

foobazbar123 commented Mar 14, 2021 via email

@foobazbar123
Copy link

foobazbar123 commented Mar 14, 2021 via email

@tomamplius
Copy link
Contributor

tomamplius commented Mar 14, 2021

@foobazbar123 thank you for your test
I will take suggestions in the next version
@derneuere Please can you merge LibrePhotos/librephotos-linux#2 after this test?

@derneuere
Copy link
Member Author

@foobazbar123 Thanks for the test!
@tomamplius I merged it :)

@UndarkAido
Copy link

I tried to set up Caddy and posted LibrePhotos/librephotos-linux#8 but I can't quite get it to work. Not really my skillset.

@thequailman
Copy link

What's the reasoning for not serving the UI from the backend? Why have a dependency on a proxy?

@tomamplius
Copy link
Contributor

tomamplius commented Apr 3, 2021

dependency become optional on the next version https://github.com/tomamplius/librephotos-linux/tree/v2

@thequailman
Copy link

Sorry, that's not quite what I'm looking for. Why can't the backend serve these files directly instead of having another daemon serve them?

@tomamplius
Copy link
Contributor

I mean it's choice because webserver like nginx apache are more perform than django to server files.

@thequailman
Copy link

The way it currently works, the frontend is built everytime time it's restarted and served from node/express. Instead, it could be built once and served as static files from django.

NGINX/Apache don't serve these files directly, they proxy to the node server. You could setup caching for either situation to have them serve the files from cache, but I highly doubt there's any kind of performance impact serving files from django for 99% of librephoto setups.

@tomamplius
Copy link
Contributor

Location /protected_media /original /nextcloud_original are not used? i have not currently check this part.
https://github.com/tomamplius/librephotos-linux/blob/v2/ressources/nginx/nginx.conf

@tomamplius
Copy link
Contributor

tomamplius commented Apr 3, 2021

and /media /api are proxy to the backend not ton node server

@tomamplius
Copy link
Contributor

maybe we can remove node server, right

@thequailman
Copy link

Disregard, I incorrectly assumed django can share files.

I created an Ansible task that does most of your script (you'll need to manually setup the nginx bit): https://gist.github.com/thequailman/caffade8049ccbee64113c77f42b9bbe#file-librephotos-md

I could probably clean this up and make it into a real ansible collection if anyone wanted that.

@tomamplius
Copy link
Contributor

I don't know / use ansible. but it's a idea to add to add your script on official repo.
@derneuere can you i add the script in librephotos-linux? or you want create librephoto-ansible?

@thequailman
tkx and great work.

@ma-gh
Copy link

ma-gh commented May 29, 2021

I am on the noober side of things, but I tried to do the linux install.

It crashed when nginx tried to bind where Apache lived. I wish I knew that this auto install was going to throw nginx in there. It isn't mentioned in the README. I hope I didn't bork my system but I just uninstalled nginx and deleted all the librephotos files.

I will return on a later release. Excited to try it out as a Google Photos replacement.

Thanks

@audioscavenger
Copy link

i am on the noober side of things, but i would gracefully appreciate that we concentrate on bugfix rather than starting new projects lol

AnkurPrabhu pushed a commit to AnkurPrabhu/librephotos that referenced this issue Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

10 participants