forked from kamba4/sunders
This commit is contained in:
parent
8fa7980e1e
commit
b8e6c4605c
16 changed files with 66 additions and 75 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/`
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
db:
|
||||
image: mysql:9.4
|
||||
image: git.hamburg.ccc.de/ccchh/sunders/db:latest
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: rootpassword
|
||||
MYSQL_DATABASE: camera
|
||||
MYSQL_USER: camera
|
||||
MYSQL_PASSWORD: camerapassword
|
||||
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:
|
||||
|
@ -14,16 +14,14 @@ services:
|
|||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
volumes:
|
||||
- ./home/sunders/init_cameras/db:/docker-entrypoint-initdb.d
|
||||
|
||||
web:
|
||||
build: ./www/sunders
|
||||
image: git.hamburg.ccc.de/ccchh/sunders/web:latest
|
||||
environment:
|
||||
MYSQL_HOST: db
|
||||
MYSQL_DB: camera
|
||||
MYSQL_USER: camera
|
||||
MYSQL_PASSWORD: camerapassword
|
||||
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
|
||||
|
@ -34,29 +32,3 @@ services:
|
|||
- db
|
||||
volumes:
|
||||
- ./www/sunders:/var/www/html
|
||||
|
||||
# setup:
|
||||
# image: alpine:latest
|
||||
# volumes:
|
||||
# - ./home/sunders/init_cameras/:/init_cameras
|
||||
# working_dir: /init_cameras
|
||||
# environment:
|
||||
# MYSQL_ROOT_PASSWORD: rootpassword
|
||||
# MYSQL_DATABASE: camera
|
||||
# MYSQL_USER: camera
|
||||
# MYSQL_PASSWORD: camerapassword
|
||||
# entrypoint: ["/bin/sh", "-c", "./createInitialDataFiles.sh"]
|
||||
# depends_on:
|
||||
# - db
|
||||
|
||||
# updater:
|
||||
# build: ./home/sunders/update_cameras
|
||||
# environment:
|
||||
# MYSQL_PASSWORD: camerapassword
|
||||
# depends_on:
|
||||
# - db
|
||||
# # Uncomment to run periodically
|
||||
# # deploy:
|
||||
# # replicas: 1
|
||||
# # restart_policy:
|
||||
# # condition: on-failure
|
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/
|
|
@ -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,
|
|
@ -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