Skip to content

Commit 34e2a9e

Browse files
committed
Merge branch 'dev' into 2.x
2 parents 1b5c7c0 + 5bcd7d5 commit 34e2a9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+4493
-2120
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
**/node_modules/
22
**/test/
3-
**/venv/
3+
**/venv/
4+
**/config/*.js

.flake8

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[flake8]
22
extend-ignore = E402
3-
exclude = .git,__pycache__,config,demo,docs,lib,node_modules,plugins,routes,sealog-files,test,venv
3+
exclude = .git,__pycache__,config,demo,docs,lib,node_modules,plugins,reporting*,routes,sealog-files,*spidertrack*,test,venv
4+
filename=*.py,*.py.dist
45
max-line-length=100
56
# max-complexity = 10
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Docker Build and Run Test
2+
3+
on:
4+
push:
5+
branches:
6+
- 2.x # Or any branch you want to trigger the workflow
7+
- dev
8+
pull_request:
9+
branches:
10+
- 2.x # Or any branch you want to trigger the workflow
11+
- dev
12+
13+
jobs:
14+
build-and-test:
15+
runs-on: ubuntu-latest
16+
17+
# services:
18+
# You can define services that need to be running while testing
19+
# For example, if your app relies on a database, you could define it here
20+
# db:
21+
# image: postgres:latest
22+
# ports:
23+
# - 5432:5432
24+
25+
steps:
26+
- name: Check out the repository
27+
uses: actions/checkout@v3
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v2
31+
32+
- name: Set up Docker Compose
33+
run: |
34+
sudo apt-get update
35+
sudo apt-get install -y docker-compose
36+
37+
- name: Create a sealog-files directory
38+
run: |
39+
sudo mkdir -p /data/sealog-files
40+
41+
- name: Generate a secret key
42+
id: generate-secret
43+
run: |
44+
# Generate a random secret key using openssl
45+
SECRET_KEY=$(openssl rand -base64 32)
46+
echo "Generated secret key: $SECRET_KEY"
47+
# Save the secret key for later steps
48+
echo "SECRET_KEY=$SECRET_KEY" >> $GITHUB_ENV
49+
50+
- name: Modify docker-compose.yml
51+
run: |
52+
cp docker-compose.yml.dist docker-compose.yml
53+
54+
sed -i "s|<SECRET_TOKEN>|${{ secrets.SECRET_KEY }}|g" docker-compose.yml
55+
56+
- name: Modify Dockerfile
57+
run: |
58+
cp Dockerfile.dist Dockerfile
59+
60+
- name: Build and Run Docker Compose
61+
run: |
62+
docker-compose -f docker-compose.yml up -d --build
63+
# Optionally, add a wait or check to ensure the container is running
64+
docker-compose ps
65+
66+
# - name: Run tests or validation (if applicable)
67+
# run: |
68+
# You can run any tests or health checks here, e.g., using curl or a test script.
69+
# Example for a web server test:
70+
# curl -f http://localhost:8000/sealog-server || exit 1
71+
72+
- name: Tear down Docker Compose
73+
run: |
74+
docker-compose down

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ venv/
1212

1313
# customize versions of the dist scripts
1414
misc/cache_udp_data*.py
15+
misc/coriolix_sealog/settings*.py
1516
misc/influx_sealog/settings*.py
1617
misc/python_sealog/settings*.py
1718
misc/reporting/sealog_doc_template*.py
@@ -25,6 +26,7 @@ misc/sealog_aux_data_inserter_nav.py
2526
misc/sealog_auxDataInserter*.py
2627
misc/sealog_backupDB.sh
2728
misc/sealog_build_*_report*.py
29+
misc/sealog_create_cruise_from_openvdm.py
2830
misc/sealog_cruise_responder.py
2931
misc/sealog_cruise_sync.py
3032
misc/sealog_lowering_responder.py

.husky/pre-commit

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
echo "Linting NodeJS code with eslint..."
3+
eslint . --ext .js --ext .js.dist
4+
5+
echo "Linting python code with Flake8..."
6+
./venv/bin/flake8 ./misc
7+
8+
echo "Linting python code with PyLint..."
9+
./venv/bin/pylint ./misc

.pylintrc

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ ignore=CVS
5252
# ignore-list. The regex matches against paths and can be in Posix or Windows
5353
# format. Because '\\' represents the directory delimiter on Windows systems,
5454
# it can't be used as an escape character.
55-
ignore-paths=
55+
ignore-paths=.*(/reporting.*/|.*_spidertrack).*
5656

5757
# Files or directories matching the regular expression patterns are skipped.
5858
# The regex matches against base names, not paths. The default value ignores
@@ -299,7 +299,7 @@ max-attributes=7
299299
max-bool-expr=5
300300

301301
# Maximum number of branch for function / method body.
302-
max-branches=12
302+
max-branches=30
303303

304304
# Maximum number of locals for function / method body.
305305
max-locals=15
@@ -426,21 +426,23 @@ confidence=HIGH,
426426
# --enable=similarities". If you want to run only the classes checker, but have
427427
# no Warning level messages displayed, use "--disable=all --enable=classes
428428
# --disable=W".
429-
disable=raw-checker-failed,
430-
bad-inline-option,
431-
locally-disabled,
429+
disable=bad-inline-option,
430+
deprecated-pragma,
431+
duplicate-code,
432432
file-ignored,
433+
import-error,
434+
line-too-long,
435+
locally-disabled,
436+
raw-checker-failed,
433437
suppressed-message,
434-
useless-suppression,
435-
deprecated-pragma,
436-
use-symbolic-message-instead,
438+
too-many-arguments,
439+
too-many-positional-arguments,
437440
use-implicit-booleaness-not-comparison-to-string,
438441
use-implicit-booleaness-not-comparison-to-zero,
439-
line-too-long,
440-
import-error,
442+
use-symbolic-message-instead,
443+
useless-suppression,
441444
wrong-import-order,
442-
wrong-import-position,
443-
duplicate-code
445+
wrong-import-position
444446

445447
# Enable the message, report, category or checker with the given id(s). You can
446448
# either give multiple identifier separated by comma (,) or put this option
@@ -470,7 +472,7 @@ notes-rgx=
470472
[REFACTORING]
471473

472474
# Maximum number of nested blocks for function / method body
473-
max-nested-blocks=5
475+
max-nested-blocks=10
474476

475477
# Complete name of functions that never returns. When checking for
476478
# inconsistent-return-statements if a never returning function is called then

INSTALL.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ Set the `senderAddress` and `notificationEmailAddresses` locations in the `./con
8282

8383
You will also need to uncomment the type of email integration used. By default email is disabled but the distribution file includes commented code blocks for gmail, mailgun and mailjet integration.
8484

85-
Set the `host`, `port`, `wsPort`, and `prefix` values in the `./config/manifest.js` file to meet your specific installation requirements. There are 3 sets of these variables for the various ways sealog-server can be run. If you are only running one instance of Sealog Server on the server then the defaults are sufficient
85+
Set the `SERVER_PORT` value in the `./config/manifest.js` file to meet your specific installation requirements. If you are only running one instance of Sealog Server on the server then the default value is sufficient. If you plan to use SSL, add the complete privKey and fulchain filepaths to `<privKey.pem>` and `<fullchain.pem>`.
8686

87-
Set the `imagePath`, `cruisePath` and `loweringPath` locations in the `./config/server_settings.js` file to meet your specific installation requirements. These paths are where the framegrabber image files, cruise files and lowering files are located on the server.
87+
Set the `FILEPATH_ROOT` location in the `./config/server_settings.js` file to meet your specific installation requirements.
8888

8989
Create a secret JWT encryption key and save it to the `./config/secret.js` file. Create the key by running the following command:
9090
```
@@ -196,20 +196,13 @@ If everything went correctly you should not be able to access the sealog-server
196196
By default sealog-server runs over http. To run the server over https uncomment the following commented lines at the top of the `./config/manifest.js` file and replace `<privKey.pem>` and `<fullchain.pem>` with the appropriate cert files:
197197

