Compare commits

..

2 Commits

Author SHA1 Message Date
5dd7bcc3de using i2pshark newest version 2026-11-15 22:18:25 +01:00
e58555e5e6 removed unused aniworld build 2026-11-04 16:24:32 +01:00
12 changed files with 114 additions and 98 deletions

View File

@ -1,14 +0,0 @@
FROM alpine:3.20 AS base
RUN apk add --no-cache \
python3
RUN mkdir services
RUN python3 -m venv services/aniworlddownloader_venv && \
services/aniworlddownloader_venv/bin/pip install --no-cache-dir aniworld
WORKDIR /
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["sh", "/entrypoint.sh"]

View File

@ -1,25 +0,0 @@
FROM alpine:3.20 AS base
ARG PROXY_SERVER
ARG PROXY_PORT
RUN apk add --no-cache \
python3 \
iptables
ADD https://github.com/semigodking/redsocks/releases/download/release-0.71/redsocks2-x86_64-release-0.71 /bin/redsocks2
RUN chmod +x /bin/redsocks2
COPY redsocks.conf /etc/redsocks.conf
RUN sed -i "s/vPROXY-SERVER/${PROXY_SERVER}/g" /etc/redsocks.conf && \
sed -i "s/vPROXY-PORT/${PROXY_PORT}/g" /etc/redsocks.conf
RUN mkdir -p /services /var/aniworld
WORKDIR /services
RUN python3 -m venv aniworlddownloader_venv && \
aniworlddownloader_venv/bin/pip install --no-cache-dir aniworld
WORKDIR /
COPY entrypoint.sh.i2p /entrypoint.sh
ENTRYPOINT ["sh", "/entrypoint.sh"]

View File

@ -1,6 +0,0 @@
#!/usr/share/env bash
/services/aniworlddownloader_venv/bin/aniworld --web-ui --no-browser --web-expose --web-port 3000 --output-dir /var/aniworld/downloads &
while true; do sleep 1000; done

View File

@ -1,8 +0,0 @@
#!/usr/share/env bash
iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-port 12345
iptables -t nat -A OUTPUT -p tcp --dport 443 -j REDIRECT --to-port 12345
redsocks2 -c /etc/redsocks.conf
/services/aniworlddownloader_venv/bin//aniworld --web-ui --no-browser --web-expose --web-port 3000 --output-dir /var/aniworld/downloads &
while true; do sleep 1000; done

View File

@ -1,14 +0,0 @@
base {
log_debug = off;
log_info = on;
log = "file:/var/log/redsocks.log";
daemon = on;
user = root;
group = root;
redirector = iptables;
}
redsocks {
bind = "127.0.0.1:12345";
relay= "vPROXY-SERVER:vPROXY-PORT";
type = "http-connect";
}

View File

@ -1,15 +0,0 @@
[Interface]
# Key for proxmoxADS
# Bouncing = 2
# NAT-PMP (Port Forwarding) = off
# VPN Accelerator = on
# Table = off
PrivateKey = uPGxlIrs0+erepQsbnkld/aBde7qd7HwwsMrGaNtGUg=
Address = 10.2.0.2/32
DNS = 10.2.0.1
[Peer]
# NL-FREE#136
PublicKey = 8xx8LqTpTHCEWou3Wu43p2CaEqnO9kcKQrLb+C8fZw8=
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = 169.150.218.70:51820

36
files/i2psnark/Dockerfile Normal file
View File

@ -0,0 +1,36 @@
FROM alpine:latest
WORKDIR /
ARG HOST_IP=0.0.0.0
ARG HOST_GID=1000
ARG HOST_UID=1000
# Install dependencies
RUN apk add --no-cache \
wget \
unzip \
openjdk8-jre-base \
su-exec \
shadow
# Create user and group
RUN addgroup -g ${HOST_GID} i2psnark \
&& adduser -h /i2psnark -G i2psnark -u ${HOST_UID} -D i2psnark
# Download and install i2psnark
RUN wget -O /tmp/i2psnark-standalone.zip \
"https://i2pplus.github.io/installers/i2psnark-standalone.zip" \
&& unzip /tmp/i2psnark-standalone.zip -d /tmp \
&& mkdir -p /snark \
&& mv /tmp/standalone /snark/i2psnark \
&& rm -f /tmp/i2psnark-standalone.zip \
&& chown -R i2psnark:i2psnark /snark \
&& sed -i "s|127.0.0.1|${HOST_IP}|g" /snark/i2psnark/jetty-i2psnark.xml
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 8002
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -0,0 +1,12 @@
#!/bin/sh
set -euo pipefail
HOST_GID=`getent group i2psnark | cut -d: -f3`
# Ensure user rights
chown -R i2psnark:$HOST_GID /i2psnark
chown i2psnark:$HOST_GID /snark/downloads
cd /snark/i2psnark
exec ./launch-i2psnark

