Showing posts with label how-to. Show all posts
Showing posts with label how-to. Show all posts

Installation steps /script snippets for Open Web-UI on Debian

This is just a quick info dump for my own future reference, an anyone else who might benefit. Many parts are uncertain and should be investigated for clean up. But it works, and I have other priorities. Apologies at the mess and hard to read order, but there are plenty of other nice walkthroughs that I followed for this. I recommend one of them instead as your base, and this just as a reference.


Now, how to do code blocks in this interface...? Alas, not in the base offering of Blogger... Yuck.


  • System: Debian trixie/sid mixed with many stable packages, as of 2025-06-14.
  • Desireable: A remote access method, such as tailscale or easily opened and secured ports.
  • Option selected: A more native python based, rather than the docker container option.

Install pipx and dependencies via package manager of choice.

Configure some settings files in the directory, especially environment variables.

Here is a dump of my files / scripts used. Adjustments are needed.

First section includes multiple files, which should be configured per your system needs.


::::::::::::::
open-webui.env
::::::::::::::

# ==========================
# Open WebUI Environment (.env)
# ==========================
# refer https://docs.openwebui.com/getting-started/env-configuration/#overview

# - Non-PersistentConfig variables can be changed at any time and will take effect on restart.

# Bind to 0.0.0.0 for LAN access (default port 8080)
WEBUI_HOST=0.0.0.0
WEBUI_PORT=8081
# FIXME: used?
HOST=0.0.0.0
PORT=8081

# disable telemetry
# Telemetry/analytics controls (not PersistentConfig)
SCARF_NO_ANALYTICS=true
DO_NOT_TRACK=true
ANONYMIZED_TELEMETRY=false


# ==========================
# Unknown if PersistentConfig

# Enable audio in / out features
## Speech-to-Text (STT) configuration for DeepInfra
AUDIO_STT_ENGINE=openai
AUDIO_STT_MODEL=whisper-large-v3-turbo
# FIXME: or is it?
# AUDIO_STT_ENGINE=openai
# AUDIO_STT_MODEL=openai/whisper-large-v3-turbo
## Text-to-Speech (TTS) configuration for DeepInfra
AUDIO_TTS_ENGINE=hexgrad
AUDIO_TTS_MODEL=Kokoro-82M
# FIXME: or is it?
# AUDIO_TTS_ENGINE=openai
# AUDIO_TTS_MODEL=hexgrad/Kokoro-82M
# Many voice choices: https://deepinfra.com/hexgrad/Kokoro-82M/api?example=http
AUDIO_TTS_VOICE=af_bella


ENABLE_ONEDRIVE_INTEGRATION=True
# UNKNOWN: ONEDRIVE_CLIENT_ID


# Description: Specifies the base directory for data storage, including uploads, cache, vector database, etc.
# FIXME: Use XDG instead.
DATA_DIR=/home/USERID/Projects/Open-webui/OpenWebUI_Data

# ==========================
::::::::::::::
open-webui.env.first_run_lan
::::::::::::::
# ==========================
# Open WebUI Environment (.env.first_run_lan)
# only first run
# ==========================
# Allow open access
# Disable user authentication (WARNING: insecure, use only in trusted LAN)
# Disable user accounts and authentication
# User/account/authentication controls
ENABLE_SIGNUP=False
WEBUI_AUTH=False


::::::::::::::
open-webui.envish.first_run
::::::::::::::

# To be sourced.

# ==========================
# Open WebUI Environment (open-webui.envish.first_run)
# only first run
# refer https://docs.openwebui.com/getting-started/env-configuration/#overview
# ==========================
mkdir -p "${HOME}"/Documents/OpenWebUI

# DeepInfra API configuration
OPENAI_API_BASE_URL=https://api.deepinfra.com/v1      # PersistentConfig: Yes
# OPENAI_API_KEY=your_deepinfra_api_key_here            # PersistentConfig: Yes
export DEEPINFRA_TOKEN=$(pass show Passwords/api.deepinfra.com)
OPENAI_API_KEY=$DEEPINFRA_TOKEN

