Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
IRC_PORT=6667
SSL_PORT=6697
SERVER_NAME=irc.test.local
NETWORK_NAME=TestNet
ADMIN_EMAIL=test@example.com
34 changes: 34 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: E2E Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 20

env:
TESTCONTAINERS_RYUK_DISABLED: "true"
TESTCONTAINERS_HOST_OVERRIDE: "localhost"
TESTCONTAINERS_CONNECTION_MODE: "docker_host"

steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v4
with:
enable-cache: true

- name: Install dependencies
run: uv sync --group test

- name: Run E2E tests
run: uv run pytest tests/ -v

- name: Dump container logs on failure
if: failure()
run: docker ps -a && docker logs $(docker ps -aq --filter ancestor=unrealircd-modules-test) 2>/dev/null || true
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ certs/
# Node modules (if any)
node_modules/

# Python cache (if any)
# Python
__pycache__/
*.pyc
*.pyo
*.pyd
.venv/
.pytest_cache/

# Local development overrides
docker-compose.override.yml
Expand Down
42 changes: 16 additions & 26 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,22 @@ services:
container_name: obsidian-unrealircd
restart: unless-stopped
ports:
- "${IRC_PORT:-6667}:6667"
- "${SSL_PORT:-6697}:6697"
- "${SSL_HOST_PORT:-6697}:6697"
volumes:
- unrealircd_conf:/home/unrealircd/unrealircd/conf
- unrealircd_data:/home/unrealircd/unrealircd/data
- unrealircd_logs:/home/unrealircd/unrealircd/logs
- unrealircd_tls:/home/unrealircd/unrealircd/tls
environment:
- SERVER_NAME=${SERVER_NAME:-irc.example.com}
- IRC_PORT=${IRC_PORT:-6667}
- SSL_PORT=${SSL_PORT:-6697}
- NETWORK_NAME=${NETWORK_NAME:-ObsidianNetwork}
- ADMIN_EMAIL=${ADMIN_EMAIL:-admin@example.com}
- ICON_URL=${ICON_URL:-}
- FILEHOST_URL=${FILEHOST_URL:-}
- MOTD_TEXT=${MOTD_TEXT:-Welcome to ObsidianIRC! Connect and enjoy our features.}
networks:
- irc_network
- ${CONF_BIND:-unrealircd_conf}:/home/unrealircd/unrealircd/conf
- ${DATA_BIND:-unrealircd_data}:/home/unrealircd/unrealircd/data
- ${LOGS_BIND:-unrealircd_logs}:/home/unrealircd/unrealircd/logs
- ${TLS_BIND:-unrealircd_tls}:/home/unrealircd/unrealircd/tls
- ${CUSTOM_MODULES_BIND:-unrealircd_custom_modules}:/home/unrealircd/unrealircd/custom-modules
env_file:
- path: .env
required: false
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "6667"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
test: ["CMD-SHELL", "nc -z localhost 6697"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use SSL_PORT in healthcheck to avoid config drift.

Line 20 hardcodes 6697; if SSL_PORT is overridden through .env, the service can be healthy but marked unhealthy.

Proposed fix
-      test: ["CMD-SHELL", "nc -z localhost 6697"]
+      test: ["CMD-SHELL", "nc -z localhost $${SSL_PORT:-6697}"]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test: ["CMD-SHELL", "nc -z localhost 6697"]
test: ["CMD-SHELL", "nc -z localhost $${SSL_PORT:-6697}"]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@compose.yaml` at line 20, The healthcheck currently hardcodes the port in the
test array ("test: [\"CMD-SHELL\", \"nc -z localhost 6697\"]"), which will drift
if SSL_PORT is overridden; update the healthcheck to use the SSL_PORT
environment variable (e.g., replace the literal 6697 with ${SSL_PORT}) so the
container's healthcheck reads the same value as SSL_PORT and won't be marked
unhealthy when the port is changed.

interval: 5s
timeout: 5s
retries: 6
start_period: 10s

volumes:
unrealircd_conf:
Expand All @@ -40,7 +32,5 @@ volumes:
driver: local
unrealircd_tls:
driver: local

networks:
irc_network:
driver: bridge
unrealircd_custom_modules:
driver: local
225 changes: 0 additions & 225 deletions docker/DOCKER_README.md

This file was deleted.

7 changes: 6 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN apk add --no-cache \
libsodium-dev \
jansson-dev \
curl-dev \
sqlite-dev \
wget \
tar \
gettext \
Expand All @@ -34,7 +35,6 @@ RUN mv unrealircd-* unrealircd-source
WORKDIR /tmp/unrealircd-source

# Copy our custom modules from repository root
COPY --chown=unrealircd:unrealircd o-icon.c src/modules/third/
COPY --chown=unrealircd:unrealircd o-filehost.c src/modules/third/
COPY --chown=unrealircd:unrealircd obsidianirc.c src/modules/third/
COPY --chown=unrealircd:unrealircd obsidian.h include/
Expand All @@ -55,6 +55,11 @@ RUN echo "1" | ./Config \
# Switch back to root for final setup
USER root

# Save default conf files outside the volume mount point so they survive volume mounts
RUN mkdir -p /etc/unrealircd/conf-defaults \
&& cp -r /home/unrealircd/unrealircd/conf/. /etc/unrealircd/conf-defaults/ \
&& chmod -R a+rX /etc/unrealircd/

# Create directories for runtime
RUN mkdir -p /home/unrealircd/unrealircd/conf \
&& mkdir -p /home/unrealircd/unrealircd/data \
Expand Down
Loading
Loading