Skip to content

sergiobaiao/guest-portal

 
 

Repository files navigation

UniFi Guest Portal

CC-BY-4.0 GitHub Workflow Status GitHub Packages Docker Hub

Usage

Docker Compose

Here's a template docker-compose.yml file:

version: "3.7"
services:

  backend:
    image: carlgo11/guest-portal:backend
    restart: unless-stopped
    read_only: true
    tmpfs:
      - /tmp
    env_file:
      - mysql.env
      - unifi.env

  frontend:
    image: carlgo11/guest-portal:frontend
    restart: unless-stopped
    user: nginx
    volumes:
      - "./bg.jpg:/guest-portal/public/img/bg/bg.jpg:ro"
    read_only: true
    tmpfs:
      - /tmp
      - /guest-portal/public/img/bg/
    ports:
      - "8080:8080"
    env_file:
      - unifi.env

  mysql:
    image: linuxserver/mariadb
    restart: unless-stopped
    volumes:
      - "mysql:/var/lib/mysql"
      - "./db-template.sql:/config/initdb.d/db.sql:ro"
    environment:
      MYSQL_ROOT_PASSWORD: password
    env_file:
      - mysql.env

volumes:
  mysql:

Background images

The site fetches bg.jpg from /guest-portal/public/img/bg/ in the Docker container and converts it into JPEG, AV1 and WebP images in different resolutions.

Link to an appropriate image (preferably larger than 1920x1080) as bg.jpg before starting the frontend container. In the example docker-compose.yml above, bg.jpg is placed in the same directory as the Docker compose file.

Environment variables

Name Default Description Example Used By
MYSQL_HOST mysql MySQL server hostname/IP mysql/127.0.0.1 Backend, MySQL
MYSQL_PORT 3306 MySQL server port 3306 Backend, MySQL
MYSQL_USER MySQL username guest-portal Backend, MySQL
MYSQL_PASSWORD MySQL password password Backend, MySQL
MYSQL_DATABASE MySQL database name guest-portal Backend, MySQL
UNIFI_USER UniFi Hotspot username guest-portal Backend
UNIFI_PASSWORD UniFi Hotspot password password Backend
UNIFI_URL UniFi Controller IP/URL & port https://192.168.1.2 Backend
UNIFI_SITE default UniFi Site default Backend, Frontend
UNIFI_VERSION 6.0.0 Controller version 6.0.44 Backend
LANG en Language pack to use en Backend
DATABASE mysql Storage method. (MySQL/Redis) mysql Backend

Example portal showcase

License

This work is licensed under the GPLv3.
To view a copy of this license, visit LICENSE.

About

External UniFi guest portal

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 57.0%
  • Twig 20.0%
  • JavaScript 13.4%
  • CSS 8.0%
  • Shell 1.6%