1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-08-16 18:01:35 +00:00

tests: make complement work & switch to Caddyfile

This commit is contained in:
Matthias Ahouansou 2025-07-15 21:50:23 +01:00
parent 92ce47aa71
commit 54916a25bf
4 changed files with 38 additions and 77 deletions

View file

@ -33,5 +33,5 @@ cat "$LOG_FILE" | jq -c '
select( select(
(.Action == "pass" or .Action == "fail" or .Action == "skip") (.Action == "pass" or .Action == "fail" or .Action == "skip")
and .Test != null and .Test != null
) | {Action: .Action, Test: .Test} ) | {Test: .Test, Action: .Action}
' | sort > "$RESULTS_FILE" ' | sort > "$RESULTS_FILE"

30
complement/Caddyfile Normal file
View file

@ -0,0 +1,30 @@
{
log default {
level WARN
}
https_port 8448
default_sni your.server.name
local_certs
pki {
ca local {
name "Complement CA"
root {
cert /complement/ca/ca.crt
key /complement/ca/ca.key
}
intermediate {
cert /complement/ca/ca.crt
key /complement/ca/ca.key
}
}
}
}
your.server.name
reverse_proxy 127.0.0.1:8008
tls {
issuer internal {
ca local
}
}

View file

@ -1,4 +1,4 @@
FROM rust:1.81.0 FROM rust:1.85.0
WORKDIR /workdir WORKDIR /workdir
@ -8,6 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY Cargo.toml Cargo.toml COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock COPY Cargo.lock Cargo.lock
COPY src src COPY src src
COPY .cargo .cargo
RUN cargo build --release \ RUN cargo build --release \
&& mv target/release/conduit conduit \ && mv target/release/conduit conduit \
&& rm -rf target && rm -rf target
@ -27,7 +28,7 @@ RUN apt-get update \
&& apt-get install -y caddy && apt-get install -y caddy
COPY conduit-example.toml conduit.toml COPY conduit-example.toml conduit.toml
COPY complement/caddy.json caddy.json COPY complement/Caddyfile Caddyfile
ENV SERVER_NAME=localhost ENV SERVER_NAME=localhost
ENV CONDUIT_CONFIG=/workdir/conduit.toml ENV CONDUIT_CONFIG=/workdir/conduit.toml
@ -35,11 +36,13 @@ ENV CONDUIT_CONFIG=/workdir/conduit.toml
RUN sed -i "s/port = 6167/port = 8008/g" conduit.toml RUN sed -i "s/port = 6167/port = 8008/g" conduit.toml
RUN echo "log = \"warn,_=off,sled=off\"" >> conduit.toml RUN echo "log = \"warn,_=off,sled=off\"" >> conduit.toml
RUN sed -i "s/address = \"127.0.0.1\"/address = \"0.0.0.0\"/g" conduit.toml RUN sed -i "s/address = \"127.0.0.1\"/address = \"0.0.0.0\"/g" conduit.toml
RUN sed -i "s/registration_token = \"\"//g" conduit.toml
RUN sed -i "s/allow_check_for_updates = true/allow_check_for_updates = false/g" conduit.toml
EXPOSE 8008 8448 EXPOSE 8008 8448
CMD uname -a && \ CMD uname -a && \
sed -i "s/#server_name = \"your.server.name\"/server_name = \"${SERVER_NAME}\"/g" conduit.toml && \ sed -i "s/#server_name = \"your.server.name\"/server_name = \"${SERVER_NAME}\"/g" conduit.toml && \
sed -i "s/your.server.name/${SERVER_NAME}/g" caddy.json && \ sed -i "s/your.server.name/${SERVER_NAME}/g" Caddyfile && \
caddy start --config caddy.json > /dev/null && \ caddy start > /dev/null && \
/workdir/conduit /workdir/conduit

View file

@ -1,72 +0,0 @@
{
"logging": {
"logs": {
"default": {
"level": "WARN"
}
}
},
"apps": {
"http": {
"https_port": 8448,
"servers": {
"srv0": {
"listen": [":8448"],
"routes": [{
"match": [{
"host": ["your.server.name"]
}],
"handle": [{
"handler": "subroute",
"routes": [{
"handle": [{
"handler": "reverse_proxy",
"upstreams": [{
"dial": "127.0.0.1:8008"
}]
}]
}]
}],
"terminal": true
}],
"tls_connection_policies": [{
"match": {
"sni": ["your.server.name"]
}
}]
}
}
},
"pki": {
"certificate_authorities": {
"local": {
"name": "Complement CA",
"root": {
"certificate": "/complement/ca/ca.crt",
"private_key": "/complement/ca/ca.key"
},
"intermediate": {
"certificate": "/complement/ca/ca.crt",
"private_key": "/complement/ca/ca.key"
}
}
}
},
"tls": {
"automation": {
"policies": [{
"subjects": ["your.server.name"],
"issuers": [{
"module": "internal"
}],
"on_demand": true
}, {
"issuers": [{
"module": "internal",
"ca": "local"
}]
}]
}
}
}
}