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

Better unRAID setup #184

Closed
CorneliousJD opened this issue Sep 24, 2020 · 27 comments
Closed

Better unRAID setup #184

CorneliousJD opened this issue Sep 24, 2020 · 27 comments
Labels
enhancement New feature or request

Comments

@CorneliousJD
Copy link

I'd like to setup an unRAID Docker template for this app, however I would need a dockerhub that auto-builds off of this repository.

I don't want to fork it and leave it unupdated by having it pull from my forked repo.
Are you able to create a free dockerhub repo that auto-pulls from here and builds from the dockerfile?

Thanks in advance!

@CorneliousJD CorneliousJD added the enhancement New feature or request label Sep 24, 2020
@Tmaxxrox97
Copy link
Contributor

There is this: https://hub.docker.com/r/vabene1111/recipes
Is that what you are looking for?
I am also interested in having this run off my unRAID system as well.

@CorneliousJD
Copy link
Author

Yep that's what I had looked for but I must have typed your name wrong in the url, whoops!

I'll work to see if I can get this setup on an unraid template within the next few days :) I'll keep you posted!

@vabene1111
Copy link
Collaborator

perfekt! let me know if you need anything else, i usually release tagged versions, a latest and one image for each branch. Also all latest and tagged releases are build for all platforms including arm

@Tmaxxrox97
Copy link
Contributor

I worked a little on creating a template for unRAID and I think I have it working. I've never done it before so I am sure I made a mistake or 6.

If you (@CorneliousJD) wanted I could share it with you somehow and you can make changes and improvements to it or completely ignore it if I did it wrong..

One thing I know doesn't work/happen is an auto copy/create/download of the env file or the nginx config file. I have a different nginx server elsewhere so I am not counting on this project to handle that for me so that may be a non-issue but the env file is a concern.

Let me know

@vabene1111
Copy link
Collaborator

i suggest you run the nginx server and the other one because you will need to enter the routing config for /media/ and /static/ in your othre config otherwise. Its not really a performance issue to have multiple nginx servers running on top of each other.

Also unRaid seems to be very popular so if you want to submit a PR with your finished config, even if you aren't sure its perfect, that would be very cool. Just note that its a contributed example that is not officially maintained.

@Tmaxxrox97
Copy link
Contributor

So I did a bit more working on it, realized I did it sort of wrong on my first run through. I will try my best to explain the issues that I discovered.

First and foremost, unRAID is weird. They handle docker differently than most other systems do. From what I read unRAID doesn't use docker-compose in its GUI when running containers but it is accessible through the command line. This essentially removes the convenient part of unRAID of point, click, fill it out, and click start which many people using unRAID are all about and what I would like to see happen on my own system.

Second, from what I gathered all of the current unRAID docker apps available through the CA plugin are single containers (dockerfiles) and not container stacks (docker-compose). This obviously poses a problem with how recipes is currently deployed in docker. So, when I had recipes running on unRAID I only had one third of the full deployment running which was just the recipes docker container running which doesn't include nginx and postgres.

So to make this work I think a "monolith" container would need to be created. This container would need to contain all three aspects of the project, nginx, recipes, and postgres.

I don't know if you feel this would add value to your project or not but I am to try making this all in one container and getting it to work and on unRAID.

@vabene1111
Copy link
Collaborator

i dont know much about unraid but i know people are definitly using recipes on it. Its also absoulutly possible to setup these three containers on even different physical servers and just point them at each other. Its just the nginx conf that needs to be changed to point to the gunicorn server (the recipes container) and then in .env the database host must be changed, everything else should basically just work

@CorneliousJD
Copy link
Author

I agree that the best option (for UnRAID) would be to have everything within a single container, that would GREATLY increase adoption and use, since that's how most people expect docker containers to work there. Anyone that has to even fire up a second SQL server container seems to be put off by it and ends up not wanting to use hte container (I've seen this in my other container templates I've uploaded for another reciepe management software).

If we can get a container that has nginx, recipes, and postgres all in one, and a dockerfile that will build all that and it's on dockerhub this should be realitively easy for me then to get running and get published to CA within a matter of hours. If you get that running @Tmaxxrox97 please let me know - would be happy to push it to CA for you if you need help with that, as I already have an approved repository in the Community Apps.

