Skip to content

Commit

Permalink
Containerize pfldapexplorer
Browse files Browse the repository at this point in the history
  • Loading branch information
VakarisZ authored and VakarisZ committed Jul 3, 2023
1 parent 353e77d commit 54bf48c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ pfdeb_based_dev:
- "haproxy-portal"
- "haproxy-admin"
- "proxysql"
- "pfldapexplorer"

img_dev:
extends:
Expand Down Expand Up @@ -718,6 +719,7 @@ pfdeb_based_br_maint:
- "haproxy-portal"
- "haproxy-admin"
- "proxysql"
- "pfldapexplorer"

img_br_maint:
extends:
Expand Down Expand Up @@ -797,6 +799,7 @@ pfdeb_based_cloud_nac:
- "haproxy-portal"
- "haproxy-admin"
- "proxysql"
- "pfldapexplorer"

img_cloud_nac:
extends:
Expand Down Expand Up @@ -876,6 +879,7 @@ pfdeb_based_rel:
- "haproxy-portal"
- "haproxy-admin"
- "proxysql"
- "pfldapexplorer"

img_rel:
extends:
Expand Down
19 changes: 13 additions & 6 deletions conf/systemd/packetfence-pfldapexplorer.service
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# Copyright (C) Inverse inc.
[Unit]
Description=PacketFence LDAP Explorer Daemon
Description=PacketFence LDAP Explorer Service
Wants=packetfence-base.target packetfence-config.service packetfence-iptables.service
After=packetfence-base.target packetfence-config.service packetfence-iptables.service
Before=packetfence-httpd.portal.service
Before=packetfence-docker-iptables.service
Requires=packetfence-docker-iptables.service
PartOf=packetfence-docker-iptables.service

[Service]
StartLimitBurst=3
StartLimitInterval=60
Type=notify
Environment=LOG_LEVEL=INFO
ExecStart=/usr/local/pf/sbin/pfhttpd -conf /usr/local/pf/conf/caddy-services/pfldapexplorer.conf -log-name=pfldapexplorer
TimeoutStopSec=60
NotifyAccess=all
LimitNOFILE=8192
ExecStartPre=/bin/perl -I/usr/local/pf/lib -I/usr/local/pf/lib_perl/lib/perl5 '-Mpf::services::manager::pfldapexplorer' -e 'pf::services::manager::pfldapexplorer->new()->generateConfig()'
ExecStart=/usr/local/pf/sbin/pfldapexplorer-docker-wrapper
ExecStop=/bin/bash -c "docker stop pfldapexplorer; echo Stopped"
Restart=on-failure
Slice=packetfence.slice
PIDFile=/usr/local/pf/var/run/pfldapexplorer-systemd-notify.pid

[Install]
WantedBy=packetfence.target
WantedBy=packetfence.target
20 changes: 20 additions & 0 deletions containers/pfldapexplorer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ARG KNK_REGISTRY_URL
ARG IMAGE_TAG
FROM ${KNK_REGISTRY_URL}/pfbuild-debian-bullseye:${IMAGE_TAG}
RUN mkdir -p /usr/local/pf/
WORKDIR /usr/local/pf/

COPY go/go.mod /usr/local/pf/go/
COPY go/go.sum /usr/local/pf/go/
RUN cd /usr/local/pf/go/ && go mod download

COPY ./go /usr/local/pf/go
COPY ./lib /usr/local/pf/lib
COPY ./config.mk /usr/local/pf/config.mk
RUN cd /usr/local/pf/go/ && make pfhttpd

FROM ${KNK_REGISTRY_URL}/pfdebian:${IMAGE_TAG}
WORKDIR /usr/local/pf/
COPY ./config.mk /usr/local/pf/config.mk
COPY --from=0 /usr/local/pf/go/pfhttpd /usr/local/pf/sbin/pfhttpd
ENTRYPOINT /usr/local/pf/sbin/pfhttpd -conf /usr/local/pf/conf/caddy-services/pfldapexplorer.conf -log-name pfldapexplorer
12 changes: 12 additions & 0 deletions sbin/pfldapexplorer-docker-wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
!/bin/bash

source /usr/local/pf/containers/systemd-service

name=pfldapexplorer

args=`base_args $name`
args="$args -v /usr/local/pf/conf:/usr/local/pf/conf -p 100.64.0.1:22226:22226 -p 127.0.0.1:22226:22226"

cd /usr/local/pf/

run $name "$args"

0 comments on commit 54bf48c

Please sign in to comment.