Compare commits

..

No commits in common. "master" and "dind" have entirely different histories.
master ... dind

4 changed files with 9 additions and 72 deletions

View File

@ -1,10 +1,11 @@
---
kind: pipeline
type: exec
type: docker
name: default
steps:
- name: build and push
image: docker:dind
commands:
- "docker build -t plnk . "
- "echo $PLNK_REGISTRY_PASSWD | docker login --password-stdin --username drone https://plnk.littleoni.net"

View File

@ -1,14 +1,12 @@
FROM debian:latest
COPY resources /build
## Upgrade packages on system
RUN apt-get update
## Install build tools
RUN apt-get install -y \
g++\
gcc\
make\
patch
RUN apt-get install -y g++ gcc make patch
## Install package dependencies
RUN apt-get install -y \
@ -30,10 +28,7 @@ RUN apt-get install -y \
uuid-dev
## Install GONK specific dependencies
RUN apt-get install -y fail2ban iptables net-tools cron
## Copy over source and other scripts
COPY resources /build
RUN apt-get install -y fail2ban iptables net-tools
## Move and unpack source to /build
RUN mkdir /build/asterisk-current
@ -50,12 +45,9 @@ RUN make install
## Cleanup
WORKDIR /
RUN cp /build/reload.sh /usr/bin/reload
RUN chmod +x /usr/bin/reload
RUN cp /build/gonk.sh /usr/bin/gonk
RUN chmod +x /usr/bin/gonk
RUN rm -rf /build
RUN apt-get remove -y --purge g++ gcc make patch
RUN apt-get autoremove -y && apt-get clean -y && apt-get autoclean -y
ENTRYPOINT [ "gonk" ]

View File

@ -1,8 +1,5 @@
#!/bin/bash
echo "Starting pre-requisite services..."
service cron start
echo "Starting Gonk node..."
echo " ______
@ -14,12 +11,8 @@ echo " ______
|/\|/\|"
if [ -f /var/gonk ]; then
echo "Gonk has already been provisioned"
service fail2ban start
else
echo "Running first time provisioning..."
@ -31,48 +24,12 @@ else
chown -R gonk:gonk /var/spool/asterisk
echo " Pulling config files for the first time..."
curl -s https://ap5.gonknet.org/asterisk/$HOSTNAME/$GONK_KEY > /etc/asterisk/asterisk.conf
curl -s https://ap5.gonknet.org/asterisk/pjsip/$HOSTNAME/$GONK_KEY > /etc/asterisk/pjsip.conf
curl -s https://ap5.gonknet.org/asterisk/modules/$HOSTNAME/$GONK_KEY > /etc/asterisk/modules.conf
curl -s https://ap5.gonknet.org/asterisk/logger/$HOSTNAME/$GONK_KEY > /etc/asterisk/logger.conf
curl -s https://ap5.gonknet.org/asterisk/extensions/$HOSTNAME/$GONK_KEY > /etc/asterisk/extensions.conf
sed -i "s/##EXTERNAL_IP##/$(curl -s https://ipv4.myip.wtf/text)/g" /etc/asterisk/pjsip.conf
echo " Setting up config updater cron..."
echo "26 * * * * gonk /usr/bin/reload" > /etc/cron.d/reload
echo " Setting up VOIPBL..."
echo " Downloading script..."
curl -s https://gonknet.org/static/voipbl.sh > /usr/bin/voipbl.sh
chmod 700 /usr/bin/voipbl.sh
chmod +x /usr/bin/voipbl.sh
echo " Setting up VOIPBL cron..."
echo "13 */4 * * * root /usr/bin/voipbl.sh" > /etc/cron.d/voipbl
echo " Setting up fail2ban"
curl -s https://ap5.gonknet.org/f2b/asterisk/$HOSTNAME/$GONK_KEY > /etc/fail2ban/jail.d/asterisk.conf
curl -s https://ap5.gonknet.org/f2b/voipbl/$HOSTNAME/$GONK_KEY > /etc/fail2ban/action.d/voipbl.conf
rm /etc/fail2ban/jail.d/defaults-debian.conf
asterisk -U gonk -G gonk
sleep 2
kill -9 -- $(cat /var/run/asterisk/asterisk.pid)
service fail2ban start
echo " Running voipbl for the first time"
/usr/bin/voipbl.sh
curl -o /etc/asterisk/asterisk.conf https://api.gonk.nicolor.tech/asterisk/$HOSTNAME/$GONK_KEY
curl -o /etc/asterisk/pjsip.conf https://api.gonk.nicolor.tech/pjsip/$HOSTNAME/$GONK_KEY
curl -o /etc/asterisk/modules.conf https://api.gonk.nicolor.tech/modules/$HOSTNAME/$GONK_KEY
touch /var/gonk
fi
echo "Starting Asterisk..."
asterisk -U gonk -G gonk -f

View File

@ -1,13 +0,0 @@
#! /bin/bash
echo "Reloading config files..."
curl -s https://ap5.gonknet.org/asterisk/$HOSTNAME/$GONK_KEY > /etc/asterisk/asterisk.conf
curl -s https://ap5.gonknet.org/asterisk/pjsip/$HOSTNAME/$GONK_KEY > /etc/asterisk/pjsip.conf
curl -s https://ap5.gonknet.org/asterisk/modules/$HOSTNAME/$GONK_KEY > /etc/asterisk/modules.conf
curl -s https://ap5.gonknet.org/asterisk/logger/$HOSTNAME/$GONK_KEY > /etc/asterisk/logger.conf
curl -s https://ap5.gonknet.org/asterisk/extensions/$HOSTNAME/$GONK_KEY > /etc/asterisk/extensions.conf
sed -i "s/##EXTERNAL_IP##/$(curl https://ipv4.myip.wtf/text)/g" /etc/asterisk/pjsip.conf
asterisk -x "core restart when convenient"