minor bug fixes and systemd service tweaks.

This commit is contained in:
Joshua Ashton
2025-03-14 12:10:39 -06:00
parent 7db3961a79
commit 5baaa9e456
4 changed files with 19 additions and 25 deletions
+11 -13
View File
@@ -14,17 +14,6 @@ if [[ -z "$PI_VERSION" || "$PI_VERSION" == "n" ]]; then
exit; exit;
fi fi
echo "Adding environment variables. For more information, visist raspi.vintagecoding.net#env-vars";
echo "export OLLAMA_BASE_URL=http://localhost:$OLLAMA_PORT;"; >> $HOME/.bashrc;
read -p "Do you want to require login to your AI? (n/Y)" REQUIRE_LOGIN
REQUIRE_LOGIN=$(echo "$REQUIRE_LOGIN" | tr '[:upper:]' '[:lower:]')
if [[ -z "$REQUIRE_LOGIN" || "$REQUIRE_LOGIN" == "n" ]]; then
export WEBUI_AUTH=False >> $HOME/.bashrc;
fi
source $HOME/.bashrc
echo "Running `python -m venv open-webui-env`. This creates a Python virtual environment, where"; echo "Running `python -m venv open-webui-env`. This creates a Python virtual environment, where";
echo "we can install applications in an isolated manner from the rest of our Operating System (OS)."; echo "we can install applications in an isolated manner from the rest of our Operating System (OS).";
python -m venv open-webui-env; python -m venv open-webui-env;
@@ -41,7 +30,7 @@ server_name localhost;
location / { location / {
proxy_pass http://localhost:$OPEN_WEBUI_PORT/; proxy_pass http://localhost:$OPEN_WEBUI_PORT/;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade'; proxy_set_header Connection 'upgrade';
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade; proxy_cache_bypass $http_upgrade;
@@ -74,6 +63,9 @@ Type=simple
Restart=always Restart=always
RestartSec=1 RestartSec=1
User=$(whoami) User=$(whoami)
Environment=WEBUI_AUTH=True
Environment=WEBUI_BASE_URL=https://TMP_URL
Environment=OLLAMA_BASE_URL=http://localhost:11434
WorkingDirectory=$HOME WorkingDirectory=$HOME
ExecStartPre=/bin/bash -c "source /home/$(whoami)/open-webui-env/bin/activate" ExecStartPre=/bin/bash -c "source /home/$(whoami)/open-webui-env/bin/activate"
ExecStart=/home/$(whoami)/open-webui/open-webui-env/bin/open-webui serve --port $OLLAMA_PORT ExecStart=/home/$(whoami)/open-webui/open-webui-env/bin/open-webui serve --port $OLLAMA_PORT
@@ -81,4 +73,10 @@ ExecStart=/home/$(whoami)/open-webui/open-webui-env/bin/open-webui serve --port
[Install] [Install]
WantedBy=multi-user.target" | sudo tee /etc/systemd/system/open-webui.service; WantedBy=multi-user.target" | sudo tee /etc/systemd/system/open-webui.service;
sudo systemctl daemon-reload && sudo systemctl enable open-webui.service; read -p "Do you want to require login to your AI? (n/Y)" REQUIRE_LOGIN
REQUIRE_LOGIN=$(echo "$REQUIRE_LOGIN" | tr '[:upper:]' '[:lower:]')
if [[ -z "$REQUIRE_LOGIN" || "$REQUIRE_LOGIN" == "n" ]]; then
sudo sed -i -e 's/WEBUI_AUTH=True/WEBUI_AUTH=False/' /etc/systemd/system/open-webui.service;
fi
sudo systemctl daemon-reload && sudo systemctl enable open-webui.service && sudo systemctl start open-webui.service;
+4 -8
View File
@@ -44,26 +44,22 @@ cloudflared tunnel route dns $TUNNEL_ID raspi.$DOMAIN;
cloudflared tunnel route dns $TUNNEL_ID media.$DOMAIN; cloudflared tunnel route dns $TUNNEL_ID media.$DOMAIN;
cloudflared tunnel route dns $TUNNEL_ID ai.$DOMAIN; cloudflared tunnel route dns $TUNNEL_ID ai.$DOMAIN;
ACTUAL_USER=$(whoami)
echo "[Unit] echo "[Unit]
Description=Cloudflare Tunnel Daemon Description=Cloudflare Tunnel Daemon
After=network.target After=network.target
[Service] [Service]
Type=simple Type=simple
User=$ACTUAL_USER User=$(whoami)
ExecStart=/usr/bin/cloudflared tunnel run raspi ExecStart=/usr/bin/cloudflared tunnel run raspi
Restart=always Restart=always
[Install] [Install]
WantedBy=multi-user.target" | sudo tee /etc/systemd/system/cloudflared.service; WantedBy=multi-user.target" | sudo tee /etc/systemd/system/cloudflared.service;
sudo systemctl enable cloudflared.service; sudo systemctl daemon-reload && sudo systemctl enable cloudflared.service && sudo systemctl start cloudflared.service;
source ~/.bashrc;
sudo sed -i -e 's/server_name localhost/servername ai.$DOMAIN/' /etc/nginx/sites-available/open-webui; sudo sed -i -e 's/server_name localhost/servername ai.$DOMAIN/' /etc/nginx/sites-available/open-webui;
sudo sed -i -e 's/WEBUI_BASE_URL=localhost/WEBUI_BASE_URL=https://ai.$DOMAIN/' /etc/systemd/system/open-webui.service;
export WEBUI_BASE_URL=ai.$DOMAIN >> $HOME/.bashrc; sudo systemctl daemon-reload && sudo systemctl restart open-webui.service;
sudo systemctl restart open-webui.service;
+2 -2
View File
@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
$JELLYFIN_PORT=5091; JELLYFIN_PORT=5091;
# Get the official image of Jellyfin software. # Get the official image of Jellyfin software.
echo "Running `podman pull ghcr.io/jellyfin/jellyfin`"; echo "Running `podman pull ghcr.io/jellyfin/jellyfin`";
@@ -58,6 +58,6 @@ ExecStart=/usr/bin/podman start myjellyfin
[Install] [Install]
WantedBy=multi-user.target" | sudo tee /etc/systemd/system/jellyfin.service; WantedBy=multi-user.target" | sudo tee /etc/systemd/system/jellyfin.service;
sudo systemctl daemon-reload && sudo systemctl enable jellyfin.service; sudo systemctl daemon-reload && sudo systemctl enable jellyfin.service && sudo systemctl start jellyfin.service;
echo "For now, please visit jellyfin.org/docs for information about setting up Jellyfin. We'll have a more comprehensive guide soon."; echo "For now, please visit jellyfin.org/docs for information about setting up Jellyfin. We'll have a more comprehensive guide soon.";
+2 -2
View File
@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
$MANUAL_PORT=5090; MANUAL_PORT=5090;
echo "Creating a SystemD service file. These are commands (applications) that you can set to start as soon as you turn on the Pi."; echo "Creating a SystemD service file. These are commands (applications) that you can set to start as soon as you turn on the Pi.";
echo "This file is located at `/etc/systemd/system/manual.service`."; echo "This file is located at `/etc/systemd/system/manual.service`.";
@@ -23,7 +23,7 @@ ExecStart=/usr/bin/python3 -m http.server $MANUAL_PORT
[Install] [Install]
WantedBy=multi-user.target" | sudo tee /etc/systemd/system/manual.service; WantedBy=multi-user.target" | sudo tee /etc/systemd/system/manual.service;
sudo systemctl daemon-reload && sudo systemctl enable manual.service; sudo systemctl daemon-reload && sudo systemctl enable manual.service && sudo systemctl start manual.service;
echo "For now, this uses the command `python -m http.server 5090` to serve the man/pages on port 5090."; echo "For now, this uses the command `python -m http.server 5090` to serve the man/pages on port 5090.";
echo "For more information, see raspi.vintagecoding.net#web-servers"; echo "For more information, see raspi.vintagecoding.net#web-servers";