Lookout v0.1 Installation

Aus Laub-Home Wiki
This content is not maintained anymore:
Der Inhalt dieser Seite ist veraltet, der Inhalt nicht mehr korrekt, oder das Projekt wird nicht mehr weiter fortgeführt. Bei Fragen, bitte an den Author wenden.
Vielen Dank.

Lookout Installation v.0.1

You have to edit the lookout.sql script before you run it! Please change lookoutpass to a secure password and make sure you changed it in /lib/config.inc.php, too.

Configure Apache Webserver and PHP

User for the admin interface

first we need the htdigest user, for the admin interface:

htdigest /etc/apache2/htdigestuser.pwd "HTTP Digest Access" lookout

if the htdigestuser.pwd file doesn't exist, use the -c parameter to create the file:

htdigest -c /etc/apache2/htdigestuser.pwd "HTTP Digest Access" lookout

At least we have to enable the htdigest apache module:

a2enmod auth_digest

For more Informations look at Apache htdigest Authentifizierung

Own virtual host for lookout

first we create the lookout home directory:

mkdir -p /srv/httpd/vhosts/lookout.domain.local/

now we need the virtual host configuration file:
/etc/apache2/sites-available/lookout.domain.local

<VirtualHost *:80>
        ServerName lookout.domain.local
        DocumentRoot /srv/httpd/vhosts/lookout.domain.local/htdocs/
        ErrorDocument 403 http://lookout.domain.local
        ErrorDocument 404 http://lookout.domain.local
        <Directory /srv/httpd/vhosts/lookout.domain.local/>
                Options -Indexes FollowSymLinks -Includes -MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                <Files admin.php>
                        AuthType Digest
                        AuthName "HTTP Digest Access"
                        AuthDigestProvider file
                        AuthUserFile /etc/apache2/htdigestuser.pwd
                        Require user lookout
                </Files>
        </Directory>
        ErrorLog /var/log/apache2/lookout.domain.local-error.log
        CustomLog /var/log/apache2/lookout.domain.local-access.log combined
        LogLevel warn
</VirtualHost>

Change lookout.domain.local to the name of your Full Qualified Domain Name, for example lookout.laub-home.de
to enable the new created vhost type:

a2ensite lookout.domain.local
/etc/init.d/apache2 restart

lookout in an existing virtual host

if you want to use lookout under an existing virtual host, so you can reach it by typing lookout.domain.local/lookout/, you have to edit your vhost configuration. Paste something like this in it:

<Directory /srv/httpd/vhosts/lookout.domain.local/lookout/>
      Options -Indexes FollowSymLinks -Includes -MultiViews
      AllowOverride None
      Order allow,deny
      allow from all
      <Files admin.php>
             AuthType Digest
             AuthName "HTTP Digest Access"
             AuthDigestProvider file
             AuthUserFile /etc/apache2/htdigestuser.pwd
             Require user lookout
       </Files>
</Directory>

To make the installation more secure, take a look here:

Own Vhost

here the installation to it's own virtual host:

cd /srv/httpd/vhosts/lookout.domain.local/
wget http://wiki.laub-home.de/path/to/lookout
tar -xzvf Lookout-0.1.tar.gz
ln -s lookout-0.1/htdocs/ htdocs/
mysql -u root -p < lookout-0.1/lookout.sql

Existing Vhost

if you want to use an existing vhost, just rename the htdocs directory to lookout and copy it to your vhost's documentroot.

cd /usr/src/
wget http://wiki.laub-home.de/path/to/lookout
tar -xzvf Lookout-0.1.tar.gz
mysql -u root -p < lookout-0.1/lookout.sql
mv lookout-0.1/htdocs/ /path/to/documentroot/lookout

ACHTUNG!!! Auf den Ordner templates_c braucht der apache user Write Rechte!!!

Database Layout


Create Database and MySQL User

This is what the lookout.sql script does!

create database and tables:
-- -----------------------------------------------------
-- Cleanup
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `lookout` ;
CREATE SCHEMA IF NOT EXISTS `lookout` DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci ;
USE `lookout` ;

-- -----------------------------------------------------
-- Table `lookout`.`config`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `lookout`.`config` (
  `config_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(20) NOT NULL ,
  `value` VARCHAR(255) NOT NULL ,
  PRIMARY KEY (`config_id`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `lookout`.`user`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `lookout`.`user` (
  `user_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(255) NOT NULL ,
  `password` VARCHAR(32) NOT NULL COMMENT 'md5 hash' ,
  `datetime` DATETIME NOT NULL COMMENT 'creation datetime' ,
  `admin` TINYINT(1)  NOT NULL DEFAULT false ,
  PRIMARY KEY (`user_id`) )
