pisignage-server Documentation

repository·master·Indexed 19 days ago

https://github.com/colloqi/pisignage-server

A management server for controlling piSignage players within a LAN or private network. Version 3.2.0a provides features for player discovery, group management, playlist scheduling, and asset processing including video conversion via ffmpeg and thumbnail generation. It supports deployment via Docker Compose or manual installation on Linux, utilizing MongoDB for data persistence and offering real-time communication via Socket.io and WebSockets.

Tokens
3.2K
Snippets
7
Records
12
Agent score
66%

What's inside pisignage-server

  1. pisignage-server Features Overview

    master

    The server provides management capabilities for digital signage deployments:

    Player Management

    • Auto-discovery of players on the local network.
    • Real-time player monitoring.

    Group Management

    • Create groups and assign players to them.
    • Configure display settings (1080p/720p, landscape/portrait).
    • Deploy default, scheduled, or advertisement playlists to groups.

    Asset Management

    • Support for video, mp3, html/zip, images, links, and Google Calendar feeds.
    • Automatic Processing: Videos are converted to .mp4 using ffmpeg; thumbnails and metadata are extracted automatically.
    • Organization: Add labels to assets, rename/delete files, and view file details.

    Playlist Management

    • Create, rename, and delete playlists.
    • Drag-and-drop asset ordering.
    • Set custom durations for non-video assets.
    • Select layouts (e.g., 1, 2a, 2b, 3a, 3b, 4, 4b, 2ab).
    • Enable tickers with custom text.
    • Create advertisement playlists with configurable interval timers.
  2. Manage the pisignage systemd service

    master

    Once the service file is created, use the following systemctl commands to manage the pisignage service:

    • Reload systemd configuration: Run this after creating or modifying the .service file.
    • Start the service: Starts the server immediately.
    • Check status: Verifies if the service is active (running) and shows PID/resource usage.
    • Enable auto-start: Configures the service to start automatically on system boot.
    • Stop the service: Shuts down the server.
    • View logs: Use journalctl to inspect the service logs.
    # Reload systemd to recognize the new service
    systemctl daemon-reload
    
    # Start the service
    sudo systemctl start pisignage
    
    # Check if the service is running properly
    sudo systemctl status pisignage
    
    # Enable the service to start on boot
    sudo systemctl enable pisignage
    
    # Stop the service
    sudo systemctl stop pisignage
    
    # View the last 200 lines of the service log
    sudo journalctl -u pisignage.service -n 200
  3. Install and run pisignage-server manually

    master

    To run the server directly on your host machine, follow these steps:

    1. Prerequisites

    Ensure the following are installed on your system:

    • MongoDB: The open-source document database.
    • Node.js and npm: The server framework.
    • ffmpeg: For video conversion (requires ffprobe for metadata extraction).
    • ImageMagick: For image editing and thumbnail creation.
    • Git: For version control.

    2. Setup Steps

    1. Clone the repository:
      git clone https://github.com/colloqi/pisignage-server
    2. Create required media directories:
      mkdir media
      mkdir media/_thumbnails
    3. Install dependencies:
      cd pisignage-server
      npm install

    3. Configuration and Execution

    • Port Configuration: The default port is 3000. To change it, modify config/env/development.js.
    • Run the server:
      node server.js
    • Access the UI: Open http://localhost:3000 or http://[your-ip]:3000 in a browser.

    4. Post-Installation Configuration

    • Authentication: Default credentials are pi / pi. Change these in the Settings tab.
    • License/User Sync: Under Settings, configure the username to match your sign-in username at pisignage.com (use your username, not your email ID) to enable player licenses.
    • Upload Licenses: Download license files from pisignage.com and upload them via the Settings tab.
    git clone https://github.com/colloqi/pisignage-server
    mkdir media
    mkdir media/_thumbnails
    cd pisignage-server
    npm install
    node server.js
  4. Configure pisignage-server as a systemd service

    master

    To ensure the pisignage-server starts automatically on Linux systems using systemd after a reboot, create a service file at /etc/systemd/system/pisignage.service.

    Configuration Details

    • User/Group: By default, the example uses the pisignage user. To run the server as root, comment out the User and Group lines.
    • Dependencies: The After=mongodb.service directive ensures the server waits for MongoDB to be running before starting.
    • Environment Variables: You can set NODE_ENV and PORT within the [Service] section.
    • Logging: The example redirects output to /var/log/pisignage.log via the ExecStart command.
    [Unit]
    Description=pisignage Player -  Server Software
    #Include the After directive to make sure mongodb is running
    After=mongodb.service
    
    [Service]
    # Key `User` specifies that the server will run under the pisignage user
    # Hash User & Group out if you want root to run it
    #User=pisignage
    #Group=pisignage
    Restart=always
    RestartSec=10
    WorkingDirectory=/root/pisignage-server
    ExecStart=/usr/bin/node /root/pisignage-server/server.js >> /var/log/pisignage.log 2>&1
    #StandardOutput=
    #StandardError=/var/log/pisignageserver.log
    Environment=NODE_ENV=development PORT=3000
    [Install]
    WantedBy=multi-user.target
  5. Install pisignage-server via Docker

    master

    You can run the server using Docker Compose. This is a beta feature.

    1. Install Docker and Git.
    2. Clone the repository: git clone https://github.com/colloqi/pisignage-server.
    3. Navigate to the directory containing docker-compose.yml.
    4. Run docker compose up -d.
    5. Access the web application at http://localhost:3000.

    Default Credentials:

    • Username: pi
    • Password: pi

    Note for custom builds: To generate your own image, use the docker-build branch and modify the Dockerfile. Use docker-compose.prod.yml for production environments.

    git clone https://github.com/colloqi/pisignage-server
    cd pisignage-server
    docker compose up -d
  6. Upgrade pisignage-server to the latest version

    master

    Follow these steps to upgrade an existing installation:

    1. Navigate to your existing pisignage-server directory.
    2. Pull the latest code: git pull origin master.
      • IMPORTANT: If you are updating from a version older than 24 Nov 2016, you must change the uri variable in config/env/development.js to 'mongodb://localhost/pisignage-dev' to prevent data loss.
    3. Apply any local code changes.
    4. Clean up old dependencies:
      rm package-lock.json
      rm -rf node_modules
    5. Reinstall dependencies: npm install.
    6. Start the server and access localhost:3000.
    7. Verify Settings: Ensure your username (not email) matches your pisignage.com username in the settings to keep player licenses active.
    git pull origin master
    rm package-lock.json
    rm -rf node_modules
    npm install
  7. Configure a piSignage Player to connect to the server

    master

    After booting your player (e.g., Raspberry Pi), you must point it to your local server's address and port. The server address in player settings must include the port (e.g., 192.168.1.12:3000).

    Method A: Web UI

    Access the player's local web interface at http://[player-ip]:8000/settings and configure the admin and media server URLs.

    Method B: Physical Keyboard

    1. Connect a keyboard to the player.
    2. Press Ctrl-N or F6.
    3. Change the config and media server to http://[your-server-ip]:[port] (e.g., http://192.168.1.30:3000).
    4. Open a terminal using Ctrl+Alt+T and delete any existing _config.json and _settings.json files located in /home/pi/piSignagePro/config.

    Method C: SSH

    1. Connect via SSH.
    2. Edit /home/pi/piSignagePro/package.json to set the admin and media server configuration.
    3. Delete any existing _config.json and _settings.json files in /home/pi/piSignagePro/config.
  8. Initialize and run the pisignage-server

    master

    The server.js file serves as the main entrypoint for the application. When executed, it performs the following bootstrap sequence:

    1. Environment Setup: Sets NODE_ENV to development if not already specified.
    2. Database Connection: Connects to MongoDB using the URI defined in config/config.js. If the connection fails, the process exits with code 1.
    3. Directory Creation: Ensures required application directories exist: releasesDir, licenseDir, syncDir, and thumbnailDir.
    4. Model Bootstrapping: Automatically loads all Mongoose models located in app/models.
    5. Express Configuration: Initializes the Express application and applies settings from ./config/express.
    6. Server Protocol: Starts either an HTTP or HTTPS server based on the config.https setting. If HTTPS is enabled, it expects pisignage-server-key.pem and pisignage-server-cert.pem to be present in the root directory.
    7. Socket Initialization: Sets up multiple real-time communication channels (Socket.io and WebSockets).
    8. Scheduler: Starts the internal scheduler service.

    To run the server, ensure your MongoDB instance is running and your configuration files are correctly set up.

  9. Deploy pisignage-server using Docker Compose

    master

    You can deploy the pisignage-server stack using Docker Compose. The setup includes the main application service and a MongoDB instance for data persistence.

    Service Details:

    • pisignage-server: Runs on port 3000. It depends on the mongo service.
    • mongo: Runs version 5.0 and exposes port 27017.

    Persistent Volumes: To ensure data is not lost when containers are stopped or removed, the following volumes are used:

    • mongodb: Stores the database files (/data/db).
    • mongodb_config: Stores MongoDB configuration (/data/configdb).
    • media: Stores media assets used by the signage server (/media).
    • data: Stores application-specific data (/data).
    version: '3'
    services:
      mongo:
        image: mongo:5.0
        restart: unless-stopped
        ports:
          - 27017:27017
        volumes:
          - mongodb:/data/db
          - mongodb_config:/data/configdb
      pisignage-server:
        image: pisignage/pisignage-server:latest
        restart: unless-stopped
        ports:
          - 3000:3000
        volumes:
          - media:/media
          - data:/data
        depends_on:
          - mongo
    
    volumes:
      mongodb:
      mongodb_config:
      media:
      data:
  10. Exported Application Instance

    master

    The server.js file exports the Express app instance. This allows the application to be imported and used within other Node.js modules or testing frameworks.

    const app = require('./server.js');
    // Use the app instance for testing or integration
    const app = require('./server.js');
  11. Available Real-time Communication Endpoints

    master

    The server exposes several distinct paths for real-time communication using Socket.io and WebSockets. Depending on the client requirements, you should connect to one of the following:

    ProtocolPathDescription
    Socket.io (Legacy)/ (default)Managed by server-socket controller.
    Socket.io (New)/newsocket.ioManaged by server-socket-new controller.
    Socket.io (WS Only)/wssocket.ioOptimized for WebSocket-only connections via server-socket-new.
    WebSocket/websocket or /WebSocketStandard WebSocket protocol managed by server-socket-ws.

    Socket.io (New) Configuration Details:

    • pingInterval: 45000ms
    • pingTimeout: 45000ms (or 180000ms for the WS-only path)
    • upgradeTimeout: 60000ms (or 180000ms for the WS-only path)
    • maxHttpBufferSize: 100MB (10e7)