View File

@ -23,12 +23,17 @@
content: "{{ localservices.wg_client.wg_conf }}" content: "{{ localservices.wg_client.wg_conf }}"
dest: "{{ path }}/config/wg0.conf" dest: "{{ path }}/config/wg0.conf"
- name: template i2psnark.conf - name: populate i2psnark templates
template: template:
src: "i2psnark.conf.j2" src: "i2psnark/{{ item.path }}"
dest: "{{ path }}/config/i2psnark.config" dest: "{{ path }}/config/{{ item.path | regex_replace('\\.j2$', '') }}"
with_filetree: "{{ role_path }}/templates/i2psnark"
when: localservices.i2psnark.url | length > 0 when: localservices.i2psnark.url | length > 0
- name: copy docker files for i2psnark
copy:
src: i2psnark
dest: "{{ path }}"
- name: template docker compose - name: template docker compose
template: template:

View File

@ -77,34 +77,39 @@ services:
{% if localservices.i2psnark.url | length > 0 %} {% if localservices.i2psnark.url | length > 0 %}
i2psnark: i2psnark:
image: ypopovych/i2psnark:latest build:
dockerfile: Dockerfile
context: i2psnark
volumes: volumes:
- ./config/i2psnark.config:/snark/config/i2psnark.config - ./config/i2psnark.config:/snark/i2psnark/i2psnark.config
- {{ localservices.i2psnark.data_path }}:/snark/downloads - {{ localservices.i2psnark.data_path }}:/snark/downloads
networks: networks:
- proxy - proxy
environment:
HOSTNAMES: "{{ localservices.i2psnark.url }}"
I2CP_HOST: "{{ localservices.i2psnark.i2pc_host }}"
restart: "on-failure" restart: "on-failure"
i2psnark-proxy:
image: nginx:alpine
restart: unless-stopped
depends_on:
- i2psnark
volumes:
- ./config/i2psnark_nginx.conf:/etc/nginx/templates/default.conf.template:ro
networks:
- proxy
labels: labels:
traefik.enable: true traefik.enable: true
traefik.http.routers.i2psnark.rule: "Host(`{{ localservices.i2psnark.url }}`) && (PathPrefix(`/i2psnark/`) || Path(`/`))" traefik.http.routers.i2psnark.rule: "Host(`{{ localservices.i2psnark.url }}`) && (PathPrefix(`/i2psnark/`) || Path(`/`))"
traefik.http.routers.i2psnark.tls: "true" traefik.http.routers.i2psnark.tls: "true"
traefik.http.routers.i2psnark.tls.certresolver: hetzner traefik.http.routers.i2psnark.tls.certresolver: hetzner
traefik.http.routers.i2psnark.service: i2psnark traefik.http.routers.i2psnark.service: i2psnark
traefik.http.services.i2psnark.loadbalancer.server.port: "8002" traefik.http.services.i2psnark.loadbalancer.server.port: "8080"
traefik.http.middlewares.i2psnark-redirect.redirectregex.regex: "^/$" traefik.http.routers.i2psnark.middlewares: local-only@file, traefik-auth@file
traefik.http.middlewares.i2psnark-redirect.redirectregex.replacement: "/i2psnark/"
traefik.http.middlewares.i2psnark-redirect.redirectregex.permanent: "true" {% endif %}
traefik.http.middlewares.i2psnark-headers.headers.customRequestHeaders.Host: {{ localservices.i2psnark.url }}
traefik.http.middlewares.i2psnark-headers.headers.customRequestHeaders.X-Forwarded-Proto: https
traefik.http.routers.i2psnark.middlewares: local-only@file, traefik-auth@file, i2psnark-redirect, i2psnark-headers
{% endif %}
networks: networks:
proxy: proxy:

View File

@ -0,0 +1,40 @@
# We need to use this as a proxy because allowing non local domains
# doese not work for i2pshark standalone...
server {
listen 8080;
server_name _;
# Redirect the root to the I2PSnark application.
location = / {
return 302 https://{{ localservices.i2psnark.url }}/i2psnark/;
}
location / {
proxy_pass http://i2psnark:8002;
proxy_http_version 1.1;
# I2PSnark requires localhost headers.
proxy_set_header Host 127.0.0.1;
proxy_set_header Origin http://127.0.0.1;
# Preserve HTTPS information.
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host {{ localservices.i2psnark.url }};
# Rewrite absolute redirects from the backend.
proxy_redirect http://127.0.0.1:8002/ https://{{ localservices.i2psnark.url }}/;
proxy_redirect http://127.0.0.1/ https://{{ localservices.i2psnark.url }}/;
# Forward client information.
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Support longer-running requests.
proxy_connect_timeout 60s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
proxy_buffering off;
}
}