ENGINE = InnoDB
COMMENT = 'not yet implemented';


-- -----------------------------------------------------
-- Table `lookout`.`webcam`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `lookout`.`webcam` (
  `webcam_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
  `type` ENUM('image','video') NOT NULL ,
  `url` VARCHAR(255) NOT NULL ,
  `title` VARCHAR(255) NOT NULL ,
  `datetime` DATETIME NOT NULL COMMENT 'creation datetime' ,
  `owner_id` INT(10) UNSIGNED NOT NULL ,
  PRIMARY KEY (`webcam_id`) ,
  UNIQUE INDEX `url` (`url` ASC) ,
  INDEX `webcam_owner_fk` (`owner_id` ASC) ,
  CONSTRAINT `webcam_owner_fk`
    FOREIGN KEY (`owner_id` )
    REFERENCES `lookout`.`user` (`user_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `lookout`.`category`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `lookout`.`category` (
  `category_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(255) NOT NULL ,
  `datetime` DATETIME NOT NULL COMMENT 'creation datetime' ,
  `owner_id` INT(10) UNSIGNED NOT NULL COMMENT 'user_id of owner' ,
  PRIMARY KEY (`category_id`) ,
  INDEX `category_owner_fk` (`owner_id` ASC) ,
  CONSTRAINT `category_owner_fk`
    FOREIGN KEY (`owner_id` )
    REFERENCES `lookout`.`user` (`user_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
COMMENT = 'not yet implemented';


-- -----------------------------------------------------
-- Table `lookout`.`relation_webcam_category`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `lookout`.`relation_webcam_category` (
  `relation_wc_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
  `webcam_id` INT UNSIGNED NOT NULL ,
  `category_id` INT UNSIGNED NOT NULL ,
  PRIMARY KEY (`relation_wc_id`) ,
  INDEX `webcam_fk` (`webcam_id` ASC) ,
  INDEX `category_fk` (`category_id` ASC) ,
  CONSTRAINT `webcam_fk`
    FOREIGN KEY (`webcam_id` )
    REFERENCES `lookout`.`webcam` (`webcam_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `category_fk`
    FOREIGN KEY (`category_id` )
    REFERENCES `lookout`.`category` (`category_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
COMMENT = 'not yet implemented';
create lookout database user:
-- -----------------------------------------------------
-- User privileges
-- -----------------------------------------------------
CREATE USER `lookout`@`localhost` IDENTIFIED BY 'lookoutpass';
grant SELECT, INSERT, UPDATE, DELETE on TABLE `lookout`.`category` to `lookout`@`localhost`;
grant SELECT, INSERT, UPDATE, DELETE on TABLE `lookout`.`config` to `lookout`@`localhost`;
grant SELECT, INSERT, UPDATE, DELETE on TABLE `lookout`.`relation_webcam_category` to `lookout`@`localhost`;
grant SELECT, INSERT, UPDATE, DELETE on TABLE `lookout`.`user` to `lookout`@`localhost`;
grant SELECT, INSERT, UPDATE, DELETE on TABLE `lookout`.`webcam` to `lookout`@`localhost`;
FLUSH PRIVILEGES;
create lookout DB and User for the installation wizard
CREATE USER 'lookout'@'localhost' IDENTIFIED BY 'PASSWORD';

GRANT USAGE ON * . * TO 'lookout'@'localhost' IDENTIFIED BY 'PASSWORD' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;

CREATE DATABASE IF NOT EXISTS `lookout` ;

GRANT ALL PRIVILEGES ON `lookout` . * TO 'lookout'@'localhost';

Lookout Configuration

all you need for the first start is to edit the following parameters in lib/config.inc.php:

        $_CONFIG['path'] = '/srv/httpd/vhosts/lookout.domain.local/htdocs/';
        $_CONFIG['url'] = 'http://lookout.domain.local/';
        $_CONFIG['db'] = new DBMysql(array(
                                                                                'server' => 'localhost',
                                                                                'user' => 'lookout',
                                                                                'password' => 'lookoutpass',
                                                                                'db' => 'lookout',
                                                                                'table_prefix' => ''
        $_CONFIG['admin'] = "lookout";

that's it, now you should get the empty lookout startpage:

  • http://lookout.domain.local

now go to the admin interface by clicking on the yellow/red shield symbol in the right upper corner. Log in with your lookout user and start adding new webcams to your lookout frontend. For example:
Title: Fellhorn
URL: http://www.das-hoechste.de/vidnet/fellh.jpg
Type: choose image make sure everything is valid and click submit order. DONE!