check doc

This commit is contained in:
jr-k 2024-07-22 01:00:18 +02:00
parent 06c186b970
commit 32ee7378e9
5 changed files with 92 additions and 109 deletions

View File

@ -1,14 +0,0 @@
services:
webapp:
container_name: obscreen
restart: unless-stopped
image: jierka/obscreen:latest
environment:
- DEBUG=false
- PORT=5000
- SECRET_KEY=ANY_SECRET_KEY_HERE
volumes:
- ./data/db:/app/data/db
- ./data/uploads:/app/data/uploads
ports:
- 5000:5000

View File

@ -11,11 +11,15 @@
<details closed>
<summary><h3>Using docker run</h3></summary>
- ⚠️ `docker ... --rm` option is not suitable for production use because it won't survive a reboot. However, it's okay for quick testing. You need to use --restart=always instead to ensure that it persists.
```bash
# (Optional) Install docker if needed
curl -sSL get.docker.com | sh && sudo usermod -aG docker $(whoami) && logout # then login again
curl -sSL get.docker.com | sh && sudo usermod -aG docker $(whoami) && logout
# ....then login again
```
---
```bash
# Prepare application data file tree
cd ~ && mkdir -p obscreen/data/db obscreen/data/uploads && cd obscreen
@ -27,7 +31,6 @@ docker run --restart=always --name obscreen --pull=always \
-p 5000:5000 \
-v ./data/db:/app/data/db \
-v ./data/uploads:/app/data/uploads \
-v /dev/null:/app/var/run/play \
jierka/obscreen:latest
```
@ -43,7 +46,7 @@ docker run --restart=always --name obscreen --pull=always \
cd ~ && mkdir -p obscreen/data/db obscreen/data/uploads && cd obscreen
# Download docker-compose.yml
curl https://raw.githubusercontent.com/jr-k/obscreen/master/docker-compose.headless.yml > docker-compose.yml
curl https://raw.githubusercontent.com/jr-k/obscreen/master/docker-compose.yml > docker-compose.yml
# Run
docker compose up --detach --pull=always
@ -57,56 +60,23 @@ docker compose up --detach --pull=always
<summary><h3>System-wide</h3></summary>
#### Install
- Install studio by executing following script
```bash
# Install system dependencies
sudo apt-get update
sudo apt-get install -y git python3-pip python3-venv libsqlite3-dev
# Get files
cd ~ && git clone https://github.com/jr-k/obscreen.git && cd obscreen
# Install application dependencies
python3 -m venv venv
source ./venv/bin/activate
# 🚨For MacOS users, requirements installation may cause an error but it's ok if only for pysqlite3 package
# you'll need to install brew and execute command `brew install sqlite3`
pip install -r requirements.txt
# Customize server default values
cp .env.dist .env
curl -fsSL https://raw.githubusercontent.com/jr-k/obscreen/master/system/install-studio.sh -o /tmp/install-studio.sh && chmod +x /tmp/install-studio.sh && sudo /bin/bash /tmp/install-studio.sh $USER $HOME
sudo reboot
```
#### Configure
- Server configuration is editable in `.env` file.
- Application configuration will be available at `http://localhost:5000/settings` page after run.
- Check logs with `journalctl -u obscreen-studio -f`
#### Start server
> ⚠️ Not suitable for production use because it won't survive a reboot. However, it's okay for quick testing. You need to use `systemd` (detailed in next section) to ensure that it persists.
```bash
python ./obscreen.py
```
#### Start server forever with systemd
```bash
cat "$(pwd)/system/obscreen-studio.service" | sed "s#/home/pi#$HOME#g" | sed "s#=pi#=$USER#g" | sudo tee /etc/systemd/system/obscreen-studio.service
sudo systemctl daemon-reload
sudo systemctl enable obscreen-studio.service
sudo systemctl start obscreen-studio.service
```
#### Troubleshoot
```bash
# Watch logs with following command
sudo journalctl -u obscreen-studio -f
```
---
</details>
## 🏁 Finally
- Run `sudo systemctl restart obscreen-studio` or `sudo reboot`
## 👌 Usage
- Page which plays slideshow is reachable at `http://localhost:5000`
@ -121,7 +91,7 @@ sudo journalctl -u obscreen-studio -f
#### How to install
- Install player autorun by executing following script (will install chromium, x11, pulseaudio and obscreen-player systemd service)
```bash
curl -fsSL https://raw.githubusercontent.com/jr-k/obscreen/master/system/install-autorun-rpi.sh -o /tmp/install-autorun-rpi.sh && chmod +x /tmp/install-autorun-rpi.sh && sudo /bin/bash /tmp/install-autorun-rpi.sh $USER $HOME
curl -fsSL https://raw.githubusercontent.com/jr-k/obscreen/master/system/install-player-rpi.sh -o /tmp/install-player-rpi.sh && chmod +x /tmp/install-player-rpi.sh && sudo /bin/bash /tmp/install-player-rpi.sh $USER $HOME
sudo reboot
```