# Default language/locale
# DEFAULT already, but for good measure.
DEFAULT_LOCALE=en-US                                     # PersistentConfig: Yes

# Enable image generation (set to True since DeepInfra supports it)
ENABLE_IMAGE_GENERATION=True                          # PersistentConfig: Yes

# include OLLAMA_BASE_URL since using Ollama locally.
OLLAMA_BASE_URL=http://NAME_OF_LOCAL_HOST_IN_REMOTELY_ACCESSIBLE_FORM:11434  # PersistentConfig: Yes

# ==========================
# Notes:
# - PersistentConfig variables are only read from this file on FIRST LAUNCH.
#   To change them later, use the Open WebUI interface or clear the internal config.
Now ready to try an installation. At a regular bash prompt:

mkdir -p ${HOME}/Tmp/Pip_Cache # outside of tmpfs (which is too small)
TMPDIR="${HOME}"/Tmp/Pip_Cache pipx install open-webui   # Alternatively "--no-cache-dir"
sudo ufw allow 8081

Next, first run including configuration

:::::::::::::: open-webui.init.sh ::::::::::::::

# preload password-repo

# safer, but not support pass calling : Export variables: export $(grep -v '^#' ~/.open-webui/.env | xargs)
source ./open-webui.envish.first_run
export $(grep -v '^#' ./open-webui.env.first_run_lan | xargs)
export $(grep -v '^#' ./open-webui.env | xargs)
echo is DATA_DIR correct?  : $DATA_DIR
open-webui serve --host $WEBUI_HOST --port $WEBUI_PORT
:::::::::::::: open-webui.run.sh ::::::::::::::

# safer, but not support pass calling : Export variables: export $(grep -v '^#' ~/.open-webui/.env | xargs)
export $(grep -v '^#' ./open-webui.env | xargs)
open-webui serve --host $WEBUI_HOST --port $WEBUI_PORT
:::::::::::::: open-webui.upgrade.sh ::::::::::::::

TMPDIR="${HOME}"/Tmp/Pip_Cache pipx upgrade open-webui   # Alternatively "--no-cache-dir"

That is what I did.

How to Identify What Number is Your Font Character

This is a bit of an update / extra information for the information found at http://scripts.sil.org/UTTUsingUnicodeMacros (also archived at the Internet Archive).
It was written in 2005, but I found it still useful.
However, the toolbar icon mentioned in that page was not found in Office 2010.

Below is another method for identifying the computer encoding number associated with a character one has but does not know.

In Windows 7, there is Private Character Editor (eudcedit.exe), which can be started from search box of Start menu.  It requires administrative permissions to run.
Once opened,

  • Select an empty box to open a character editor.
  • Make sure in upper left, Character Set selected is Unicode
  • Select on the menu Edit, then Copy Character
  • Click in the Shape box to activate.
  • Paste in a single unknown character of interest from the Windows clipboard, and the numeric code should be listed above it in hexadecimal.
This was the easiest way I found to identify non-ASCII characters.

The two characters I was looking for were ° (0x00B0) and ℃ (0x2103).

To go from number to display of character to copy, charmap.exe is the program I recommend using.

Method to import contacts from CardMunch to Google Contacts

The script below is my method of importing contacts from CardMunch to Google Contacts.  It could be useful for any address book which imports VCF files.
It automates part of the work, but much still is manual.

CardMunch is an iOS app and service purchased by LinkedIn that digitizes pictures of business cards into an address book, with export (one by one) to iOS contacts, and to e-mail.
Since I am using Google Contacts, I want to automate the transfer as much as possible.  I feel it is still easier than typing cards in by hand, although I am not confident of that.

Method of migrating from old Kapi / Kaddressbook to Google Contacts.

Here is a record of my process of converting, mostly, my old Kaddressbook / Kapi VCard file to Google Contacts.

I have decided to move over to Google contacts as my main address book, at least for a trial stage.

So I needed to get as much of my data from my old address book, Kapi, based on Kabc / Kaddressbook / Kontact.  I used it previously because it was the main one supported by my old organizer, a Sharp Zaurus and on my PC.  I have not had my Zaurus for quite a few years.