@vabene1111
Copy link
Collaborator

hmm does not really sound like a great system because it looses all the benefits of the clean container system but if someone provides a nice docker file i dont mind publishing an unraid image as well

@CorneliousJD
Copy link
Author

I don't know if you feel this would add value to your project or not but I am to try making this all in one container and getting it to work and on unRAID.

@Tmaxxrox97 did you have any luck getting an all-in-one dockerfile/container running?

IMO running a Postgres database container separately isn't an issue, but a lot of people on unRAID get scared off by this, and I think even MORE so by needing to manually join Nginx (or SWAG, formerly the LetsEncrypt container, if they're running that) to be able to talk with Recipes.

@vabene1111 vabene1111 reopened this Oct 6, 2020
@vabene1111 vabene1111 changed the title Dockerhub auto-updating from this repo Better unRAID setup Oct 6, 2020
@CorneliousJD
Copy link
Author

Another option for this instead of including Postgres would be a SQLite database perhaps? Since this would be selfhosted for personal recipe use, and never to likely be something hosting thousands of recipes and users, a SQLite database may be sufficeint? And obviously easier to use and lighter weight than trying to pack Postgres into the container.

Nginx included in it shouldn't add too much complexity and overhead, then you'd end up with Recipes itself, SQLite db, and a pretty lightweight Nginx so everything is then selfcontained and easy to deploy to unraid.

I am NOT a developer or db admin though so I don't know how feasible implementing SQLite would be vs Postgres which you obviously have already put work into.

@vabene1111
Copy link
Collaborator

you can use any django supported database backend with recipes simly by changing the driver in the .env file. Altough you loose some features (like the trigram similarity search) and some optimizations i dont see why running sqlite should be a problem.

I do all the development on an sqlite DB so everything definitely works there.

@CorneliousJD
Copy link
Author

Ok so I got this working in unRAID now.
Using SQLite3 as the database backend because users are always intimidated by setting up a separate DB container for some reason.... lol
I did leave the ability to use PostgreSQL baked into the template though for users who want to venture forth with that!

The only thing that's not really proper is we're serving media directly from Gunicorn, because of the ease-of-use aspect of it.
If they're not going to spin up a separate DB container they wont want to/know how to spin up a separate nginx container to point back to Recipes.

So now everything is at least running in a single docker container, with the SQLite and media mounted in persistent storage, on what unRAID calls "appdata"

This should be up in their "App store" called Community Applications within a few hours with my template.
I'll probably close this request out once it gets published to the Community Applications.

How it will look to unRAID users who add it.
image

How I configured the template.
Note Port # will be at the top and the first choice when this publishes to Community Apps.
image

Here's the system page with the warning for Gunicorn and the info about not using PostgreSQL.
image

@CorneliousJD
Copy link
Author

One thing I can't seem to figure out is how to set users timezone for some reason. Seems to default to Berlin?
Not sure if I'm missing something but other than that, everything apperas to be working for now.

@vabene1111
Copy link
Collaborator

hmm the timezone is defined in the settings.py but i use localization in all templates so this all should set automatically (at least thats what i tought).

i will include a .env setting in the next update to make it configurable.

also thank you very much for making this all work, please provide a link to the unraid store thingy so i can put it into the readme. Serving with GUNICORN_MEDIA is not super bad and for small personal setups i think its fine, SQL Lite also supports most of the features Postgres supports with the exception of the trigram similarity search but i guess thats also fine for simplicity

@CorneliousJD
Copy link
Author

Is there a way to store the settings file outside of the container? It looked like it was in a folder with other cache files, etc and the whole folder shouldn't be stored outside of the container?

Right now all that's stored outside of container is the sqlite database (to persist across updates) and media files.

Any other directories I need to consider, such as where the settings file is?

Thanks!

@vabene1111
Copy link
Collaborator

the .env file or whatever other way unraid uses to store environment variables needs to be stored. Also the mediafiles directory needs to be saved (all the images) and the staticfiles directory could be saved since collecting the static files takes a few seconds and if they are saved they dont need to be re-collected.

@CorneliousJD
Copy link
Author

