Skip to content

Commit

Permalink
fix(README.md): Installation
Browse files Browse the repository at this point in the history
Some minor fixes to aid README.md for installation section.
  • Loading branch information
mibs510 committed Jul 8, 2023
1 parent cd779d4 commit ae41cd4
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 18 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,4 @@ ipban.ini
apps/uploads/*

# Synology Drive Client
.sync-exclude.lst

# IPBan Log Directory
log/
.sync-exclude.lst
40 changes: 32 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ It was designed with an emphasis on security to meet organization/business needs
- ~~Worker management needs reimplementation~~
- ~~Currently working on this~~
- Manually requeuing jobs fail
- Update vulnerable packages (Flask, requests, Werkzeug)
- ~~Searching plates will only work if pagination position is on page 1~~
- ~~This is a grid.js issue [#1314](https://github.com/grid-js/gridjs/issues/1314) [#1344](https://github.com/grid-js/gridjs/pull/1334) [#1311](https://github.com/grid-js/gridjs/issues/1311).~~

Expand Down Expand Up @@ -64,49 +65,72 @@ Additionally, you can set Redis server to start automatically. See the Bare Serv
TBD

### Bare Server
1. apt install build-essential python3 python3-dev redis-server && systemctl enable redis-server && systemctl start redis-server
2. git https://github.com/mibs510/OpenALPR-Webhook
1. apt install build-essential python3 python3-dev python3.10-venv pip3 redis-server && systemctl enable redis-server && systemctl start redis-server
2. git clone https://github.com/mibs510/OpenALPR-Webhook
3. cd OpenALPR-Webhook
4. pip3 install -r requirements.txt
5. ./venv/bin/activate
6. ./app.py --host=0.0.0.0 --port=8080
4. python3 -m venv ./venv
5. source ./venv/bin/activate
6. pip3 install flask-dance
7. pip3 install -r requirements.txt
8. /venv/bin/activate
9. /app.py --host=0.0.0.0 --port=8080

#### Linux systemd service
You will want to create a service file to automatically start OpenALPR-Webhook upon each reboot.

`sudo nano /etc/systemd/system/oalpr-wh.service`


`
```
[Unit]
Description=OpenALPR-Webhook
After=network.target
[Service]
User=user
WorkingDirectory=/home/user/OpenALPR-Webhook
ExecStart=/home/user/OpenALPR-Webhook/app.py --host=0.0.0.0 --port=8080
ExecStart=/home/user/OpenALPR-Webhook/venv/bin/python3 /home/user/OpenALPR-Webhook/app.py --host=0.0.0.0 --port=8080
Restart=always
[Install]
WantedBy=multi-user.target
`
```

Be sure to modify `User`, `WorkingDirectory`, and `ExecStart`
`User` should not be a user with root privileges
<br>
Then execute:
<br>
`sudo systemctl daemon-reload`

`sudo systemctl enable oalpr-wh`

`sudo systemctl start oalpr-wh`

Optional: `journalctl -n 50 -f`

### New Instance
Head over to the URL of your server. You will be required to login. Click 'register' to create a super admin account.
<br>
After creating a super admin account, the register link will throw an 'Access Denied' as a protective measure against unauthorized account creation.
<br>
Accounts will need to be created manually by an administrator under Settings/Users.

### Updates

```shell
cd OpenALPR-Webhook
# Backup databases
mkdir apps/db.backup
cp apps/db/* apps/db.backup
# Get latest version of OpenALPR-Webhook
git pull
# Apply changes to the databases
flask db init --multidb
flask db migrate
flask db upgrade
```

# Documentation
### Dashboard
___
Expand Down
5 changes: 3 additions & 2 deletions app.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from flask_script import Manager

from apps import create_app, db
from apps.config import config_dict
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from flask_minify import Minify
import os
Expand All @@ -16,7 +17,7 @@

app = create_app(app_config)
app.config['ENV'] = get_config_mode.capitalize()
Migrate(app, db)
migrate = Migrate(app, db)

# DB Migration
manager = Manager(app)
Expand Down
2 changes: 1 addition & 1 deletion apps/alpr/ipban_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class IPBanConfig:
abuse_IPDB_config_report = False
abuse_IPDB_config_load = False
abuse_IPDB_config_key = ""
record_dir = "log/"
record_dir = "logs/"

config = configparser.ConfigParser()

Expand Down
2 changes: 1 addition & 1 deletion log.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def filter(self, record):
logging.getLogger().setLevel(logging.DEBUG)

""" Catch all unhandled exceptions """
sys.excepthook = exception_hook
# sys.excepthook = exception_hook

""" .log File Handler """
dot_log_file_handler = RotatingFileHandler(logdir + "/" + filename, maxBytes=10000000, backupCount=9)
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ dnspython==2.3.0
email-validator==2.0.0.post2
filelock==3.12.0
Flask==1.1.4
Flask-Dance==6.2.0
flask-ipban==1.1.5
Flask-Login==0.6.2
Flask-Mail==0.9.1
Expand Down
1 change: 0 additions & 1 deletion worker_manager_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sys
import time

import psutil
import redis as redis
from progressbar import progressbar
from redis import Redis
Expand Down

0 comments on commit ae41cd4

Please sign in to comment.