Skip to content

Commit afce7c8

Browse files
authored
feat: add support for SHA algorithms to improve switch and hardware compatibility (#5)
* docs: update README docs * feat: add webhook testing prg * fix: correct API key authentication config * feat: add GitHub commit message convention * refactor: script reengineering * feat: add support for SHA algorithms to improve switch and hardware compatibility
1 parent 8622d75 commit afce7c8

File tree

6 files changed

+42
-14
lines changed

6 files changed

+42
-14
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ redis/tls
2424
redis/data
2525

2626
k8s/
27-
docker/
27+
docker/*.dockerfile
2828
docker-compose*.yml
2929

3030
*.md

docker-compose.yaml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ services:
44
build:
55
context: .
66
dockerfile: ./docker/controller.dockerfile
7-
environment:
8-
- TZ=${TZ:-Asia/Shanghai}
9-
- NETPULSE_REDIS__PASSWORD=${NETPULSE_REDIS__PASSWORD}
10-
- NETPULSE_SERVER__API_KEY=${NETPULSE_SERVER__API_KEY}
7+
env_file:
8+
- .env
119
volumes:
1210
- ./config:/app/config
1311
- ./redis/tls:/app/redis/tls:ro
@@ -25,9 +23,8 @@ services:
2523
build:
2624
context: .
2725
dockerfile: ./docker/node_worker.dockerfile
28-
environment:
29-
- TZ=${TZ:-Asia/Shanghai}
30-
- NETPULSE_REDIS__PASSWORD=${NETPULSE_REDIS__PASSWORD}
26+
env_file:
27+
- .env
3128
volumes:
3229
- ./config:/app/config
3330
- ./redis/tls:/app/redis/tls:ro
@@ -45,9 +42,8 @@ services:
4542
build:
4643
context: .
4744
dockerfile: docker/fifo_worker.dockerfile
48-
environment:
49-
- TZ=${TZ:-Asia/Shanghai}
50-
- NETPULSE_REDIS__PASSWORD=${NETPULSE_REDIS__PASSWORD}
45+
env_file:
46+
- .env
5147
volumes:
5248
- ./config:/app/config
5349
- ./redis/tls:/app/redis/tls:ro
@@ -60,8 +56,8 @@ services:
6056

6157
redis:
6258
image: redis:7-bookworm
63-
environment:
64-
- TZ=${TZ:-Asia/Shanghai}
59+
env_file:
60+
- .env
6561
volumes:
6662
- ./redis/redis.conf:/etc/redis/redis.conf:ro
6763
- ./redis/tls:/etc/redis/tls:ro

docker/fifo_worker.dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
FROM python:3.12-slim
22

3+
# Install system dependencies
4+
RUN apt-get update && apt-get install -y \
5+
openssh-client \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
# Create SSH config directory
9+
RUN mkdir -p /root/.ssh
10+
311
WORKDIR /app
412

513
RUN pip3 install --no-cache-dir --upgrade pip
614

715
COPY . .
16+
17+
# Copy SSH configuration file
18+
COPY docker/ssh_config /root/.ssh/config
19+
RUN chmod 600 /root/.ssh/config
20+
821
RUN pip3 install --no-cache-dir -e "."
922

1023
CMD ["python3", "worker.py", "fifo"]

docker/node_worker.dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
FROM python:3.12-slim
22

3+
# Install system dependencies
4+
RUN apt-get update && apt-get install -y \
5+
openssh-client \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
# Create SSH config directory
9+
RUN mkdir -p /root/.ssh
10+
311
WORKDIR /app
412

513
RUN pip3 install --no-cache-dir --upgrade pip
614

715
COPY . .
16+
17+
# Copy SSH configuration file
18+
COPY docker/ssh_config /root/.ssh/config
19+
RUN chmod 600 /root/.ssh/config
20+
821
RUN pip3 install --no-cache-dir -e "."
922

1023
CMD ["python3", "worker.py", "node"]

docker/ssh_config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SSH configuration - Enable ssh-rsa algorithm globally for legacy device compatibility
2+
Host *
3+
PubkeyAcceptedKeyTypes +ssh-rsa
4+
HostKeyAlgorithms +ssh-rsa
5+
PubkeyAcceptedAlgorithms +ssh-rsa

netpulse/utils/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ def settings_customise_sources(
108108
dotenv_settings,
109109
file_secret_settings,
110110
):
111-
"""Read settings: env -> yaml -> default"""
111+
"""Read settings: env -> dotenv -> yaml -> default"""
112112
return (
113113
env_settings,
114+
dotenv_settings,
114115
YamlConfigSettingsSource(settings_cls),
115116
init_settings,
116117
)

0 commit comments

Comments
 (0)