Gotcha. I'll add static files to be saved too.

What about the settings file? Can that whole directory be stored? If so what directory is it? I'm mobile now so can't check. But will update my settings later. Thanks!

@vabene1111
Copy link
Collaborator

there are no settings stored on disk anywhere. The settings.py is static and should not be changed during installation. settings.py loads environment variables which are normally stored as .env files and then loaded into the docker container via the directive in the docker-compose.yml.

So if you set all the settings (e.g. the Sqlite DB, etc.) in some kind of unraid config then everything is fine

@CorneliousJD
Copy link
Author

ok rgr that, that makes sense! I don't need to change anything then, but if you do know what env variable you will use for TZ let me know and I'll pre-emptively add it into the container template on unRAID so it's there and ready ahead of time.

Here's some overview if you want to make a page in the docker setup of your docs.

Recipes for unRAID is avialble via Community Applications.
You will first need to install Community Applications (CA) by following the directions here:
https://forums.unraid.net/topic/38582-plug-in-community-applications/

After that, you can go to the "Apps" tab in unRAID and search for Recipes and locate the Recipes container and install it.
image

The default settings should by fine for most users, just be sure to enter a secret key that is randomly generated.
Then chooose apply.

image

After the container installs, click on the Recipes icon and click the WebUI button to launch the web user interface.
Set the container to auto-start if you wish.
image

@CorneliousJD
Copy link
Author

Also, what does "ca." stand for on "prep time ca" and "wait time ca"

PS I absolutely LOVE the website recipe importer. That makes SUCH quick work of everything, it's amazing.

@vabene1111
Copy link
Collaborator

oh i always though ca. was international 😂 it means something like about 5 minutes and is a very popular abbreviation in germany ... i guess i will need to fix that translation.

the timezone variable will be called TIMEZONE if you want to add it already feel free. I will leave this issue open until i create the docs page. Thank you very much for testing this all out and getting it to work nicely, i am sure there will be many people profiting from this.

@CorneliousJD
Copy link
Author

Confirming I added the TIMEZONE variable in now so it's pre-emtively there for when you update Recipes :)

I also have a unRAID specific support thread here:
https://forums.unraid.net/topic/98179-support-recipes-corneliousjd-repo/
You can add that to your unRAID documentation incase users have unRAID specific issues.

In America instead of "ca." we would use "approx" which is just short for "approximately"
Another way is the double-tilde, ≈ which is short for "about" or "approx"
but honestly I'm not sure any abbreviation there is needed, IMO it read better without anything.

Prep Time: 10 minutes
Wait Time: 60 minutes

If you need anything else from me on this just feel free to ping me back! Thanks again for all the info!

@hunsbct
Copy link

hunsbct commented Dec 13, 2020

Hi all, I hope this is the right place to post this issue. I'm working to set up Recipes in Unraid, and locally everything is working great. However, I'm running into an issue when I try to host the application via nginx reverse proxy through the linuxserver.io swag container.

It looks to me like relative URLs are breaking all scripts and resources. Here is a screenshot of the page in its current configuration and my location block in nginx/site-confs is as follows:

location /recipes/ {
    proxy_pass http://[private server IP]:8154;
    proxy_set_header host $host;
}

I was also tinkering with setting the VIRTUAL_HOST parameter but couldn't get it to resolve the problem. I'm hoping there's some specific variable I can set or nginx tweak that will fix this, as has been the case with other apps I've run this way. Does anyone have any suggestions?

@CorneliousJD
Copy link
Author

@hunsbct have you tried doing a subdomain instead of a location? I have mine on a subdomain working fine here. (Via NPM, not SWAG tho.)

@hunsbct
Copy link

hunsbct commented Dec 13, 2020

@CorneliousJD No, I'll have to do some research on that and give it a try.

@vabene1111
Copy link
Collaborator

Ok so i have added what i feel like is all the required information to the new documentation https://vabene1111.github.io/recipes/install/unraid/

Thank you again very much @CorneliousJD for providing this image and also (as i just noticed) for helping out quite a few folks over in the unraid forums.

if you feel like anything is missing or want things changed feel free to PR on the docs or create an issue on what i should change.

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

4 participants