Skip to content

Manual Installation

Charlie Algert edited this page Feb 7, 2025 · 2 revisions

Install

Docker is the easiest and fastest way to deploy. Below is a docker-compose.yml file that will create a stack with both the application and a database. Just run the compose and you will have everything you need. If you prefer to use a separate database, you can either just spin up the container on its own from the image or use the docker-compose-without-database.yml in the repository.

Quick Start:
  1. Ensure you have Docker and Docker compose installed on your system.

  2. In a new directory, create a file named docker-compose.yml and paste in the content below, changing the variables to the passwords you would like to use.

  3. Create three new directories / folders in this directory called "config", "storage", and "auth". These will ensure that your data is saved separately and not lost during updates.

  4. Download the required database schema: curl -O https://raw.githubusercontent.com/algertc/ALPR-Database/refs/heads/main/schema.sql Or, if you prefer a download link, click here to download the schema from this repository. Place it in the same directory as your docker-compose.yml.

  5. Start the application: docker compose up -d

  6. Access the application at http://localhost:3000

Docker Compose

services:
  app:
    image: algertc/alpr-dashboard:latest
    restart: unless-stopped
    ports:
      - "3000:3000" # Change the first port to the port you want to expose
    environment:
      - NODE_ENV=production
      - ADMIN_PASSWORD=password # Change this to a secure password
      - DB_PASSWORD=password # Change this to match your postgres password
      - TZ=	America/Los_Angeles # Change this to match your time zone. Time zones can be found here https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
    depends_on:
      - db
    volumes:
      - app-auth:/app/auth
      - app-config:/app/config
      - app-plate_images:/app/storage
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"

  db:
    image: postgres:13
    restart: unless-stopped
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=password # Change this to a secure password
      - TZ=	America/Los_Angeles # Change this to match your time zone. Time zones can be found here https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
    volumes:
      - db-data:/var/lib/postgresql/data
      - ./schema.sql:/docker-entrypoint-initdb.d/schema.sql
      - ./migrations.sql:/migrations.sql

    # Make sure you download the migrations.sql file if you are updating your existing database. If you changed the user or database name, you will need to plug that in in the command below.
    command: >
      bash -c "
        docker-entrypoint.sh postgres &
        until pg_isready; do sleep 1; done;
        psql -U postgres -d postgres -f /migrations.sql;
        wait
      "
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  db-data:
  app-auth:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: ./auth
  app-config:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: ./config
  app-plate_images:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: ./storage
Clone this wiki locally