Skip to content

Commit 6951ce4

Browse files
committed
Use new service format.
1 parent 6a9cec9 commit 6951ce4

File tree

6 files changed

+38
-2
lines changed

6 files changed

+38
-2
lines changed

docker/rootfs/etc/s6-overlay/s6-rc.d/cs-crowdsec-bouncer/dependencies.d/prepare

Whitespace-only changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/command/with-contenv bash
2+
3+
set -e # Exit immediately if a command exits with a non-zero status.
4+
5+
mkdir -p /data/crowdsec/templates
6+
echo "Deploy Crowdsec Openresty Bouncer.."
7+
sed -i 's|/defaults/crowdsec|/data/crowdsec|' /etc/nginx/conf.d/crowdsec_openresty.conf
8+
9+
if [ -f /data/crowdsec/crowdsec-openresty-bouncer.conf ]; then
10+
echo "Patch crowdsec-openresty-bouncer.conf .."
11+
sed "s/=.*//g" /data/crowdsec/crowdsec-openresty-bouncer.conf > /tmp/crowdsec.conf.raw
12+
sed "s/=.*//g" /defaults/crowdsec/crowdsec-openresty-bouncer.conf > /tmp/crowdsec-openresty-bouncer.conf.raw
13+
if grep -vf /tmp/crowdsec.conf.raw /tmp/crowdsec-openresty-bouncer.conf.raw ; then
14+
grep -vf /tmp/crowdsec.conf.raw /tmp/crowdsec-openresty-bouncer.conf.raw > /tmp/config.newvals
15+
cp /data/crowdsec/crowdsec-openresty-bouncer.conf /data/crowdsec/crowdsec-openresty-bouncer.conf.bak
16+
grep -f /tmp/config.newvals /defaults/crowdsec/crowdsec-openresty-bouncer.conf >> /data/crowdsec/crowdsec-openresty-bouncer.conf
17+
fi
18+
else
19+
echo "Deploy new crowdsec-openresty-bouncer.conf .."
20+
cp /defaults/crowdsec/crowdsec-openresty-bouncer.conf /data/crowdsec/crowdsec-openresty-bouncer.conf
21+
fi
22+
#Make sure the config location is where we get the config from instead of /default/
23+
sed -i 's|/defaults/crowdsec|/data/crowdsec|' /data/crowdsec/crowdsec-openresty-bouncer.conf
24+
echo "Deploy Crowdsec Templates .."
25+
#Make sure we only copy files that don't exist in /data/crowdsec.
26+
cd /defaults/crowdsec/templates/
27+
for file in *.html
28+
do
29+
if [ ! -e "/data/crowdsec/templates/${file}" ]
30+
then
31+
cp -r "/defaults/crowdsec/templates/${file}" "/data/crowdsec/templates/"
32+
fi
33+
done
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# shellcheck shell=bash
2+
/etc/s6-overlay/s6-rc.d/cs-crowdsec-bouncer/script.sh

docker/rootfs/etc/s6-overlay/s6-rc.d/nginx/dependencies.d/cs-crowdsec-bouncer

Whitespace-only changes.

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/99_crowdsec-openresty-bouncer.sh

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/with-contenv bash
1+
#!/command/with-contenv bash
22

33
set -e # Exit immediately if a command exits with a non-zero status.
44

@@ -21,7 +21,7 @@ else
2121
fi
2222
#Make sure the config location is where we get the config from instead of /default/
2323
sed -i 's|/defaults/crowdsec|/data/crowdsec|' /data/crowdsec/crowdsec-openresty-bouncer.conf
24-
echo "Deploy Templates .."
24+
echo "Deploy Crowdsec Templates .."
2525
#Make sure we only copy files that don't exist in /data/crowdsec.
2626
cd /defaults/crowdsec/templates/
2727
for file in *.html

0 commit comments

Comments
 (0)