So here are my notes from the conversion process, in case anyone else still needs to do this.
It will be of little use to all but a very few.

The majority of the work was done per:
http://kubuntuforums.net/forums/index.php?topic=3113756.0
This was with Debian Python package: python-vobject version 0.8.1c-3

I had to also remove some strings in notes, as Python's replacements in vobject base.py backslashEscape did not like it. 

One issue was a "," in the ORG field.

So trying just "," removal.  Could not do globally, since a VCARD field seperator.
My most common usage was ", Inc.", so replaced that case with "  Inc.".  Would be nice to change only in the ORG rows, but that would require more complexity than I am willing right now.  Instead I did:
in vim, my favorite text editor,
repeatedly:
:/^ORG:.*,/s/,/COMMA/g

I recommend learning the q macro feature of vim, so you can "repeatedly" by just doing "500000@a"

Another issue is "\n" in ADR field
repeatedly:
:/^ADR:.*\\n/s/\\n/ -- /g
:/^ADR;.*\\n/s/\\n/ -- /g
Need to handle " " continued second lines.
Could also remove from all " " continued second lines, even though no issue in NOTE: fields.
:/^ .*\\n/s/\\n/ -- /g
Could instead remove \n from all lines following ADR
/^ADR<CR>s/\\n/ -- /ge<CR>j:s/\\n/ -- /ge
I chose second, as I have many newlines in notes.  Using a q / @ macro made it doable.
The newlines still stayed "\n" in Google though, so not very clean looking.

If it causes problems when split accross lines, that will be harder to catch.
There was one case of it, which the Python errored on.  So I could find it to manually edit.