View File

@ -17,23 +17,26 @@
<details closed>
<summary><h3>Using docker run</h3></summary>
- ⚠️ `docker ... --rm` option is not suitable for production use because it won't survive a reboot. However, it's okay for quick testing. You need to use --restart=always instead to ensure that it persists.
```bash
# (Optional) Install docker if needed
curl -sSL get.docker.com | sh && sudo usermod -aG docker $(whoami) && logout # then login again
curl -sSL get.docker.com | sh && sudo usermod -aG docker $(whoami) && logout
# ....then login again
```
---
```bash
# Prepare application data file tree
cd ~ && mkdir -p obscreen/data/db obscreen/data/uploads && cd obscreen
# Run the Docker container
docker run --rm --name obscreen --pull=always \
docker run --restart=always --name obscreen --pull=always \
-e DEBUG=false \
-e PORT=5000 \
-e SECRET_KEY=ANY_SECRET_KEY_HERE \
-p 5000:5000 \
-v ./data/db:/app/data/db \
-v ./data/uploads:/app/data/uploads \
-v ./var/run/play:/app/var/run/play \
jierka/obscreen:latest
```
@ -46,7 +49,7 @@ docker run --rm --name obscreen --pull=always \
```bash
# Prepare application data file tree
cd ~ && mkdir -p obscreen/data/db obscreen/data/uploads obscreen/system && cd obscreen
cd ~ && mkdir -p obscreen/data/db obscreen/data/uploads && cd obscreen
# Download docker-compose.yml
curl https://raw.githubusercontent.com/jr-k/obscreen/master/docker-compose.yml > docker-compose.yml
@ -63,49 +66,17 @@ docker compose up --detach --pull=always
<summary><h3>System-wide (recommended)</h3></summary>
#### Install
- Install studio by executing following script
```bash
# Install system dependencies
sudo apt-get update
sudo apt-get install -y git python3-pip python3-venv libsqlite3-dev exfat-fuse ntfs-3g
# Get files
cd ~ && git clone https://github.com/jr-k/obscreen.git && cd obscreen
# Install application dependencies
python3 -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt
# Customize server default values
cp .env.dist .env
curl -fsSL https://raw.githubusercontent.com/jr-k/obscreen/master/system/install-studio.sh -o /tmp/install-studio.sh && chmod +x /tmp/install-studio.sh && sudo /bin/bash /tmp/install-studio.sh $USER $HOME
sudo reboot
```
#### Configure
- Server configuration is editable in `.env` file.
- Application configuration will be available at `http://raspberrypi.local:5000/settings` page after run.
#### Start server
> ⚠️ Not suitable for production use because it won't survive a reboot. However, it's okay for quick testing. You need to use `systemd` (detailed in next section) to ensure that it persists.
```bash
python ./obscreen.py
```
#### Start server forever with systemctl
```bash
cat "$(pwd)/system/obscreen-studio.service" | sed "s#/home/pi#$HOME#g" | sed "s#=pi#=$USER#g" | sudo tee /etc/systemd/system/obscreen-studio.service
sudo systemctl daemon-reload
sudo systemctl enable obscreen-studio.service
sudo systemctl start obscreen-studio.service
```
#### Troubleshoot
```bash
# Watch logs with following command
sudo journalctl -u obscreen-studio -f
```
## 🏁 Finally
- Run `sudo systemctl restart obscreen-studio` or `sudo reboot`
- Check logs with `journalctl -u obscreen-studio -f`
---
@ -124,7 +95,8 @@ sudo journalctl -u obscreen-studio -f
#### How to install
- Install player autorun by executing following script (will install chromium, x11, pulseaudio and obscreen-player systemd service)
```bash
curl -fsSL https://raw.githubusercontent.com/jr-k/obscreen/master/system/install-autorun-rpi.sh -o /tmp/install-autorun-rpi.sh && chmod +x /tmp/install-autorun-rpi.sh && sudo /bin/bash /tmp/install-autorun-rpi.sh $USER $HOME
curl -fsSL https://raw.githubusercontent.com/jr-k/obscreen/master/system/install-player-rpi.sh -o /tmp/install-player-rpi.sh && chmod +x /tmp/install-player-rpi.sh && sudo /bin/bash /tmp/install-player-rpi.sh $USER $HOME
sudo reboot
```
#### How to restart

