diff --git a/docker-compose.headless.yml b/docker-compose.headless.yml
deleted file mode 100644
index 57d8828..0000000
--- a/docker-compose.headless.yml
+++ /dev/null
@@ -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
diff --git a/docs/setup-run-headless.md b/docs/setup-run-headless.md
index ccf5961..ca2d570 100644
--- a/docs/setup-run-headless.md
+++ b/docs/setup-run-headless.md
@@ -11,11 +11,15 @@
Using docker run
-- โ ๏ธ `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
System-wide
#### 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
-```
---
-## ๐ 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
```
diff --git a/docs/setup-run-on-rpi.md b/docs/setup-run-on-rpi.md
index 59c2178..777f9cb 100644
--- a/docs/setup-run-on-rpi.md
+++ b/docs/setup-run-on-rpi.md
@@ -17,23 +17,26 @@
Using docker run
-- โ ๏ธ `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
System-wide (recommended)
#### 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
diff --git a/system/install-autorun-rpi.sh b/system/install-player-rpi.sh
similarity index 88%
rename from system/install-autorun-rpi.sh
rename to system/install-player-rpi.sh
index 8f00f30..82d6e0a 100755
--- a/system/install-autorun-rpi.sh
+++ b/system/install-player-rpi.sh
@@ -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
diff --git a/system/install-studio.sh b/system/install-studio.sh
new file mode 100755
index 0000000..80e72c4
--- /dev/null
+++ b/system/install-studio.sh
@@ -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