Also had to clean up leftover bad formatting, most likely from copying and pasting into the addressbook program.
ROLE:Text with extra newline at end\r\n
ROLE:Text with extra newline at end\r\n - More text
ORG:Text with extra newline / return at end\r
TEL;TYPE=home:(###)###-####\r --
N:Family_name\r;Given_name;;;
N:Family_name\n;Given_name;;;
etc.

I just deleted one line of this form, since it did not make sense:
LABEL;TYPE=work:#####\r -- Address Text.

More non-fatal, but data losing issues:
Comma seems also to be an issue in NOTE: ROLE:, TEL, NICKNAME:, and EMAIL:  fields.  It does not error, but it truncates at the comma.

repeatedly:
:/^NOTE:.*,/s/,/COMMA/g
:/^ROLE:.*,/s/,/COMMA/g
:/^TEL.*,/s/,/COMMA/g
:/^NICKNAME.*,/s/,/COMMA/g
:/^ .*,/s/,/COMMA/g
Space may be used in second line of many fields, but few where commas are allowed that I know of.  One that caused problems is CATEGORIES.
So, manually find:
:s/COMMA/,/g
and I hope I caught all of them.

EMAIL is a special case, because used publically.  So instead of "COMMA", change to " ".
repeatedly:
:/^EMAIL:.*,/s/,/ /g

Semicolon seems also to be an issue in NOTE: field, if at end of line, or in the case seen followed be a space at end of line ("; ), that is continued.  It does not error, but it truncates at the semicolon, and adds a \.
Manually edited.

Change X-KADDRESSBOOK-X-IMAddress: to X-JABBER
:/^X-KADDRESSBOOK-X-IMAddress:/s/X-KADDRESSBOOK-X-IMAddress:/X-JABBER:/

Items tried to change, but did not seem to work:

Change X-KADDRESSBOOK-X-Gender: to X-GENDER
:/^X-KADDRESSBOOK-X-Gender:/s/X-KADDRESSBOOK-X-Gender/X-GENDER/

Change X-KADDRESSBOOK-X-Children: to  X-CHILDREN:
:/^X-KADDRESSBOOK-X-Children:/s/X-KADDRESSBOOK-X-Children:/X-CHILDREN:/
Remove commas and semicolons
:/^X-CHILDREN:.*,/s/,/ /g
:/^X-CHILDREN:.*;/s/;/ /g

Here are ones that are not easily converted.  Could add to Note section manually, but too much work for me.
Details: Office
 X-KADDRESSBOOK-X-Office:
Details: Profession
 X-KADDRESSBOOK-X-Profession:
Details: Manager's name
 X-KADDRESSBOOK-X-ManagersName:managers name
Details: Assistant's name
 X-KADDRESSBOOK-X-AssistantsName:assistants name
Misc: Keys: not used by me.
 KEY;TYPE=PGP:
Images: Photo/Logo as URL not tested.
GEO:
 a standard form, seems, but not supported by Google.
Details: Department
 X-KADDRESSBOOK-X-Department:
 often contains commas.
 ORG:organization;department should be used.

Then follow the procedure in
http://kubuntuforums.net/forums/index.php?topic=3113756.0

Once I got an acceptably good vcf file, I deleted all my old Google contacts (from a previous half-hearted import attempt, by going to Google Voice.  There allows deleting all at once, as opposed to contacts.gooogle.com, which only lets one page at a time be deleted.

Then imported the file.
Then lamented how long this took, and that I am still missing data.

Ah, well.  Good enough.

DropBox usage tip: Pseudo-secure sharing

Dropbox is a free 2 Gig cloud file storage service.  It also allows sharing files.

To give a mid level of security, you might consider using the public directory, but adding 8 random characters to the directory name of each share.
Dropbox does not let users see the directory contents, but lets anyone access if they know the full file URL.

If I was to regularly start sharing, I would do something like:
DropBox_Dir/Public/Shared with Company A/2011-11-30-2tVhh2E8/file.zip
which equals download URL http://dl.dropbox.com/u/7099970/Shared%20with%20Company%2A/2011-11-30-2tVhh2E8/file.zip
DropBox_Dir/Public/Shared with Company B/2011-11-30-RrH8HZ5k/file.zip
DropBox_Dir/Public/Shared with Company A/2011-12-01-F7XyvwXj/file.zip
DropBox_Dir/Public/Shared with Company B/2011-12-02-Jh5Ts2GE/file.zip

These would get shortened via dropbox's URL shortener to
http://db.tt/ABCDEFGH , but the expansion would be seen afterward.
A regular pattern would be easy to predict.
Adding a string acts as a password.  The password generator I use is built into the LastPass web browsing plugin, but many are available.

The more hassle option is to have all users join dropbox, and then the sharer selects who to share files / folders with.  For my sharing applications, that was not an option.

Here is my Drop box referral code if you ever want to use it:  http://db.tt/c9XSDu3r.
Enjoy.


Originally posted 11/30/2011 5:12 PM EST.
Updated 2/4/2013 to fix 2 typos.  Also adding note below:
Note creating a db.tt short link decreases security.  It provides a less secure way to access it, although it would be only be discoverable by pure random checking of many short links, not limited to any particular user.

Blog introduction, including how to attach files

Here is a bit of information about getting started with blogging.  To put it another way, this is an introduction to using the free site, BlogSpot, to communicate with people.
The name BlogSpot and Blogger are both used for this service.  BlogSpot is the name of the site, and Blogger is the name of the interface.  However, that is a fuzzy line.  I will just call it all Blogger.  An overview of Blogger is available in the Blogger Getting Started guide at Blogger's Help site.

The main blog sites as of mid-2010 are Blogger, Tumblr, and WordPress.  Blogger is most popular, and the one I would recommend.

Picture Size limits
Blogger has a limit of 1 gigabyte on the total number of pictures on the site.  This is a lot, but not enough that you would want to waste space by putting large high resolution pictures up.  That size space is also shared with the Picasa service, so usage of that service would reduce space available for Blogger.  In any case, high resolution pictures would take up too much screen space on the page.  I might worry slightly about running into the size limit over years and years of posting.  1 Gig could be about 2,000 pictures, which would be little over seven and a half years for five pictures a week.  However, I hope the size limit will go up in the future as storage space gets cheaper and cheaper.  If the time comes that you do run into the limit, two options are to export older blog posts to another site, or to pay for extra storage at Picasa / Google.

Posting
Publishing, also known as posting, is a matter of either going to the host site and typing in the message, or e-mailing a special e-mail address.
I personally feel the most convenient / comfortable ways are to either type up my post in a text editor first and then copy and paste, or to write an email and send it to the posting address.  Configuring so the e-mail can be proofread on the blog site before posting would be good until you are comfortable that messages are transferred in an acceptable way.

Using the e-mail method also gives the option to dual purpose e-mails that are already being written anyway.  For instance, an e-mail being sent to many of your contacts may be good as is to post.  Or it may be good with minor edits, such as deleting the "Hello all," line.  Rather than doubling the work, you can blind-copy (Bcc:) the blog, and then edit on the site if needed.

Categorization
If you want multiple categories of blogs, creating multiple blogs is straightforward.  You can add cross referencing links to the blogs so you only need to share one blog address to allow access to all.
Using labels to create easy access to a subset of a single blog is also straightforward.  You have the option to add labels to each post.  At the bottom of each post the label will appear, and users can click on labels to see only posts with that label.  On the side of the blog a list of links is also available, allowing people to select those posts.  For related content, I would recommend using labels instead of separate blogs.  That one people can see in one continuous timeline and page all the updates. 

Attachments
Blogger does not seem to allow embedding attachments other than pictures and videos.  So to attach items such as PDFs, you need to link to another server.  With many online storage services with sharing ability, this is only an inconvenience, not a road-block.

Since Blogger is Google based, if you are not already using any on-line file storage or back-up systems I recommend using Google documents as the file storage / sharing service.  It has 1 GB storage available in a free account.  If that limit is ever run into, the same solutions above for pictures also apply to files.  In addition, another option would be to sign up for a second file storage account elsewhere, and start filling up that one.  If you ever decide on a service, other than Google's, ask around to others you know for a referral link, as that gets both you and them extra storage space over just signing up individually.

The procedure to write a blog entry with an attachment has multiple steps using Google docs.  First, make the attachment available online via a URL link.  Then reference that link in the blog post.

To make the attachment available:
  • Upload the file to docs.google.com by selecting the upload button next to the create button in the upper right.
  • Select the file.
  • Select the "Share" button (or More, then Share..., then Share...) in the upper right.
  • Select "Change" next to the Private list item.
  • Change from Private to "Anyone with link" (if want not found by search engines) or "Public on the web" (if want widely spread).
  • Save and copy the long URL link.

To use the link in the post: create a URL link in the body of the post / e-mail.  Inserting links is different in every e-mail program, but generally it matches closely to the method in Blogger itself. 
  • Pick a text name for the attachment and type it as part of your message.  For instance: "Here is my most recent letter.", with the link being "most recent letter".
  • Then highlight the part of the text that you want to be the link, and select the "Link" button (often shown as an icon of a chain). 
  • Then you can enter the Web address / URL that you saved from Google Docs above. 
  • Once done, press OK, and you have text that is also a link to the stored file.
Advertising
Advertising on freely hosted blog sites varies by host site. 
Blogger allows ads.  If you use Blogger's (Google's ) optional AdSense program, you are limited a little in what other ads you can use, but not in any way you are likely to run into.  Blogger incorporated Amazon Associates for a while, promoting using specific product referral links so that when people buy those items on Amazon, the blog author gets a commission.  However, in in October, 2011, the built-in option for Amazon was removed from Blogger.
WordPress does allow affiliate links, such as links to Amazon.com, as long as it is kept to a minimum.  In other words, the goal of the site is not advertising that content.  However, I have no way of knowing how reliable WordPress's automated systems are in making distinctions.

Closing
Many non-technical people now use blogs as a main way to communicate.  It is both an effective way to send messages to many you know, possibly interact with people you never know about, and to have a public record for yourself and others.  It is much easier and reliable than the old self-hosted or server hosted web site methods. 

I hope this is information is useful.  If you know of other blogging overviews or introductions that you would recommend, feel free to mention them in the comments.