View File

@ -59,10 +59,10 @@ sleep 3
# Update and install necessary packages
apt update
apt install -y xinit xserver-xorg chromium-browser unclutter pulseaudio exfat-fuse ntfs-3g
apt install -y xinit xserver-xorg chromium-browser unclutter pulseaudio
# Add user to tty, video and plugdev groups
usermod -aG tty,video,plugdev $OWNER
# Add user to tty, video groups
usermod -aG tty,video $OWNER
# Configure Xwrapper
touch /etc/X11/Xwrapper.config
@ -72,12 +72,6 @@ grep -qxF "needs_root_rights=yes" /etc/X11/Xwrapper.config || echo "needs_root_r
# Create the systemd service to start Chromium in kiosk mode
curl https://raw.githubusercontent.com/jr-k/obscreen/master/system/obscreen-player.service | sed "s#/home/pi#$WORKING_DIR#g" | sed "s#=pi#=$OWNER#g" | tee /etc/systemd/system/obscreen-player.service
# Configure external storage automount
curl https://raw.githubusercontent.com/jr-k/obscreen/master/system/external-storage/10-obscreen-media-automount.rules | sed "s#/home/pi#$WORKING_DIR#g" | tee /etc/udev/rules.d/10-obscreen-media-automount.rules
udevadm control --reload-rules
systemctl restart udev
udevadm trigger
# Reload systemd, enable and start the service
systemctl daemon-reload
systemctl enable obscreen-player.service

61
system/install-studio.sh Executable file
View File

@ -0,0 +1,61 @@
#!/bin/bash
OWNER=${1:-$USER}
WORKING_DIR=${2:-$HOME}
echo "# ==============================="
echo "# Installing Obscreen Studio"
echo "# Using user: $OWNER"
echo "# Working Directory: $WORKING_DIR"
echo "# ==============================="
# ============================================================
# Installation
# ============================================================
echo ""
echo "# Waiting 3 seconds before installation..."
sleep 3
# Install system dependencies
sudo apt-get update
sudo apt-get install -y git python3-pip python3-venv libsqlite3-dev exfat-fuse ntfs-3g
# Get files
cd $WORKING_DIR
git clone https://github.com/jr-k/obscreen.git
cd obscreen
# Install application dependencies
python3 -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt
# Customize server default values
cp .env.dist .env
# Add user to needed group
usermod -aG plugdev $OWNER
# ============================================================
# Automount script for external storage
# ============================================================
curl https://raw.githubusercontent.com/jr-k/obscreen/master/system/external-storage/10-obscreen-media-automount.rules | sed "s#/home/pi#$WORKING_DIR#g" | tee /etc/udev/rules.d/10-obscreen-media-automount.rules
udevadm control --reload-rules
systemctl restart udev
udevadm trigger
# ============================================================
# Systemd service installation
# ============================================================
cat "./system/obscreen-studio.service" | sed "s#/home/pi#$HOME#g" | sed "s#=pi#=$USER#g" | sudo tee /etc/systemd/system/obscreen-studio.service
sudo systemctl daemon-reload
sudo systemctl enable obscreen-studio.service
# ============================================================
# Start
# ============================================================
sudo systemctl restart obscreen-studio.service