commit (install\_software.sh): update script to install nvidia-container-toolkit, docker-compose and opencommit
In this commit, I updated the install\_software.sh script to include the installation of nvidia-container-toolkit, docker-compose, and opencommit. The script now checks if these packages are already installed using the `command -v` command and installs them if they are not present. Additionally, it adds a new service 'ollama' in ollama-stack.yaml file for running ollama container with the latest image. Also, I added a new script named record\_screen.sh which records the screen and camera using ffmpeg with nvidia acceleration. The script uses h264\_nvenc as video codec to take advantage of NVIDIA GPU for encoding. It also sets the video size to 640x480 and frames per second to 30. Lastly, I added a new file named ollama-stack.yaml which defines the services and volumes for running ollama and open-webui containers using docker-compose. The ollama service listens on port 11434 and maps the volume to /root/.ollama. The open-webui service listens on port 8080 and maps the volume to /app/backend/data. It also sets the OLLAMA\_BASE\_URL environment variable for open-webui to point to ollama container's IP address and port number.
This commit is contained in:
parent
86af034ed6
commit
d46662d787
|
@ -1,17 +1,45 @@
|
|||
#!/bin/bash
|
||||
# for nvidia-container-toolkit
|
||||
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
|
||||
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
|
||||
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
|
||||
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
|
||||
# for nodejs/opencommit
|
||||
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
|
||||
|
||||
# apt packages
|
||||
sudo nala update
|
||||
sudo nala install -y \
|
||||
mpv `# for video playing` \
|
||||
sxiv `# for pictures` \
|
||||
strace `# for tracing` \
|
||||
docker.io `# containers` \
|
||||
docker-compose `# containers` \
|
||||
nvidia-container-toolkit `# containers` \
|
||||
nodejs `# for opencommit`
|
||||
|
||||
# this is needed for pavucontrol working not under sudo only
|
||||
for group in audio pulse-access pulse
|
||||
sudo nvidia-ctk runtime configure --runtime=docker --set-as-default
|
||||
sudo service docker restart
|
||||
sudo docker stack deploy -c ollama-stack.yaml ollama
|
||||
|
||||
# this is needed for pavucontrol/docker working not under sudo only
|
||||
for group in audio pulse-access pulse docker
|
||||
do
|
||||
sudo usermod -a -G $group $USER
|
||||
done
|
||||
|
||||
# install opencommit
|
||||
if ! command -v opencommit &> /dev/null
|
||||
then
|
||||
git clone --depth 1 https://git.digitalstudium.com/digitalstudium/opencommit.git
|
||||
cd opencommit
|
||||
npm pack
|
||||
sudo npm install -g opencommit-3.0.11.tgz
|
||||
cd -
|
||||
rm -rf opencommit
|
||||
oco config set OCO_AI_PROVIDER=ollama
|
||||
fi
|
||||
|
||||
# install ffmpeg with nvidia
|
||||
if ! command -v ffmpeg &> /dev/null
|
||||
then
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
version: '3.9'
|
||||
|
||||
services:
|
||||
ollama:
|
||||
image: ollama/ollama:latest
|
||||
ports:
|
||||
- 11434:11434
|
||||
volumes:
|
||||
- ollama:/root/.ollama
|
||||
|
||||
open-webui:
|
||||
image: ghcr.io/open-webui/open-webui:main
|
||||
ports:
|
||||
- 3000:8080
|
||||
volumes:
|
||||
- open-webui:/app/backend/data
|
||||
environment:
|
||||
- 'OLLAMA_BASE_URL=http://ollama:11434'
|
||||
|
||||
volumes:
|
||||
ollama: {}
|
||||
open-webui: {}
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/bash
|
||||
export LD_LIBRARY_PATH=/usr/local/lib
|
||||
ffmpeg -hwaccel cuda -hwaccel_output_format cuda `# we need nvidia acceleration because of low fps without it` \
|
||||
-f x11grab -r 30 -video_size 1920x1080 -i :0 `# this is screen` \
|
||||
-f v4l2 -r 30 -video_size 640x480 -i /dev/video0 `# this is camera` \
|
||||
-f alsa -i default `# this is audio. Why not pulse? Nvidia?` \
|
||||
ffmpeg -vsync 0 -hwaccel cuda -hwaccel_output_format cuda `# we need nvidia acceleration because of low fps without it` \
|
||||
-r 30 -video_size 640x480 -i /dev/video0 `# this is camera` \
|
||||
-f alsa -i default -async 1 `# this is audio. Why not pulse? Nvidia?` \
|
||||
-c:v h264_nvenc `# this is video codec` \
|
||||
-filter_complex "[0][1]overlay=main_w-overlay_w-2:main_h-overlay_h-2[v]" -map [v] -map 2 `# this is for placing camera in bottom right corner. IDK how it works` \
|
||||
video.mp4 # output file
|
||||
#-filter_complex 'overlay=main_w-overlay_w:main_h-overlay_h' `# this is overlay` \
|
||||
#-f x11grab -framerate 30 -video_size 1920x1080 -i :0 `# this is screen` \
|
||||
|
|
Loading…
Reference in New Issue