198198
```
199-
// const Fs = require('fs')
200-
201-
// const tlsOptions = {
202-
// key: Fs.readFileSync(<privKey.pem>),
203-
// cert: Fs.readFileSync(<fullchain.pem>)
204-
// };
205-
```
206-
207-
AND the following line at line 103:
208-
```
209-
// tls: tlsOptions,
199+
tlsOptions = {
200+
key: Fs.readFileSync(process.env.SEALOG_SERVER_TLS_PRIVKEY || '<privKey.pem>'),
201+
cert: Fs.readFileSync(process.env.SEALOG_SERVER_TLS_FULLCHAIN || '<fullchain.pem>')
202+
};
210203
```
211204

212-
**Note:** Make sure the user running the sealog-server process has read access to the certificate files.
205+
**Note:** Make sure the user running the sealog-server process has read access to the certificate files. Make sure any clients communicating with the server know to use TLS.
213206

214207
# Enabling Additional Functionality
215208

config/manifest.js.dist

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const Fs = require('fs');
22
const Pkg = require('../package.json');
33

4+
const SERVER_PORT = 8000;
5+
46
let tlsOptions = null;
57
try {
68
tlsOptions = {
@@ -71,7 +73,7 @@ const {
7173
sealogDB_devel
7274
} = require('../config/db_constants');
7375

74-
const port = process.env.SEALOG_SERVER_PORT || 8000;
76+
const port = process.env.SEALOG_SERVER_PORT || SERVER_PORT;
7577
let env = process.env.NODE_ENV || 'development';
7678
env = (env === 'test') ? 'development' : env;
7779
env = ['demo-vehicle','demo-vessel'].includes(env) ? 'demo' : env;

config/server_settings.js.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const disableRegisteringUsers = false;
1414
const registeringUserRoles = ['event_watcher', 'event_logger'];
1515

1616
// Activate per-cruise/per-lowering access permissions
17-
const useAccessControl = false;
17+
const useAccessControl = process.env.SEALOG_SERVER_USE_ACCESS_CONTROL || false;
1818

1919
module.exports = {
2020
imagePath,

misc/cache_udp_data.py.dist

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ CREATED: 2018-09-26
1616
REVISION: 2021-04-27
1717
1818
LICENSE INFO: This code is licensed under MIT license (see LICENSE.txt for details)
19-
Copyright (C) OceanDataTools.org 2024
19+
Copyright (C) OceanDataTools.org 2025
2020
'''
2121

2222
import socket
@@ -157,12 +157,12 @@ if __name__ == '__main__':
157157
import os
158158

159159
parser = argparse.ArgumentParser(description='UDP Data Caching Service')
160-
parser.add_argument('-v', '--verbosity', dest='verbosity',
161-
default=0, action='count',
162-
help='Increase output verbosity')
163-
parser.add_argument('-i', '--ignore_stale', action='store_true',
164-
default=False,
165-
help='only save the new value if it\'s different than the previously recorded value')
160+
parser.add_argument(
161+
'-v', '--verbosity', dest='verbosity', default=0, action='count',
162+
help='Increase output verbosity')
163+
parser.add_argument(
164+
'-i', '--ignore_stale', action='store_true', default=False,
165+
help='only save the new value if it\'s different than the previously recorded value')
166166

167167
parsed_args = parser.parse_args()
168168

@@ -188,7 +188,7 @@ if __name__ == '__main__':
188188
try:
189189
sys.exit(0)
190190
except SystemExit:
191-
os._exit(0) # pylint: disable=protected-access
191+
os._exit(0)
192192

193193
# Wait 5 seconds for the server to complete startup
194194
time.sleep(5)

0 commit comments

Comments
 (0)