forked from kamba4/sunders
Compare commits
3 commits
325c3c665d
...
b8e6c4605c
Author | SHA1 | Date | |
---|---|---|---|
b8e6c4605c | |||
8fa7980e1e | |||
677218076e |
17 changed files with 150 additions and 117704 deletions
|
@ -16,11 +16,6 @@ jobs:
|
|||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build Hello World Docker image
|
||||
run: |
|
||||
echo -e 'FROM alpine\nCMD echo Hello, World!' > Dockerfile
|
||||
docker build -t hello-world:latest .
|
||||
|
||||
- name: Login to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
|
@ -28,7 +23,22 @@ jobs:
|
|||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Push Docker image to Container Registry
|
||||
- name: Build and push web image to Container Registry
|
||||
run: |
|
||||
docker tag hello-world:latest git.hamburg.ccc.de/ccchh/sunders/tmp:latest
|
||||
docker push git.hamburg.ccc.de/ccchh/sunders/tmp:latest
|
||||
docker build -t web:latest .
|
||||
docker tag web:latest git.hamburg.ccc.de/ccchh/sunders/web:latest
|
||||
docker push git.hamburg.ccc.de/ccchh/sunders/web:latest
|
||||
working-directory: ./www/sunders
|
||||
|
||||
- name: Build and push db image to Container Registry
|
||||
run: |
|
||||
docker build -t db:latest .
|
||||
docker tag db:latest git.hamburg.ccc.de/ccchh/sunders/db:latest
|
||||
docker push git.hamburg.ccc.de/ccchh/sunders/db:latest
|
||||
working-directory: ./home/sunders/init_cameras/db
|
||||
|
||||
- name: Start Docker Compose services
|
||||
run: |
|
||||
docker compose up -d --wait
|
||||
docker compose down
|
||||
working-directory: /
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,4 @@
|
|||
change_file.osc*
|
||||
config.php
|
||||
lastState.txt
|
||||
lastStatisticsUpdate.txt
|
||||
log.*
|
||||
|
|
|
@ -84,7 +84,7 @@ If you like to run Surveillance under Surveillance on your own LAMP or LNMP serv
|
|||
|
||||
- Rename the file **config.php.example** to **config.php**.
|
||||
|
||||
- Open the file **config.php** and enter the **MYSQL_PASSWD** of the database user **camera**. Furthermore enter the **REPLICATE_URL** that fits to your project, e.g. from [planet.openstreetmap.org](https://planet.openstreetmap.org/replication/) or from [download.openstreetmap.fr](http://download.openstreetmap.fr/replication/). Here are some examples:
|
||||
- Open the file **config.php** and enter the **MYSQL_PASSWORD** of the database user **camera**. Furthermore enter the **REPLICATE_URL** that fits to your project, e.g. from [planet.openstreetmap.org](https://planet.openstreetmap.org/replication/) or from [download.openstreetmap.fr](http://download.openstreetmap.fr/replication/). Here are some examples:
|
||||
|
||||
`https://planet.openstreetmap.org/replication/minute/`
|
||||
`http://download.openstreetmap.fr/replication/planet/minute/`
|
||||
|
|
34
docker-compose.yml
Normal file
34
docker-compose.yml
Normal file
|
@ -0,0 +1,34 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
db:
|
||||
image: git.hamburg.ccc.de/ccchh/sunders/db:latest
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: rootpassword # ${{secrets.MYSQL_ROOT_PASSWORD}}
|
||||
MYSQL_DATABASE: camera # ${{secrets.MYSQL_DATABASE}}
|
||||
MYSQL_USER: camera # ${{secrets.MYSQL_USER}}
|
||||
MYSQL_PASSWORD: camerapassword # ${{secrets.MYSQL_PASSWORD}}
|
||||
ports:
|
||||
- "3306:3306"
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
web:
|
||||
image: git.hamburg.ccc.de/ccchh/sunders/web:latest
|
||||
environment:
|
||||
MYSQL_HOST: db
|
||||
MYSQL_DB: camera # ${{secrets.MYSQL_DATABASE}}
|
||||
MYSQL_USER: camera # ${{secrets.MYSQL_USER}}
|
||||
MYSQL_PASSWORD: camerapassword # ${{secrets.MYSQL_PASSWORD}}
|
||||
DEFAULT_ZOOM: 12
|
||||
DEFAULT_LAT: 0
|
||||
DEFAULT_LON: 0
|
||||
DEFAULT_LANGUAGE: en
|
||||
ports:
|
||||
- "8080:80"
|
||||
depends_on:
|
||||
- db
|
||||
volumes:
|
||||
- ./www/sunders:/var/www/html
|
3
home/sunders/init_cameras/db/Dockerfile
Normal file
3
home/sunders/init_cameras/db/Dockerfile
Normal file
|
@ -0,0 +1,3 @@
|
|||
FROM mysql:9.4
|
||||
|
||||
COPY ./scripts /docker-entrypoint-initdb.d/
|
File diff suppressed because it is too large
Load diff
|
@ -1,9 +1,5 @@
|
|||
create database camera;
|
||||
use camera;
|
||||
|
||||
grant all privileges on camera.* to camera@localhost identified by 'xxxxxxxx';
|
||||
grant select on camera.* to camselect@localhost;
|
||||
|
||||
CREATE TABLE position (
|
||||
id BIGINT PRIMARY KEY,
|
||||
latitude INT,
|
60
home/sunders/init_cameras/db/scripts/02-exampleData.sql
Normal file
60
home/sunders/init_cameras/db/scripts/02-exampleData.sql
Normal file
|
@ -0,0 +1,60 @@
|
|||
DELETE FROM position; DELETE FROM tag; COMMIT;
|
||||
INSERT INTO position (id, latitude, longitude) VALUES (135795, 451957648,57348639);
|
||||
INSERT INTO tag (id, k, v) VALUES (135795, 'lat', '45.1957648');
|
||||
INSERT INTO tag (id, k, v) VALUES (135795, 'lon', '5.7348639');
|
||||
INSERT INTO tag (id, k, v) VALUES (135795, 'userid', 'Syl');
|
||||
INSERT INTO tag (id, k, v) VALUES (135795, 'version', '4');
|
||||
INSERT INTO tag (id, k, v) VALUES (135795, 'timestamp', '2010-12-18T11:30:49Z');
|
||||
INSERT INTO tag (id, k, v) VALUES (135795, 'man_made', 'surveillance');
|
||||
INSERT INTO tag (id, k, v) VALUES (135795, 'source', 'v2 ; cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre ; mise à jour : 2009');
|
||||
INSERT INTO position (id, latitude, longitude) VALUES (135839, 451871545,57275523);
|
||||
INSERT INTO tag (id, k, v) VALUES (135839, 'lat', '45.1871545');
|
||||
INSERT INTO tag (id, k, v) VALUES (135839, 'lon', '5.7275523');
|
||||
INSERT INTO tag (id, k, v) VALUES (135839, 'userid', 'Virgile1994');
|
||||
INSERT INTO tag (id, k, v) VALUES (135839, 'version', '10');
|
||||
INSERT INTO tag (id, k, v) VALUES (135839, 'timestamp', '2012-07-01T19:15:11Z');
|
||||
INSERT INTO tag (id, k, v) VALUES (135839, 'highway', 'traffic_signals');
|
||||
INSERT INTO tag (id, k, v) VALUES (135839, 'man_made', 'surveillance');
|
||||
INSERT INTO tag (id, k, v) VALUES (135839, 'source', 'v2 ; cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre ; mise à jour : 2009');
|
||||
INSERT INTO position (id, latitude, longitude) VALUES (135873, 451948183,57306964);
|
||||
INSERT INTO tag (id, k, v) VALUES (135873, 'lat', '45.1948183');
|
||||
INSERT INTO tag (id, k, v) VALUES (135873, 'lon', '5.7306964');
|
||||
INSERT INTO tag (id, k, v) VALUES (135873, 'userid', 'Gilles Nogues');
|
||||
INSERT INTO tag (id, k, v) VALUES (135873, 'version', '10');
|
||||
INSERT INTO tag (id, k, v) VALUES (135873, 'timestamp', '2012-06-29T09:51:02Z');
|
||||
INSERT INTO tag (id, k, v) VALUES (135873, 'highway', 'traffic_signals');
|
||||
INSERT INTO tag (id, k, v) VALUES (135873, 'man_made', 'surveillance');
|
||||
INSERT INTO tag (id, k, v) VALUES (135873, 'source', 'v2 ; cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre ; mise à jour : 2009');
|
||||
INSERT INTO position (id, latitude, longitude) VALUES (146663, 482074496,116513533);
|
||||
INSERT INTO tag (id, k, v) VALUES (146663, 'lat', '48.2074496');
|
||||
INSERT INTO tag (id, k, v) VALUES (146663, 'lon', '11.6513533');
|
||||
INSERT INTO tag (id, k, v) VALUES (146663, 'userid', 'Basstoelpel');
|
||||
INSERT INTO tag (id, k, v) VALUES (146663, 'version', '4');
|
||||
INSERT INTO tag (id, k, v) VALUES (146663, 'timestamp', '2009-05-23T15:17:37Z');
|
||||
INSERT INTO tag (id, k, v) VALUES (146663, 'man_made', 'surveillance');
|
||||
INSERT INTO tag (id, k, v) VALUES (146663, 'surveillance', 'public');
|
||||
INSERT INTO position (id, latitude, longitude) VALUES (146665, 482028333,116606119);
|
||||
INSERT INTO tag (id, k, v) VALUES (146665, 'lat', '48.2028333');
|
||||
INSERT INTO tag (id, k, v) VALUES (146665, 'lon', '11.6606119');
|
||||
INSERT INTO tag (id, k, v) VALUES (146665, 'userid', 'holger_l');
|
||||
INSERT INTO tag (id, k, v) VALUES (146665, 'version', '4');
|
||||
INSERT INTO tag (id, k, v) VALUES (146665, 'timestamp', '2009-05-13T22:35:13Z');
|
||||
INSERT INTO tag (id, k, v) VALUES (146665, 'man_made', 'surveillance');
|
||||
INSERT INTO tag (id, k, v) VALUES (146665, 'surveillance', 'public');
|
||||
INSERT INTO position (id, latitude, longitude) VALUES (146676, 481989327,116709193);
|
||||
INSERT INTO tag (id, k, v) VALUES (146676, 'lat', '48.1989327');
|
||||
INSERT INTO tag (id, k, v) VALUES (146676, 'lon', '11.6709193');
|
||||
INSERT INTO tag (id, k, v) VALUES (146676, 'userid', 'Peter14');
|
||||
INSERT INTO tag (id, k, v) VALUES (146676, 'version', '4');
|
||||
INSERT INTO tag (id, k, v) VALUES (146676, 'timestamp', '2012-01-07T15:07:28Z');
|
||||
INSERT INTO tag (id, k, v) VALUES (146676, 'man_made', 'surveillance');
|
||||
INSERT INTO tag (id, k, v) VALUES (146676, 'surveillance', 'public');
|
||||
INSERT INTO position (id, latitude, longitude) VALUES (146679, 481954845,116828458);
|
||||
INSERT INTO tag (id, k, v) VALUES (146679, 'lat', '48.1954845');
|
||||
INSERT INTO tag (id, k, v) VALUES (146679, 'lon', '11.6828458');
|
||||
INSERT INTO tag (id, k, v) VALUES (146679, 'userid', 'holger_l');
|
||||
INSERT INTO tag (id, k, v) VALUES (146679, 'version', '3');
|
||||
INSERT INTO tag (id, k, v) VALUES (146679, 'timestamp', '2009-05-13T22:35:14Z');
|
||||
INSERT INTO tag (id, k, v) VALUES (146679, 'man_made', 'surveillance');
|
||||
INSERT INTO tag (id, k, v) VALUES (146679, 'surveillance', 'public');
|
||||
COMMIT;
|
|
@ -5,7 +5,7 @@ define('REPLICATE_URL', 'https://planet.openstreetmap.org/replication/minute');
|
|||
define('MYSQL_HOST', 'localhost');
|
||||
define('MYSQL_DB', 'camera');
|
||||
define('MYSQL_USER', 'camera');
|
||||
define('MYSQL_PASSWD', 'xxxxxxxx');
|
||||
define('MYSQL_PASSWORD', 'xxxxxxxx');
|
||||
|
||||
define('USE_STATISTICS', false);
|
||||
define('WEBSERVICE_COUNTRY_URL', 'http://api.geonames.org/countryCode');
|
||||
|
|
|
@ -15,7 +15,7 @@ $id = 0;
|
|||
$latitude = 0;
|
||||
$longitude = 0;
|
||||
|
||||
$mysqli = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWD, MYSQL_DB);
|
||||
$mysqli = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB);
|
||||
|
||||
if($mysqli->connect_errno) {
|
||||
echo "Error while connecting to DB : $mysqli->error \n" ;
|
||||
|
|
|
@ -4,7 +4,7 @@ include "config.php";
|
|||
|
||||
if (USE_STATISTICS) {
|
||||
|
||||
$mysqli = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWD, MYSQL_DB);
|
||||
$mysqli = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB);
|
||||
|
||||
if ($mysqli->connect_errno) {
|
||||
echo "Error while connecting to DB : ".$mysqli->error." \n" ;
|
||||
|
|
13
www/sunders/Dockerfile
Normal file
13
www/sunders/Dockerfile
Normal file
|
@ -0,0 +1,13 @@
|
|||
FROM php:8.2-apache
|
||||
COPY . /var/www/html/
|
||||
WORKDIR /var/www/html/
|
||||
# Enable Apache mod_rewrite if needed
|
||||
RUN a2enmod rewrite
|
||||
# Set permissions if needed
|
||||
ENV DEFAULT_ZOOM=12
|
||||
ENV DEFAULT_LAT=0
|
||||
ENV DEFAULT_LON=0
|
||||
ENV DEFAULT_LANGUAGE=en
|
||||
ENV MYSQL_PASSWORD=changeme
|
||||
# Optionally install extensions
|
||||
RUN docker-php-ext-install mysqli bcmath
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
include $pathToWebFolder.'config.php';
|
||||
include 'config.php';
|
||||
|
||||
define('MAX_POINTS_FOR_QUICKHULL', 3000);
|
||||
|
||||
|
@ -266,7 +266,7 @@
|
|||
$divDiag2 = ($divWidth * $divWidth) + ($divHeight * $divHeight);
|
||||
|
||||
/* Connect to database */
|
||||
$mysqli = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWD, MYSQL_DB);
|
||||
$mysqli = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB);
|
||||
if($mysqli->connect_errno) {
|
||||
header('Content-type: application/json');
|
||||
$result = '{"error":"error while connecting to db : ' . $mysqli->error . '"}';
|
||||
|
|
15
www/sunders/config.php
Normal file
15
www/sunders/config.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
define('DEFAULT_ZOOM', getenv('DEFAULT_ZOOM') ?: 11);
|
||||
define('DEFAULT_LAT', getenv('DEFAULT_LAT') ?: 53.5550);
|
||||
define('DEFAULT_LON', getenv('DEFAULT_LON') ?: 10.0099);
|
||||
define('DEFAULT_LANGUAGE', getenv('DEFAULT_LANGUAGE') ?: 'en');
|
||||
define('DEFAULT_PIE', 'country');
|
||||
define('DEFAULT_TIME', 'single');
|
||||
|
||||
define('MYSQL_HOST', getenv('MYSQL_HOST') ?: '');
|
||||
define('MYSQL_DB', getenv('MYSQL_DB') ?: '');
|
||||
define('MYSQL_USER', getenv('MYSQL_USER') ?: '');
|
||||
define('MYSQL_PASSWORD', getenv('MYSQL_PASSWORD') ?: '');
|
||||
|
||||
define('USE_STATISTICS', false);
|
||||
?>
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
define('DEFAULT_ZOOM', 15);
|
||||
define('DEFAULT_LAT', 52.37672572);
|
||||
define('DEFAULT_LON', 9.73787785);
|
||||
define('DEFAULT_LANGUAGE', 'en');
|
||||
define('DEFAULT_PIE', 'country');
|
||||
define('DEFAULT_TIME', 'single');
|
||||
|
||||
define('MYSQL_HOST', 'localhost');
|
||||
define('MYSQL_DB', 'camera');
|
||||
define('MYSQL_USER', 'camselect');
|
||||
define('MYSQL_PASSWD', null);
|
||||
|
||||
define('USE_STATISTICS', false);
|
||||
|
||||
?>
|
|
@ -138,7 +138,7 @@
|
|||
$statsQueryObject = $levelObject->{$statsKey};
|
||||
|
||||
/* Connect to database */
|
||||
$mysqli = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWD, MYSQL_DB);
|
||||
$mysqli = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB);
|
||||
if($mysqli->connect_errno) {
|
||||
echo 'Error while connecting to DB : $mysqli->error \n' ;
|
||||
exit(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue