Changing path Linux folder
This commit is contained in:
parent
5ae714fc70
commit
04578aab3f
|
@ -10,7 +10,7 @@ RUN dnf install -y epel-release && \
|
|||
gem install fpm
|
||||
|
||||
# Copy dependencies sources folder
|
||||
COPY deps /tmp/bunkerweb/deps
|
||||
COPY bw/deps /tmp/bunkerweb/deps
|
||||
|
||||
# Nginx
|
||||
COPY linux/nginx.repo /etc/yum.repos.d/nginx.repo
|
||||
|
@ -19,55 +19,57 @@ RUN dnf install yum-utils -y && \
|
|||
|
||||
# Compile and install dependencies
|
||||
RUN dnf install -y python39-pip brotli brotli-devel gperftools-devel perl libxslt-devel libxml2 libxslt bash gd gd-devel gcc-c++ kernel-devel curl znc-modtcl libmpc-devel gmp-devel gawk mpfr-devel libtool pcre-devel automake autoconf readline-devel gcc make openssl-devel git zlib-devel libxml2-devel pkgconf libcurl-devel geoip-devel lmdb-libs && \
|
||||
mkdir -p /opt/bunkerweb/deps && \
|
||||
mkdir -p /usr/share/bunkerweb/deps && \
|
||||
chmod +x /tmp/bunkerweb/deps/install.sh && \
|
||||
bash /tmp/bunkerweb/deps/install.sh && \
|
||||
mkdir /opt/bunkerweb/deps/python && \
|
||||
pip3.9 install --no-cache-dir --require-hashes --target /opt/bunkerweb/deps/python -r /tmp/bunkerweb/deps/requirements.txt
|
||||
mkdir /usr/share/bunkerweb/deps/python && \
|
||||
pip3.9 install --no-cache-dir --require-hashes --target /usr/share/bunkerweb/deps/python -r /tmp/bunkerweb/deps/requirements.txt
|
||||
|
||||
# Copy BW files
|
||||
# Copy files
|
||||
# can't exclude deps from . so we are copying everything by hand
|
||||
COPY api /opt/bunkerweb/api
|
||||
COPY cli /opt/bunkerweb/cli
|
||||
COPY confs /opt/bunkerweb/confs
|
||||
COPY core /opt/bunkerweb/core
|
||||
COPY gen /opt/bunkerweb/gen
|
||||
COPY helpers /opt/bunkerweb/helpers
|
||||
COPY job /opt/bunkerweb/job
|
||||
COPY lua /opt/bunkerweb/lua
|
||||
COPY misc /opt/bunkerweb/misc
|
||||
COPY utils /opt/bunkerweb/utils
|
||||
COPY ui /opt/bunkerweb/ui
|
||||
COPY settings.json /opt/bunkerweb/settings.json
|
||||
COPY VERSION /opt/bunkerweb/VERSION
|
||||
COPY bw/api /usr/share/bunkerweb/api
|
||||
COPY bw/core /usr/share/bunkerweb/core
|
||||
COPY bw/cli /usr/share/bunkerweb/cli
|
||||
COPY bw/helpers /usr/share/bunkerweb/helpers
|
||||
COPY bw/lua /usr/share/bunkerweb/lua
|
||||
COPY bw/misc /usr/share/bunkerweb/misc
|
||||
COPY bw/gen /usr/share/bunkerweb/gen
|
||||
COPY bw/settings.json etc/bunkerweb/settings.json
|
||||
COPY db /usr/share/bunkerweb/db
|
||||
COPY bw/confs /etc/bunkerweb/confs
|
||||
COPY bw/loading /usr/share/bunkerweb/loading
|
||||
COPY utils /usr/share/bunkerweb/utils
|
||||
COPY VERSION /usr/share/bunkerweb/VERSION
|
||||
COPY scheduler /usr/share/bunkerweb/scheduler
|
||||
COPY ui /usr/share/bunkerweb/ui
|
||||
|
||||
# Setup BW
|
||||
RUN cp /opt/bunkerweb/helpers/bwcli /usr/local/bin && \
|
||||
chmod 755 /usr/local/bin/bwcli && \
|
||||
mkdir /opt/bunkerweb/configs && \
|
||||
mkdir /opt/bunkerweb/cache && \
|
||||
mkdir /opt/bunkerweb/plugins && \
|
||||
mkdir /opt/bunkerweb/tmp && \
|
||||
mkdir /opt/bunkerweb/www && \
|
||||
find /opt/bunkerweb -path /opt/bunkerweb/deps -prune -o -type f -exec chmod 0740 {} \; && \
|
||||
find /opt/bunkerweb -path /opt/bunkerweb/deps -prune -o -type d -exec chmod 0750 {} \; && \
|
||||
chmod 770 /opt/bunkerweb/cache /opt/bunkerweb/tmp && \
|
||||
chmod 750 /opt/bunkerweb/gen/main.py /opt/bunkerweb/job/main.py /opt/bunkerweb/cli/main.py /opt/bunkerweb/helpers/*.sh /opt/bunkerweb/ui/main.py /opt/bunkerweb/www && \
|
||||
find /opt/bunkerweb/core/*/jobs/* -type f -exec chmod 750 {} \; && \
|
||||
pip3.9 install --no-cache-dir --target /opt/bunkerweb/deps/python -r /opt/bunkerweb/ui/requirements.txt && \
|
||||
chmod 755 /opt/bunkerweb
|
||||
RUN cp /usr/share/bunkerweb/helpers/bwcli /usr/bin/ && \
|
||||
chmod 755 /usr/bin/bwcli && \
|
||||
mkdir /etc/bunkerweb/configs && \
|
||||
mkdir /var/cache/bunkerweb/ && \
|
||||
mkdir /etc/bunkerweb/plugins && \
|
||||
mkdir /var/tmp/bunkerweb/ && \
|
||||
#mkdir /var/www/html && \
|
||||
echo "Linux" > /usr/share/bunkerweb/INTEGRATION && \
|
||||
find /usr/share/bunkerweb -path /usr/share/bunkerweb/ui/deps -prune -o -type f -exec chmod 0740 {} \; && \
|
||||
find /usr/share/bunkerweb -path /usr/share/bunkerweb/ui/deps -prune -o -type d -exec chmod 0750 {} \; && \
|
||||
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ && \
|
||||
chmod 750 /usr/share/bunkerweb/gen/main.py /usr/share/bunkerweb/scheduler/main.py /usr/share/bunkerweb/cli/main.py /usr/share/bunkerweb/helpers/*.sh /usr/share/bunkerweb/ui/main.py && \
|
||||
find /usr/share/bunkerweb/core/*/jobs/* -type f -exec chmod 750 {} \; && \
|
||||
pip3.9 install --no-cache-dir --require-hashes --no-deps --target /usr/bin/bunkerweb/deps/python -r /usr/bin/bunkerweb/ui/deps/requirements.txt && \
|
||||
chmod 755 /usr/share/bunkerweb
|
||||
|
||||
# Copy Linux files
|
||||
COPY linux/variables.env /opt/bunkerweb/variables.env
|
||||
COPY linux/ui.env /opt/bunkerweb/ui.env
|
||||
COPY linux/scripts /opt/bunkerweb/scripts
|
||||
COPY linux/fpm.sh /opt/fpm.sh
|
||||
RUN chmod +x /opt/bunkerweb/scripts/*.sh /opt/fpm.sh
|
||||
COPY linux/fpm-centos /opt/.fpm
|
||||
COPY linux/bunkerweb.service /opt/bunkerweb.service
|
||||
COPY linux/bunkerweb-ui.service /opt/bunkerweb-ui.service
|
||||
COPY linux/variables.env /etc/bunkerweb/variables.env
|
||||
COPY linux/ui.env /etc/bunkerweb/ui.env
|
||||
COPY linux/scripts /usr/share/bunkerweb/scripts
|
||||
COPY linux/fpm.sh /usr/share/fpm.sh
|
||||
RUN chmod +x /usr/share/bunkerweb/scripts/*.sh /usr/share/fpm.sh
|
||||
COPY linux/fpm-ubuntu /usr/share/.fpm
|
||||
COPY linux/bunkerweb.service /usr/share/bunkerweb.service
|
||||
COPY linux/bunkerweb-ui.service /usr/share/bunkerweb-ui.service
|
||||
|
||||
# Generate RPM at startup
|
||||
# Generate DEB at startup
|
||||
VOLUME /data
|
||||
WORKDIR /opt
|
||||
ENTRYPOINT ["/opt/fpm.sh", "rpm"]
|
||||
WORKDIR /usr/share/
|
||||
ENTRYPOINT ["/usr/share/fpm.sh", "deb"]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
FROM debian:bullseye-slim
|
||||
|
||||
ENV OS=debian
|
||||
ENV NGINX_VERSION 1.20.2
|
||||
|
||||
# Install fpm
|
||||
|
@ -8,11 +9,11 @@ RUN apt update && \
|
|||
gem install fpm
|
||||
|
||||
# Copy dependencies sources folder
|
||||
COPY deps /tmp/bunkerweb/deps
|
||||
COPY bw/deps /tmp/bunkerweb/deps
|
||||
|
||||
# Nginx
|
||||
RUN apt update && \
|
||||
apt-get install gnupg2 ca-certificates -y && \
|
||||
apt-get install gnupg2 ca-certificates wget -y && \
|
||||
echo "deb https://nginx.org/packages/debian/ bullseye nginx" > /etc/apt/sources.list.d/nginx.list && \
|
||||
echo "deb-src https://nginx.org/packages/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list && \
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ABF5BD827BD9BF62 && \
|
||||
|
@ -22,55 +23,64 @@ RUN apt update && \
|
|||
# Compile and install dependencies
|
||||
RUN apt update && \
|
||||
apt install --no-install-recommends bash python3-pip libssl-dev git libpcre++-dev zlib1g-dev libxml2-dev libyajl-dev pkgconf libcurl4-openssl-dev libgeoip-dev liblmdb-dev apt-utils bash build-essential autoconf libtool automake g++ gcc libxml2-dev make musl-dev gnupg patch libreadline-dev libpcre3-dev libgd-dev -y && \
|
||||
mkdir -p /opt/bunkerweb/deps && \
|
||||
mkdir -p /usr/share/bunkerweb/deps && \
|
||||
chmod +x /tmp/bunkerweb/deps/install.sh && \
|
||||
bash /tmp/bunkerweb/deps/install.sh && \
|
||||
mkdir /opt/bunkerweb/deps/python && \
|
||||
pip install --no-cache-dir --require-hashes --target /opt/bunkerweb/deps/python -r /tmp/bunkerweb/deps/requirements.txt
|
||||
|
||||
# Copy BW files
|
||||
mkdir /usr/share/bunkerweb/deps/python && \
|
||||
pip3 install --no-cache-dir --require-hashes --target /usr/share/bunkerweb/deps/python -r /tmp/bunkerweb/deps/requirements.txt
|
||||
# Copy files
|
||||
# can't exclude deps from . so we are copying everything by hand
|
||||
COPY api /opt/bunkerweb/api
|
||||
COPY cli /opt/bunkerweb/cli
|
||||
COPY confs /opt/bunkerweb/confs
|
||||
COPY core /opt/bunkerweb/core
|
||||
COPY gen /opt/bunkerweb/gen
|
||||
COPY helpers /opt/bunkerweb/helpers
|
||||
COPY job /opt/bunkerweb/job
|
||||
COPY lua /opt/bunkerweb/lua
|
||||
COPY misc /opt/bunkerweb/misc
|
||||
COPY utils /opt/bunkerweb/utils
|
||||
COPY ui /opt/bunkerweb/ui
|
||||
COPY settings.json /opt/bunkerweb/settings.json
|
||||
COPY VERSION /opt/bunkerweb/VERSION
|
||||
COPY bw/api /usr/share/bunkerweb/api
|
||||
COPY bw/core /usr/share/bunkerweb/core
|
||||
COPY bw/cli /usr/share/bunkerweb/cli
|
||||
COPY bw/helpers /usr/share/bunkerweb/helpers
|
||||
COPY bw/lua /usr/share/bunkerweb/lua
|
||||
COPY bw/misc /usr/share/bunkerweb/misc
|
||||
COPY bw/gen /usr/share/bunkerweb/gen
|
||||
COPY bw/settings.json etc/bunkerweb/settings.json
|
||||
COPY db /usr/share/bunkerweb/db
|
||||
COPY bw/confs /etc/bunkerweb/confs
|
||||
COPY bw/loading /usr/share/bunkerweb/loading
|
||||
COPY utils /usr/share/bunkerweb/utils
|
||||
COPY VERSION /usr/share/bunkerweb/VERSION
|
||||
COPY scheduler /usr/share/bunkerweb/scheduler
|
||||
COPY ui /usr/share/bunkerweb/ui
|
||||
|
||||
# Setup BW
|
||||
RUN cp /opt/bunkerweb/helpers/bwcli /usr/local/bin && \
|
||||
chmod 755 /usr/local/bin/bwcli && \
|
||||
mkdir /opt/bunkerweb/configs && \
|
||||
mkdir /opt/bunkerweb/cache && \
|
||||
mkdir /opt/bunkerweb/plugins && \
|
||||
mkdir /opt/bunkerweb/tmp && \
|
||||
mkdir /opt/bunkerweb/www && \
|
||||
find /opt/bunkerweb -path /opt/bunkerweb/deps -prune -o -type f -exec chmod 0740 {} \; && \
|
||||
find /opt/bunkerweb -path /opt/bunkerweb/deps -prune -o -type d -exec chmod 0750 {} \; && \
|
||||
chmod 770 /opt/bunkerweb/cache /opt/bunkerweb/tmp && \
|
||||
chmod 750 /opt/bunkerweb/gen/main.py /opt/bunkerweb/job/main.py /opt/bunkerweb/cli/main.py /opt/bunkerweb/helpers/*.sh /opt/bunkerweb/ui/main.py /opt/bunkerweb/www && \
|
||||
find /opt/bunkerweb/core/*/jobs/* -type f -exec chmod 750 {} \; && \
|
||||
pip install --no-cache-dir --target /opt/bunkerweb/deps/python -r /opt/bunkerweb/ui/requirements.txt && \
|
||||
chmod 755 /opt/bunkerweb
|
||||
RUN cp /usr/share/bunkerweb/helpers/bwcli /usr/bin/ && \
|
||||
chmod 755 /usr/bin/bwcli && \
|
||||
mkdir /etc/bunkerweb/configs && \
|
||||
mkdir /var/cache/bunkerweb/ && \
|
||||
mkdir /etc/bunkerweb/plugins && \
|
||||
mkdir /var/tmp/bunkerweb/ && \
|
||||
#mkdir /var/www/html && \
|
||||
echo "Linux" > /usr/share/bunkerweb/INTEGRATION && \
|
||||
#It's a find command that will find all files in the bunkerweb directory, excluding the ui/deps directory, and then chmod them to 0740.
|
||||
find /usr/share/bunkerweb -path /usr/share/bunkerweb/ui/deps -prune -o -type f -exec chmod 0740 {} \; && \
|
||||
#It's a find command that will find all files in the bunkerweb directory, excluding the ui/deps directory, and then chmod them to 0740.
|
||||
find /usr/share/bunkerweb -path /usr/share/bunkerweb/ui/deps -prune -o -type d -exec chmod 0750 {} \; && \
|
||||
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ && \
|
||||
chmod 750 /usr/share/bunkerweb/gen/main.py /usr/share/bunkerweb/scheduler/main.py /usr/share/bunkerweb/cli/main.py /usr/share/bunkerweb/helpers/*.sh /usr/share/bunkerweb/ui/main.py && \
|
||||
# Don't forget to add /var/www/html on the above line
|
||||
find /usr/share/bunkerweb/core/*/jobs/* -type f -exec chmod 750 {} \; && \
|
||||
pip install --no-cache-dir --upgrade pip && \
|
||||
pip install wheel && \
|
||||
mkdir /usr/share/bunkerweb/ui/deps/python && \
|
||||
pip install --no-cache-dir --require-hashes --no-deps --target /usr/share/bunkerweb/deps/python -r /usr/share/bunkerweb/ui/deps/requirements.txt && \
|
||||
pip install --no-cache-dir gunicorn && \
|
||||
chmod 755 /usr/share/bunkerweb
|
||||
|
||||
# Copy Linux files
|
||||
COPY linux/variables.env /opt/bunkerweb/variables.env
|
||||
COPY linux/ui.env /opt/bunkerweb/ui.env
|
||||
COPY linux/scripts /opt/bunkerweb/scripts
|
||||
COPY linux/fpm.sh /opt/fpm.sh
|
||||
RUN chmod +x /opt/bunkerweb/scripts/*.sh /opt/fpm.sh
|
||||
COPY linux/fpm-debian /opt/.fpm
|
||||
COPY linux/bunkerweb.service /opt/bunkerweb.service
|
||||
COPY linux/bunkerweb-ui.service /opt/bunkerweb-ui.service
|
||||
COPY linux/variables.env /etc/bunkerweb/variables.env
|
||||
COPY linux/ui.env /etc/bunkerweb/ui.env
|
||||
COPY linux/scripts /usr/share/bunkerweb/scripts
|
||||
COPY linux/fpm.sh /usr/share/fpm.sh
|
||||
RUN chmod +x /usr/share/bunkerweb/scripts/*.sh /usr/share/fpm.sh
|
||||
COPY linux/fpm-ubuntu /usr/share/.fpm
|
||||
COPY linux/bunkerweb.service /usr/share/bunkerweb.service
|
||||
COPY linux/bunkerweb-ui.service /usr/share/bunkerweb-ui.service
|
||||
|
||||
# Generate DEB at startup
|
||||
VOLUME /data
|
||||
WORKDIR /opt
|
||||
ENTRYPOINT ["/opt/fpm.sh", "deb"]
|
||||
WORKDIR /usr/share/
|
||||
ENTRYPOINT ["/usr/share/fpm.sh", "deb"]
|
||||
|
|
|
@ -13,59 +13,62 @@ RUN dnf update -y && \
|
|||
dnf install nginx-1.20.2 -y
|
||||
|
||||
# Copy dependencies sources folder
|
||||
COPY deps /tmp/bunkerweb/deps
|
||||
COPY bw/deps /tmp/bunkerweb/deps
|
||||
|
||||
# Compile and install dependencies
|
||||
RUN dnf install -y python3-pip brotli brotli-devel gperftools-devel perl libxslt-devel libxml2 libxslt bash gd gd-devel gcc-c++ kernel-devel curl znc-modtcl libmpc-devel gmp-devel gawk mpfr-devel libtool pcre-devel automake autoconf readline-devel gcc make openssl-devel git zlib-devel libxml2-devel pkgconf libcurl-devel geoip-devel lmdb-devel && \
|
||||
mkdir -p /opt/bunkerweb/deps && \
|
||||
mkdir -p /usr/share/bunkerweb/deps && \
|
||||
chmod +x /tmp/bunkerweb/deps/install.sh && \
|
||||
bash /tmp/bunkerweb/deps/install.sh && \
|
||||
mkdir /opt/bunkerweb/deps/python && \
|
||||
pip install --no-cache-dir --require-hashes --target /opt/bunkerweb/deps/python -r /tmp/bunkerweb/deps/requirements.txt
|
||||
mkdir /usr/share/bunkerweb/deps/python && \
|
||||
pip install --no-cache-dir --require-hashes --target /usr/share/bunkerweb/deps/python -r /tmp/bunkerweb/deps/requirements.txt
|
||||
|
||||
# Copy BW files
|
||||
# Copy files
|
||||
# can't exclude deps from . so we are copying everything by hand
|
||||
COPY api /opt/bunkerweb/api
|
||||
COPY cli /opt/bunkerweb/cli
|
||||
COPY confs /opt/bunkerweb/confs
|
||||
COPY core /opt/bunkerweb/core
|
||||
COPY gen /opt/bunkerweb/gen
|
||||
COPY helpers /opt/bunkerweb/helpers
|
||||
COPY job /opt/bunkerweb/job
|
||||
COPY lua /opt/bunkerweb/lua
|
||||
COPY misc /opt/bunkerweb/misc
|
||||
COPY utils /opt/bunkerweb/utils
|
||||
COPY ui /opt/bunkerweb/ui
|
||||
COPY settings.json /opt/bunkerweb/settings.json
|
||||
COPY VERSION /opt/bunkerweb/VERSION
|
||||
COPY bw/api /usr/share/bunkerweb/api
|
||||
COPY bw/core /usr/share/bunkerweb/core
|
||||
COPY bw/cli /usr/share/bunkerweb/cli
|
||||
COPY bw/helpers /usr/share/bunkerweb/helpers
|
||||
COPY bw/lua /usr/share/bunkerweb/lua
|
||||
COPY bw/misc /usr/share/bunkerweb/misc
|
||||
COPY bw/gen /usr/share/bunkerweb/gen
|
||||
COPY bw/settings.json etc/bunkerweb/settings.json
|
||||
COPY db /usr/share/bunkerweb/db
|
||||
COPY bw/confs /etc/bunkerweb/confs
|
||||
COPY bw/loading /usr/share/bunkerweb/loading
|
||||
COPY utils /usr/share/bunkerweb/utils
|
||||
COPY VERSION /usr/share/bunkerweb/VERSION
|
||||
COPY scheduler /usr/share/bunkerweb/scheduler
|
||||
COPY ui /usr/share/bunkerweb/ui
|
||||
|
||||
# Setup BW
|
||||
RUN cp /opt/bunkerweb/helpers/bwcli /usr/local/bin && \
|
||||
chmod 755 /usr/local/bin/bwcli && \
|
||||
mkdir /opt/bunkerweb/configs && \
|
||||
mkdir /opt/bunkerweb/cache && \
|
||||
mkdir /opt/bunkerweb/plugins && \
|
||||
mkdir /opt/bunkerweb/tmp && \
|
||||
mkdir /opt/bunkerweb/www && \
|
||||
find /opt/bunkerweb -path /opt/bunkerweb/deps -prune -o -type f -exec chmod 0740 {} \; && \
|
||||
find /opt/bunkerweb -path /opt/bunkerweb/deps -prune -o -type d -exec chmod 0750 {} \; && \
|
||||
chmod 770 /opt/bunkerweb/cache /opt/bunkerweb/tmp && \
|
||||
chmod 750 /opt/bunkerweb/gen/main.py /opt/bunkerweb/job/main.py /opt/bunkerweb/cli/main.py /opt/bunkerweb/helpers/*.sh /opt/bunkerweb/ui/main.py /opt/bunkerweb/www && \
|
||||
find /opt/bunkerweb/core/*/jobs/* -type f -exec chmod 750 {} \; && \
|
||||
pip install --no-cache-dir --target /opt/bunkerweb/deps/python -r /opt/bunkerweb/ui/requirements.txt && \
|
||||
chmod 755 /opt/bunkerweb
|
||||
RUN cp /usr/share/bunkerweb/helpers/bwcli /usr/bin/ && \
|
||||
chmod 755 /usr/bin/bwcli && \
|
||||
mkdir /etc/bunkerweb/configs && \
|
||||
mkdir /var/cache/bunkerweb/ && \
|
||||
mkdir /etc/bunkerweb/plugins && \
|
||||
mkdir /var/tmp/bunkerweb/ && \
|
||||
#mkdir /var/www/html && \
|
||||
echo "Linux" > /usr/share/bunkerweb/INTEGRATION && \
|
||||
find /usr/share/bunkerweb -path /usr/share/bunkerweb/deps -prune -o -type f -exec chmod 0740 {} \; && \
|
||||
find /usr/share/bunkerweb -path /usr/share/bunkerweb/deps -prune -o -type d -exec chmod 0750 {} \; && \
|
||||
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ && \
|
||||
chmod 750 /usr/share/bunkerweb/gen/main.py /usr/share/bunkerweb/scheduler/main.py /usr/share/bunkerweb/cli/main.py /usr/share/bunkerweb/helpers/*.sh /usr/share/bunkerweb/ui/main.py && \
|
||||
find /usr/share/bunkerweb/core/*/jobs/* -type f -exec chmod 750 {} \; && \
|
||||
pip install --no-cache-dir --target /usr/share/bunkerweb/deps/python -r /usr/share/bunkerweb/ui/deps/requirements.txt && \
|
||||
chmod 755 /usr/share/bunkerweb
|
||||
|
||||
# Copy Linux files
|
||||
COPY linux/variables.env /opt/bunkerweb/variables.env
|
||||
COPY linux/ui.env /opt/bunkerweb/ui.env
|
||||
COPY linux/scripts /opt/bunkerweb/scripts
|
||||
COPY linux/fpm.sh /opt/fpm.sh
|
||||
RUN chmod +x /opt/bunkerweb/scripts/*.sh /opt/fpm.sh
|
||||
COPY linux/fpm-fedora /opt/.fpm
|
||||
COPY linux/bunkerweb.service /opt/bunkerweb.service
|
||||
COPY linux/bunkerweb-ui.service /opt/bunkerweb-ui.service
|
||||
COPY linux/variables.env /etc/bunkerweb/variables.env
|
||||
COPY linux/ui.env /etc/bunkerweb/ui.env
|
||||
COPY linux/scripts /usr/share/bunkerweb/scripts
|
||||
COPY linux/fpm.sh /usr/share/fpm.sh
|
||||
RUN chmod +x /usr/share/bunkerweb/scripts/*.sh /usr/share/fpm.sh
|
||||
COPY linux/fpm-ubuntu /usr/share/.fpm
|
||||
COPY linux/bunkerweb.service /usr/share/bunkerweb.service
|
||||
COPY linux/bunkerweb-ui.service /usr/share/bunkerweb-ui.service
|
||||
|
||||
# Generate RPM at startup
|
||||
# Generate DEB at startup
|
||||
VOLUME /data
|
||||
WORKDIR /opt
|
||||
ENTRYPOINT ["/opt/fpm.sh", "rpm"]
|
||||
WORKDIR /usr/share/
|
||||
ENTRYPOINT ["/usr/share/fpm.sh", "deb"]
|
|
@ -1,5 +1,6 @@
|
|||
FROM ubuntu:22.04
|
||||
|
||||
ENV OS=ubuntu
|
||||
ENV NGINX_VERSION 1.20.2
|
||||
|
||||
# Install fpm
|
||||
|
@ -8,7 +9,7 @@ RUN apt update && \
|
|||
gem install fpm
|
||||
|
||||
# Copy dependencies sources folder
|
||||
COPY deps /tmp/bunkerweb/deps
|
||||
COPY bw/deps /tmp/bunkerweb/deps
|
||||
|
||||
# Nginx
|
||||
RUN apt update && \
|
||||
|
@ -22,55 +23,62 @@ RUN apt update && \
|
|||
# Compile and install dependencies
|
||||
RUN apt update && \
|
||||
apt install --no-install-recommends bash python3-pip libssl-dev git libpcre++-dev zlib1g-dev libxml2-dev libyajl-dev pkgconf libcurl4-openssl-dev libgeoip-dev liblmdb-dev apt-utils bash build-essential autoconf libtool automake g++ gcc libxml2-dev make musl-dev gnupg patch libreadline-dev libpcre3-dev libgd-dev -y && \
|
||||
mkdir -p /opt/bunkerweb/deps && \
|
||||
mkdir -p /usr/share/bunkerweb/deps && \
|
||||
chmod +x /tmp/bunkerweb/deps/install.sh && \
|
||||
bash /tmp/bunkerweb/deps/install.sh && \
|
||||
mkdir /opt/bunkerweb/deps/python && \
|
||||
pip install --no-cache-dir --require-hashes --target /opt/bunkerweb/deps/python -r /tmp/bunkerweb/deps/requirements.txt
|
||||
mkdir /usr/share/bunkerweb/deps/python && \
|
||||
pip install --no-cache-dir --require-hashes --target /usr/share/bunkerweb/deps/python -r /tmp/bunkerweb/deps/requirements.txt
|
||||
|
||||
# Copy BW files
|
||||
# Copy files
|
||||
# can't exclude deps from . so we are copying everything by hand
|
||||
COPY api /opt/bunkerweb/api
|
||||
COPY cli /opt/bunkerweb/cli
|
||||
COPY confs /opt/bunkerweb/confs
|
||||
COPY core /opt/bunkerweb/core
|
||||
COPY gen /opt/bunkerweb/gen
|
||||
COPY helpers /opt/bunkerweb/helpers
|
||||
COPY job /opt/bunkerweb/job
|
||||
COPY lua /opt/bunkerweb/lua
|
||||
COPY misc /opt/bunkerweb/misc
|
||||
COPY utils /opt/bunkerweb/utils
|
||||
COPY ui /opt/bunkerweb/ui
|
||||
COPY settings.json /opt/bunkerweb/settings.json
|
||||
COPY VERSION /opt/bunkerweb/VERSION
|
||||
COPY bw/api /usr/share/bunkerweb/api
|
||||
COPY bw/core /usr/share/bunkerweb/core
|
||||
COPY bw/cli /usr/share/bunkerweb/cli
|
||||
COPY bw/helpers /usr/share/bunkerweb/helpers
|
||||
COPY bw/lua /usr/share/bunkerweb/lua
|
||||
COPY bw/misc /usr/share/bunkerweb/misc
|
||||
COPY bw/gen /usr/share/bunkerweb/gen
|
||||
COPY bw/settings.json etc/bunkerweb/settings.json
|
||||
COPY db /usr/share/bunkerweb/db
|
||||
COPY bw/confs /etc/bunkerweb/confs
|
||||
COPY bw/loading /usr/share/bunkerweb/loading
|
||||
COPY utils /usr/share/bunkerweb/utils
|
||||
COPY VERSION /usr/share/bunkerweb/VERSION
|
||||
COPY scheduler /usr/share/bunkerweb/scheduler
|
||||
COPY ui /usr/share/bunkerweb/ui
|
||||
|
||||
# Setup BW
|
||||
RUN cp /opt/bunkerweb/helpers/bwcli /usr/local/bin && \
|
||||
chmod 755 /usr/local/bin/bwcli && \
|
||||
mkdir /opt/bunkerweb/configs && \
|
||||
mkdir /opt/bunkerweb/cache && \
|
||||
mkdir /opt/bunkerweb/plugins && \
|
||||
mkdir /opt/bunkerweb/tmp && \
|
||||
mkdir /opt/bunkerweb/www && \
|
||||
find /opt/bunkerweb -path /opt/bunkerweb/deps -prune -o -type f -exec chmod 0740 {} \; && \
|
||||
find /opt/bunkerweb -path /opt/bunkerweb/deps -prune -o -type d -exec chmod 0750 {} \; && \
|
||||
chmod 770 /opt/bunkerweb/cache /opt/bunkerweb/tmp && \
|
||||
chmod 750 /opt/bunkerweb/gen/main.py /opt/bunkerweb/job/main.py /opt/bunkerweb/cli/main.py /opt/bunkerweb/helpers/*.sh /opt/bunkerweb/ui/main.py /opt/bunkerweb/www && \
|
||||
find /opt/bunkerweb/core/*/jobs/* -type f -exec chmod 750 {} \; && \
|
||||
pip install --no-cache-dir --target /opt/bunkerweb/deps/python -r /opt/bunkerweb/ui/requirements.txt && \
|
||||
chmod 755 /opt/bunkerweb
|
||||
RUN cp /usr/share/bunkerweb/helpers/bwcli /usr/bin/ && \
|
||||
chmod 755 /usr/bin/bwcli && \
|
||||
mkdir /etc/bunkerweb/configs && \
|
||||
mkdir /var/cache/bunkerweb/ && \
|
||||
mkdir /etc/bunkerweb/plugins && \
|
||||
mkdir /var/tmp/bunkerweb/ && \
|
||||
mkdir -p /var/www/html && \
|
||||
echo "Linux" > /usr/share/bunkerweb/INTEGRATION && \
|
||||
find /usr/share/bunkerweb -path /usr/share/bunkerweb/ui/deps -prune -o -type f -exec chmod 0740 {} \; && \
|
||||
find /usr/share/bunkerweb -path /usr/share/bunkerweb/ui/deps -prune -o -type d -exec chmod 0750 {} \; && \
|
||||
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ && \
|
||||
chmod 750 /usr/share/bunkerweb/gen/main.py /usr/share/bunkerweb/scheduler/main.py /usr/share/bunkerweb/cli/main.py /usr/share/bunkerweb/helpers/*.sh /usr/share/bunkerweb/ui/main.py /var/www/html && \
|
||||
find /usr/share/bunkerweb/core/*/jobs/* -type f -exec chmod 750 {} \; && \
|
||||
pip install --no-cache-dir --upgrade pip && \
|
||||
pip install wheel && \
|
||||
mkdir /usr/share/bunkerweb/ui/deps/python && \
|
||||
pip install --no-cache-dir --require-hashes --no-deps --target /usr/share/bunkerweb/deps/python -r /usr/share/bunkerweb/ui/deps/requirements.txt && \
|
||||
pip install --no-cache-dir gunicorn && \
|
||||
chmod 755 /usr/share/bunkerweb
|
||||
|
||||
# Copy Linux files
|
||||
COPY linux/variables.env /opt/bunkerweb/variables.env
|
||||
COPY linux/ui.env /opt/bunkerweb/ui.env
|
||||
COPY linux/scripts /opt/bunkerweb/scripts
|
||||
COPY linux/fpm.sh /opt/fpm.sh
|
||||
RUN chmod +x /opt/bunkerweb/scripts/*.sh /opt/fpm.sh
|
||||
COPY linux/fpm-ubuntu /opt/.fpm
|
||||
COPY linux/bunkerweb.service /opt/bunkerweb.service
|
||||
COPY linux/bunkerweb-ui.service /opt/bunkerweb-ui.service
|
||||
COPY linux/variables.env /etc/bunkerweb/variables.env
|
||||
COPY linux/ui.env /etc/bunkerweb/ui.env
|
||||
COPY linux/scripts /usr/share/bunkerweb/scripts
|
||||
COPY linux/fpm.sh /usr/share/fpm.sh
|
||||
RUN chmod +x /usr/share/bunkerweb/scripts/*.sh /usr/share/fpm.sh
|
||||
COPY linux/fpm-ubuntu /usr/share/.fpm
|
||||
COPY linux/bunkerweb.service /etc/systemd/system/bunkerweb.service
|
||||
COPY linux/bunkerweb-ui.service /etc/systemd/system/bunkerweb-ui.service
|
||||
|
||||
# Generate DEB at startup
|
||||
VOLUME /data
|
||||
WORKDIR /opt
|
||||
ENTRYPOINT ["/opt/fpm.sh", "deb"]
|
||||
WORKDIR /usr/share/
|
||||
ENTRYPOINT ["/usr/share/fpm.sh", "deb"]
|
||||
|
|
|
@ -7,9 +7,9 @@ After=network.target
|
|||
Restart=always
|
||||
StartLimitBurst=1
|
||||
User=nginx
|
||||
ExecStart=/opt/bunkerweb/scripts/bunkerweb-ui.sh start
|
||||
ExecStop=/opt/bunkerweb/scripts/bunkerweb-ui.sh stop
|
||||
ExecReload=/opt/bunkerweb/scripts/bunkerweb-ui.sh reload
|
||||
ExecStart=/usr/share/bunkerweb/scripts/bunkerweb-ui.sh start
|
||||
ExecStop=/usr/share/bunkerweb/scripts/bunkerweb-ui.sh stop
|
||||
ExecReload=/usr/share/bunkerweb/scripts/bunkerweb-ui.sh reload
|
||||
Type=simple
|
||||
StandardOutput=journal+console
|
||||
StandardError=journal+console
|
||||
|
|
|
@ -4,13 +4,11 @@ Documentation=https://docs.bunkerweb.io
|
|||
After=network.target
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
StartLimitIntervalSec=0
|
||||
User=root
|
||||
PIDFile=/opt/bunkerweb/tmp/scheduler.pid
|
||||
ExecStart=/opt/bunkerweb/scripts/start.sh start
|
||||
ExecStop=/opt/bunkerweb/scripts/start.sh stop
|
||||
ExecReload=/opt/bunkerweb/scripts/start.sh reload
|
||||
PIDFile=/var/tmp/bunkerweb/scheduler.pid
|
||||
ExecStart=/usr/share/bunkerweb/scripts/start.sh start
|
||||
ExecStop=/usr/share/bunkerweb/scripts/start.sh stop
|
||||
ExecReload=/usr/share/bunkerweb/scripts/start.sh reload
|
||||
Type=simple
|
||||
StandardOutput=journal+console
|
||||
StandardError=journal+console
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
--description "BunkerWeb %VERSION% for CentOS Stream 8"
|
||||
--url "https://www.bunkerweb.io"
|
||||
--maintainer "Bunkerity <contact at bunkerity dot com>"
|
||||
--after-install /opt/bunkerweb/scripts/postinstall.sh
|
||||
--before-remove /opt/bunkerweb/scripts/beforeRemove.sh
|
||||
--after-remove /opt/bunkerweb/scripts/afterRemove.sh
|
||||
/opt/bunkerweb/=/opt/bunkerweb/ bunkerweb.service=/etc/systemd/system/bunkerweb.service bunkerweb-ui.service=/etc/systemd/system/bunkerweb-ui.service /usr/local/bin/bwcli=/usr/local/bin/bwcli
|
||||
--after-install /usr/share/bunkerweb/scripts/postinstall.sh
|
||||
--before-remove /usr/share/bunkerweb/scripts/beforeRemove.sh
|
||||
--after-remove /usr/share/bunkerweb/scripts/afterRemove.sh
|
||||
/usr/share/bunkerweb/=/usr/share/bunkerweb/ /usr/bin/bwcli=/usr/bin/bwcli /etc/bunkerweb/=/etc/bunkerweb /var/tmp/bunkerweb/=/var/tmp/bunkerweb /var/cache/bunkerweb/=/var/cache/bunkerweb bunkerweb.service=/etc/systemd/system/bunkerweb.service bunkerweb-ui.service=/etc/systemd/system/bunkerweb-ui.service
|
|
@ -7,7 +7,7 @@
|
|||
--description "BunkerWeb %VERSION% for Debian 11"
|
||||
--url "https://www.bunkerweb.io"
|
||||
--maintainer "Bunkerity <contact at bunkerity dot com>"
|
||||
--after-install /opt/bunkerweb/scripts/postinstall.sh
|
||||
--before-remove /opt/bunkerweb/scripts/beforeRemove.sh
|
||||
--after-remove /opt/bunkerweb/scripts/afterRemove.sh
|
||||
/opt/bunkerweb/=/opt/bunkerweb/ bunkerweb.service=/etc/systemd/system/bunkerweb.service bunkerweb-ui.service=/etc/systemd/system/bunkerweb-ui.service /usr/local/bin/bwcli=/usr/local/bin/bwcli
|
||||
--after-install /usr/share/bunkerweb/scripts/postinstall.sh
|
||||
--before-remove /usr/share/bunkerweb/scripts/beforeRemove.sh
|
||||
--after-remove /usr/share/bunkerweb/scripts/afterRemove.sh
|
||||
/usr/share/bunkerweb/=/usr/share/bunkerweb/ /usr/bin/bwcli=/usr/bin/bwcli /etc/bunkerweb/=/etc/bunkerweb /var/tmp/bunkerweb/=/var/tmp/bunkerweb /var/cache/bunkerweb/=/var/cache/bunkerweb bunkerweb.service=/etc/systemd/system/bunkerweb.service bunkerweb-ui.service=/etc/systemd/system/bunkerweb-ui.service
|
|
@ -7,7 +7,7 @@
|
|||
--description "BunkerWeb %VERSION% for Fedora 36"
|
||||
--url "https://www.bunkerweb.io"
|
||||
--maintainer "Bunkerity <contact at bunkerity dot com>"
|
||||
--after-install /opt/bunkerweb/scripts/postinstall.sh
|
||||
--before-remove /opt/bunkerweb/scripts/beforeRemove.sh
|
||||
--after-remove /opt/bunkerweb/scripts/afterRemove.sh
|
||||
/opt/bunkerweb/=/opt/bunkerweb/ bunkerweb.service=/etc/systemd/system/bunkerweb.service bunkerweb-ui.service=/etc/systemd/system/bunkerweb-ui.service /usr/local/bin/bwcli=/usr/local/bin/bwcli
|
||||
--after-install /usr/share/bunkerweb/scripts/postinstall.sh
|
||||
--before-remove /usr/share/bunkerweb/scripts/beforeRemove.sh
|
||||
--after-remove /usr/share/bunkerweb/scripts/afterRemove.sh
|
||||
/usr/share/bunkerweb/=/usr/share/bunkerweb/ /usr/bin/bwcli=/usr/bin/bwcli /etc/bunkerweb/=/etc/bunkerweb /var/tmp/bunkerweb/=/var/tmp/bunkerweb /var/cache/bunkerweb/=/var/cache/bunkerweb bunkerweb.service=/etc/systemd/system/bunkerweb.service bunkerweb-ui.service=/etc/systemd/system/bunkerweb-ui.service
|
|
@ -2,12 +2,10 @@
|
|||
--name bunkerweb
|
||||
--license agpl3
|
||||
--version %VERSION%
|
||||
--architecture amd64
|
||||
--depends bash --depends python3 --depends python3-pip --depends 'nginx = 1.20.2-1~jammy' --depends libcurl4 --depends libgeoip-dev --depends libxml2 --depends libyajl2 --depends libmagic1 --depends net-tools --depends sudo
|
||||
--description "BunkerWeb %VERSION% for Ubuntu 22.04"
|
||||
--url "https://www.bunkerweb.io"
|
||||
--maintainer "Bunkerity <contact at bunkerity dot com>"
|
||||
--after-install /opt/bunkerweb/scripts/postinstall.sh
|
||||
--before-remove /opt/bunkerweb/scripts/beforeRemove.sh
|
||||
--after-remove /opt/bunkerweb/scripts/afterRemove.sh
|
||||
/opt/bunkerweb/=/opt/bunkerweb/ bunkerweb.service=/etc/systemd/system/bunkerweb.service bunkerweb-ui.service=/etc/systemd/system/bunkerweb-ui.service /usr/local/bin/bwcli=/usr/local/bin/bwcli
|
||||
--after-install /usr/share/bunkerweb/scripts/postinstall.sh
|
||||
--after-remove /usr/share/bunkerweb/scripts/afterRemove.sh
|
||||
/usr/share/bunkerweb/=/usr/share/bunkerweb/ /usr/bin/bwcli=/usr/bin/bwcli /etc/bunkerweb/=/etc/bunkerweb /var/tmp/bunkerweb/=/var/tmp/bunkerweb /var/cache/bunkerweb/=/var/cache/bunkerweb /etc/systemd/system/bunkerweb.service=/etc/systemd/system/bunkerweb.service /etc/systemd/system/bunkerweb-ui.service=/etc/systemd/system/bunkerweb-ui.service
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
VERSION="$(cat /opt/bunkerweb/VERSION | tr -d '\n')"
|
||||
VERSION="$(cat /usr/share/bunkerweb/VERSION | tr -d '\n')"
|
||||
sed -i "s/%VERSION%/${VERSION}/g" .fpm
|
||||
|
||||
fpm -t "$1" -p "/data/bunkerweb.$1"
|
|
@ -1,71 +1,137 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# A shell option that causes the shell to exit immediately if a command exits with a non-zero status.
|
||||
set -e
|
||||
# if directory /opt/bunkerweb/ exists then remove it
|
||||
if [ -d /opt/bunkerweb/ ]; then
|
||||
echo "Removing /opt/bunkerweb/ ..."
|
||||
rm -rf /opt/bunkerweb/
|
||||
echo "Done !"
|
||||
fi
|
||||
# if directory /etc/systemd/system/bunkerweb.service exists then remove it
|
||||
if [ -f /etc/systemd/system/bunkerweb.service ]; then
|
||||
echo "Removing /etc/systemd/system/bunkerweb.service ..."
|
||||
rm -f /etc/systemd/system/bunkerweb.service
|
||||
echo "Done !"
|
||||
fi
|
||||
# if directory /etc/systemd/system/bunkerweb-ui.service exists then remove it
|
||||
if [ -f /etc/systemd/system/bunkerweb-ui.service ]; then
|
||||
echo "Removing /etc/systemd/system/bunkerweb-ui.service ..."
|
||||
rm -f /etc/systemd/system/bunkerweb-ui.service
|
||||
echo "Done !"
|
||||
|
||||
function do_and_check_cmd() {
|
||||
if [ "$CHANGE_DIR" != "" ] ; then
|
||||
cd "$CHANGE_DIR"
|
||||
fi
|
||||
output=$("$@" 2>&1)
|
||||
ret="$?"
|
||||
if [ $ret -ne 0 ] ; then
|
||||
echo "❌ Error from command : $*"
|
||||
echo "$output"
|
||||
exit $ret
|
||||
fi
|
||||
#echo $output
|
||||
return 0
|
||||
}
|
||||
|
||||
# Check if we are root
|
||||
if [ $(id -u) -ne 0 ] ; then
|
||||
echo "❌ Run me as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Detect OS between Debian, Ubuntu, CentOS, Fedora
|
||||
if [ -f /etc/debian_version ]; then
|
||||
# Loop to erase all the files in /etc/nginx/
|
||||
for i in $( ls /etc/nginx/ ); do
|
||||
echo "Removing /etc/nginx/$i ..."
|
||||
rm -rf /etc/nginx/$i
|
||||
echo "Done !"
|
||||
done
|
||||
echo "If you want to reinstall nginx, please run the following command:"
|
||||
echo "sudo apt-get install nginx"
|
||||
elif [ -f /etc/centos-release ]; then
|
||||
# Loop to erase all the files in /etc/nginx/
|
||||
for i in $( ls /etc/nginx/ ); do
|
||||
echo "Removing /etc/nginx/$i ..."
|
||||
rm -rf /etc/nginx/$i
|
||||
echo "Done !"
|
||||
done
|
||||
echo "If you want to reinstall nginx, please run the following command:"
|
||||
echo "sudo yum install nginx"
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
# Loop to erase all the files in /etc/nginx/
|
||||
for i in $( ls /etc/nginx/ ); do
|
||||
echo "Removing /etc/nginx/$i ..."
|
||||
rm -rf /etc/nginx/$i
|
||||
echo "Done !"
|
||||
done
|
||||
echo "If you want to reinstall nginx, please run the following command:"
|
||||
echo "sudo dnf install nginx"
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# Loop to erase all the files in /etc/nginx/
|
||||
for i in $( ls /etc/nginx/ ); do
|
||||
echo "Removing /etc/nginx/$i ..."
|
||||
rm -rf /etc/nginx/$i
|
||||
echo "Done !"
|
||||
done
|
||||
echo "If you want to reinstall nginx, please run the following command:"
|
||||
echo "sudo apt-get install nginx"
|
||||
else
|
||||
echo "Your OS is not supported"
|
||||
exit 1
|
||||
# Detect OS
|
||||
OS=""
|
||||
if [ "$(grep Debian /etc/os-release)" != "" ] ; then
|
||||
OS="debian"
|
||||
elif [ "$(grep Ubuntu /etc/os-release)" != "" ] ; then
|
||||
OS="ubuntu"
|
||||
elif [ "$(grep CentOS /etc/os-release)" != "" ] ; then
|
||||
OS="centos"
|
||||
elif [ "$(grep Fedora /etc/os-release)" != "" ] ; then
|
||||
OS="fedora"
|
||||
fi
|
||||
|
||||
# if previous command was successful then restart systemd unit
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Restarting systemd ..."
|
||||
systemctl daemon-reload
|
||||
echo "Done !"
|
||||
fi
|
||||
if [ "$OS" = "" ] ; then
|
||||
echo "❌ Unsupported Operating System"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Stop nginx
|
||||
systemctl status nginx > /dev/null 2>&1
|
||||
if [ $? -eq 0 ] ; then
|
||||
echo "ℹ️ Stop nginx service"
|
||||
do_and_check_cmd systemctl stop nginx
|
||||
fi
|
||||
|
||||
# Reload old nginx.service file
|
||||
# echo "ℹ️ Restore old nginx service"
|
||||
# do_and_check_cmd mv /lib/systemd/system/nginx.service.bak /lib/systemd/system/nginx.service
|
||||
# do_and_check_cmd systemctl daemon-reload
|
||||
|
||||
# Remove UI service
|
||||
systemctl status bunkerweb-ui > /dev/null 2>&1
|
||||
if [ $? -eq 0 ] ; then
|
||||
echo "ℹ️ Stop bunkerweb-ui service"
|
||||
do_and_check_cmd systemctl stop bunkerweb-ui
|
||||
fi
|
||||
|
||||
# echo "ℹ️ Remove bunkerweb-ui service"
|
||||
if [ -f "/etc/systemd/system/bunkerweb-ui.service" ] ; then
|
||||
echo "ℹ️ Remove bunkerweb-ui service"
|
||||
do_and_check_cmd systemctl stop bunkerweb-ui
|
||||
do_and_check_cmd systemctl disable bunkerweb-ui
|
||||
do_and_check_cmd rm -f /etc/systemd/system/bunkerweb-ui.service
|
||||
do_and_check_cmd systemctl daemon-reload
|
||||
do_and_check_cmd systemctl reset-failed
|
||||
fi
|
||||
# do_and_check_cmd systemctl disable bunkerweb-ui
|
||||
# do_and_check_cmd rm -f /etc/systemd/system/bunkerweb-ui.service
|
||||
# do_and_check_cmd systemctl daemon-reload
|
||||
# do_and_check_cmd systemctl reset-failed
|
||||
# do_and_check_cmd sed -i "s@nginx ALL=(root:root) NOPASSWD: /usr/share/bunkerweb/ui/linux.sh@@" /etc/sudoers
|
||||
|
||||
# Remove /usr/share/bunkerweb
|
||||
if [ -e "/usr/share/bunkerweb" ] ; then
|
||||
echo "ℹ️ Remove /usr/share/bunkerweb"
|
||||
do_and_check_cmd rm -rf /usr/share/bunkerweb
|
||||
fi
|
||||
|
||||
# Remove /etc/bunkerweb
|
||||
if [ -e "/etc/bunkerweb" ] ; then
|
||||
echo "ℹ️ Remove /etc/bunkerweb"
|
||||
do_and_check_cmd rm -rf /etc/bunkerweb
|
||||
fi
|
||||
|
||||
# Remove /var/tmp/bunkerweb
|
||||
if [ -e "/var/tmp/bunkerweb" ] ; then
|
||||
echo "ℹ️ Remove /var/tmp/bunkerweb"
|
||||
do_and_check_cmd rm -rf /var/tmp/bunkerweb
|
||||
fi
|
||||
|
||||
# Remove /var/cache/bunkerweb
|
||||
if [ -e "/var/cache/bunkerweb" ] ; then
|
||||
echo "ℹ️ Remove /var/cache/bunkerweb"
|
||||
do_and_check_cmd rm -rf /var/cache/bunkerweb
|
||||
fi
|
||||
|
||||
# Remove /var/lib/bunkerweb
|
||||
if [ -e "/var/lib/bunkerweb" ] ; then
|
||||
echo "ℹ️ Remove /var/lib/bunkerweb"
|
||||
do_and_check_cmd rm -rf /var/lib/bunkerweb
|
||||
fi
|
||||
|
||||
# Remove /usr/bin/bwcli
|
||||
if [ -f "/usr/bin/bwcli" ] ; then
|
||||
echo "ℹ️ Remove /usr/bin/bwcli"
|
||||
do_and_check_cmd rm -f /usr/bin/bwcli
|
||||
fi
|
||||
|
||||
# Remove systemd service
|
||||
if [ -f "/etc/systemd/system/bunkerweb.service" ] ; then
|
||||
echo "ℹ️ Remove bunkerweb service"
|
||||
do_and_check_cmd systemctl stop bunkerweb
|
||||
do_and_check_cmd systemctl disable bunkerweb
|
||||
do_and_check_cmd rm -f /etc/systemd/system/bunkerweb.service
|
||||
do_and_check_cmd systemctl daemon-reload
|
||||
do_and_check_cmd systemctl reset-failed
|
||||
fi
|
||||
|
||||
# Uninstall nginx
|
||||
# if [ "$OS" = "debian" ] || [ "$OS" = "ubuntu" ] ; then
|
||||
# echo "ℹ️ Uninstall nginx"
|
||||
# do_and_check_cmd systemctl stop nginx
|
||||
# do_and_check_cmd apt remove nginx -y
|
||||
# echo "ℹ️ If you want to reinstall nginx, run the following command:"
|
||||
# echo "apt-get install nginx"
|
||||
# elif [ "$OS" = "centos" ] || [ "$OS" = "fedora" ] ; then
|
||||
# echo "ℹ️ Uninstall nginx"
|
||||
# do_and_check_cmd systemctl stop nginx
|
||||
# do_and_check_cmd yum remove nginx -y
|
||||
# echo "ℹ️ If you want to reinstall nginx, run the following command:"
|
||||
# echo "apt-get install nginx"
|
||||
# fi
|
||||
|
||||
# We're done
|
||||
echo "ℹ️ BunkerWeb successfully uninstalled"
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# A shell option that causes the shell to exit immediately if a command exits with a non-zero status.
|
||||
set -e
|
||||
# if directory /usr/bin/bunkerweb/ exists then remove it
|
||||
if [ -d /usr/bin/bunkerweb/ ]; then
|
||||
echo "Removing /opt/bunkerweb/ ..."
|
||||
rm -rf /usr/bin/bunkerweb/
|
||||
echo "Done !"
|
||||
fi
|
||||
# if directory /etc/systemd/system/bunkerweb.service exists then remove it
|
||||
if [ -f /etc/systemd/system/bunkerweb.service ]; then
|
||||
echo "Removing /etc/systemd/system/bunkerweb.service ..."
|
||||
rm -f /etc/systemd/system/bunkerweb.service
|
||||
echo "Done !"
|
||||
fi
|
||||
# if directory /etc/systemd/system/bunkerweb-ui.service exists then remove it
|
||||
if [ -f /etc/systemd/system/bunkerweb-ui.service ]; then
|
||||
echo "Removing /etc/systemd/system/bunkerweb-ui.service ..."
|
||||
rm -f /etc/systemd/system/bunkerweb-ui.service
|
||||
echo "Done !"
|
||||
fi
|
||||
|
||||
# Detect OS between Debian, Ubuntu, CentOS, Fedora
|
||||
if [ -f /etc/debian_version ]; then
|
||||
# Loop to erase all the files in /etc/nginx/
|
||||
for i in $( ls /etc/nginx/ ); do
|
||||
echo "Removing /etc/nginx/$i ..."
|
||||
rm -rf /etc/nginx/$i
|
||||
echo "Done !"
|
||||
done
|
||||
echo "If you want to reinstall nginx, please run the following command:"
|
||||
echo "sudo apt-get install nginx"
|
||||
elif [ -f /etc/centos-release ]; then
|
||||
# Loop to erase all the files in /etc/nginx/
|
||||
for i in $( ls /etc/nginx/ ); do
|
||||
echo "Removing /etc/nginx/$i ..."
|
||||
rm -rf /etc/nginx/$i
|
||||
echo "Done !"
|
||||
done
|
||||
echo "If you want to reinstall nginx, please run the following command:"
|
||||
echo "sudo yum install nginx"
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
# Loop to erase all the files in /etc/nginx/
|
||||
for i in $( ls /etc/nginx/ ); do
|
||||
echo "Removing /etc/nginx/$i ..."
|
||||
rm -rf /etc/nginx/$i
|
||||
echo "Done !"
|
||||
done
|
||||
echo "If you want to reinstall nginx, please run the following command:"
|
||||
echo "sudo dnf install nginx"
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# Loop to erase all the files in /etc/nginx/
|
||||
for i in $( ls /etc/nginx/ ); do
|
||||
echo "Removing /etc/nginx/$i ..."
|
||||
rm -rf /etc/nginx/$i
|
||||
echo "Done !"
|
||||
done
|
||||
echo "If you want to reinstall nginx, please run the following command:"
|
||||
echo "sudo apt-get install nginx"
|
||||
else
|
||||
echo "Your OS is not supported"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if previous command was successful then restart systemd unit
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Restarting systemd ..."
|
||||
systemctl daemon-reload
|
||||
echo "Done !"
|
||||
fi
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
# function to start the UI
|
||||
start_ui() {
|
||||
export PYTHONPATH=/opt/bunkerweb/deps/python/
|
||||
export PYTHONPATH=/usr/share/bunkerweb/deps/python/
|
||||
echo "Starting UI"
|
||||
set -a
|
||||
. /opt/bunkerweb/ui.env
|
||||
. /etc/bunkerweb/ui.env
|
||||
set +a
|
||||
export FLASK_APP=/opt/bunkerweb/ui/main.py
|
||||
export FLASK_APP=/usr/share/bunkerweb/ui/main.py
|
||||
python3 -m flask run --host=127.0.0.1 --port=7000
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ start_ui() {
|
|||
stop_ui(){
|
||||
echo "Stoping ui service ..."
|
||||
# Check if pid file exist and remove it if so
|
||||
PID_FILE_PATH="/opt/bunkerweb/tmp/ui.pid"
|
||||
PID_FILE_PATH="/var/tmp/bunkerweb/ui.pid"
|
||||
if [ -f "$PID_FILE_PATH" ];
|
||||
then
|
||||
var=$( cat $PID_FILE_PATH )
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
# Stop nginx if it's running and remove the old config file if it exists
|
||||
systemctl stop nginx
|
||||
|
||||
# Change the ownership of /opt/bunkerweb to nginx
|
||||
chown -R nginx:nginx /opt/bunkerweb
|
||||
# Change the ownership of /usr/share/bunkerweb to nginx
|
||||
chown -R nginx:nginx /usr/share/bunkerweb
|
||||
|
||||
# Change the ownership of bunkerweb.service to nginx
|
||||
chown nginx:nginx /etc/systemd/system/bunkerweb.service
|
||||
# chown nginx:nginx /etc/systemd/system/bunkerweb.service
|
||||
|
||||
# Start bunkerweb service as nginx user and enable it to start on boot
|
||||
systemctl enable bunkerweb
|
||||
|
|
|
@ -10,7 +10,7 @@ if [ "$1" = "purge" ]; then
|
|||
# purge bunkerweb
|
||||
sudo systemctl stop bunkerweb
|
||||
sudo systemctl disable bunkerweb
|
||||
sudo rm -rf /opt/bunkerweb/
|
||||
sudo rm -rf /usr/bin/bunkerweb/
|
||||
sudo rm -rf /etc/systemd/system/bunkerweb.service
|
||||
sudo rm -rf /etc/systemd/system/bunkerweb-ui.service
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
. /opt/bunkerweb/helpers/utils.sh
|
||||
. /usr/share/bunkerweb/helpers/utils.sh
|
||||
|
||||
#############################################################
|
||||
# Help #
|
||||
|
@ -18,7 +18,7 @@ function display_help()
|
|||
echo
|
||||
}
|
||||
|
||||
export PYTHONPATH=/opt/bunkerweb/deps/python/
|
||||
export PYTHONPATH=/usr/share/bunkerweb/deps/python/
|
||||
|
||||
# Add nginx to sudoers
|
||||
if [ ! -f /etc/sudoers.d/bunkerweb ]; then
|
||||
|
@ -31,110 +31,63 @@ fi
|
|||
#############################################################
|
||||
|
||||
function start() {
|
||||
#############################################
|
||||
# STEP1 #
|
||||
# Generate variables.env files to /tmp/ #
|
||||
#############################################
|
||||
log "ENTRYPOINT" "ℹ️" "Generate variables.env files to /tmp ..."
|
||||
cp /opt/bunkerweb/variables.env /tmp/variables.env
|
||||
result=$?
|
||||
if [ $result -ne 0 ];
|
||||
then
|
||||
log "ENTRYPOINT" "❌" "Your command exited with non-zero status $result"
|
||||
exit 1
|
||||
fi
|
||||
printf "\nTEMP_NGINX=yes" >> /tmp/variables.env
|
||||
|
||||
#############################################
|
||||
# STEP2 #
|
||||
# Generate first temporary config #
|
||||
#############################################
|
||||
log "ENTRYPOINT" "ℹ️" "Generate temporary config ..."
|
||||
/opt/bunkerweb/gen/main.py --settings /opt/bunkerweb/settings.json --templates /opt/bunkerweb/confs --output /etc/nginx --variables /tmp/variables.env
|
||||
result=$?
|
||||
if [ $result -ne 0 ];
|
||||
then
|
||||
log "ENTRYPOINT" "❌" "Your command exited with non-zero status $result"
|
||||
# Get the pid of nginx and put it in a file
|
||||
log "ENTRYPOINT" "ℹ️" "Getting nginx pid ..."
|
||||
nginx_pid=$(ps aux | grep nginx | awk '{print $2}')
|
||||
echo $nginx_pid > /var/tmp/bunkerweb/nginx.pid
|
||||
|
||||
ps -ef | grep nginx | grep -v grep | awk '{print $2}' > /var/tmp/bunkerweb/nginx.pid
|
||||
|
||||
if [ -f /var/tmp/bunkerweb/scheduler.pid ] ; then
|
||||
rm -f /var/tmp/bunkerweb/scheduler.pid
|
||||
fi
|
||||
|
||||
# setup and check /data folder
|
||||
/usr/share/bunkerweb/helpers/data.sh "ENTRYPOINT"
|
||||
|
||||
# trap SIGTERM and SIGINT
|
||||
function trap_exit() {
|
||||
log "ENTRYPOINT" "ℹ️ " "Catched stop operation"
|
||||
if [ -f "/var/tmp/bunkerweb/scheduler.pid" ] ; then
|
||||
log "ENTRYPOINT" "ℹ️ " "Stopping job scheduler ..."
|
||||
kill -s TERM "$(cat /var/rmp/bunkerweb/scheduler.pid)"
|
||||
fi
|
||||
}
|
||||
trap "trap_exit" TERM INT QUIT
|
||||
|
||||
# trap SIGHUP
|
||||
function trap_reload() {
|
||||
log "ENTRYPOINT" "ℹ️ " "Catched reload operation"
|
||||
/usr/share/bunkerweb/helpers/scheduler-restart.sh
|
||||
if [ $? -ne 0 ] ; then
|
||||
log "ENTRYPOINT" "ℹ️ " "Error while restarting scheduler"
|
||||
fi
|
||||
}
|
||||
trap "trap_reload" HUP
|
||||
|
||||
# Init database
|
||||
# generate "temp" config
|
||||
#get_env > "/tmp/variables.env"
|
||||
echo -e "IS_LOADING=yes\nSERVER_NAME=\nAPI_HTTP_PORT=${API_HTTP_PORT:-5000}\nAPI_SERVER_NAME=${API_SERVER_NAME:-bwapi}\nAPI_WHITELIST_IP=${API_WHITELIST_IP:-127.0.0.0/8}" > /tmp/variables.env
|
||||
/usr/share/bunkerweb/gen/save_config.py --variables /tmp/variables.env --init
|
||||
if [ "$?" -ne 0 ] ; then
|
||||
log "ENTRYPOINT" "❌" "Scheduler generator failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#############################################
|
||||
# STEP3 #
|
||||
# Execute nginx #
|
||||
#############################################
|
||||
log "ENTRYPOINT" "ℹ️" "Execute temporary BunkerWeb ..."
|
||||
nginx
|
||||
result=$?
|
||||
if [ $result -ne 0 ];
|
||||
then
|
||||
log "ENTRYPOINT" "❌" "Your command exited with non-zero status $result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#############################################
|
||||
# STEP4 #
|
||||
# Run jobs script #
|
||||
#############################################
|
||||
log "ENTRYPOINT" "ℹ️" "Run jobs once ..."
|
||||
/opt/bunkerweb/job/main.py --variables /opt/bunkerweb/variables.env --run
|
||||
result=$?
|
||||
if [ $result -ne 0 ];
|
||||
then
|
||||
log "ENTRYPOINT" "❌" "Your command exited with non-zero status $result"
|
||||
exit 1
|
||||
generate=yes
|
||||
if [ -f "/etc/nginx/variables.env" ] && grep -q "^IS_LOADING=no$" /etc/nginx/variables.env ; then
|
||||
log "ENTRYPOINT" "⚠️ " "Looks like BunkerWeb configuration is already generated, will not generate it again"
|
||||
generate=no
|
||||
fi
|
||||
|
||||
#############################################
|
||||
# STEP5 #
|
||||
# Quit nginx #
|
||||
#############################################
|
||||
log "ENTRYPOINT" "ℹ️" "Stop temporary BunkerWeb ..."
|
||||
nginx -s quit
|
||||
result=$?
|
||||
if [ $result -ne 0 ];
|
||||
then
|
||||
log "ENTRYPOINT" "❌" "Your command exited with non-zero status $result"
|
||||
exit 1
|
||||
fi
|
||||
# execute jobs
|
||||
log "ENTRYPOINT" "ℹ️ " "Executing scheduler ..."
|
||||
/usr/share/bunkerweb/scheduler/main.py --generate $generate
|
||||
|
||||
#############################################
|
||||
# STEP6 #
|
||||
# Generate final confs #
|
||||
#############################################
|
||||
log "ENTRYPOINT" "ℹ️" "Generate final config ..."
|
||||
/opt/bunkerweb/gen/main.py --settings /opt/bunkerweb/settings.json --templates /opt/bunkerweb/confs --output /etc/nginx --variables /opt/bunkerweb/variables.env
|
||||
result=$?
|
||||
if [ $result -ne 0 ];
|
||||
then
|
||||
log "ENTRYPOINT" "❌" "Your command exited with non-zero status $result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#############################################
|
||||
# STEP7 #
|
||||
# Run jobs infinite #
|
||||
#############################################
|
||||
log "ENTRYPOINT" "ℹ️" "Run jobs scheduler ..."
|
||||
/opt/bunkerweb/job/main.py --variables /etc/nginx/variables.env &
|
||||
result=$?
|
||||
if [ $result -ne 0 ];
|
||||
then
|
||||
log "ENTRYPOINT" "❌" "Your command exited with non-zero status $result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#############################################
|
||||
# STEP8 #
|
||||
# Start nginx #
|
||||
#############################################
|
||||
log "ENTRYPOINT" "ℹ️" "Start BunkerWeb ..."
|
||||
nginx -g "daemon off; user nginx;"
|
||||
result=$?
|
||||
if [ $result -ne 0 ];
|
||||
then
|
||||
log "ENTRYPOINT" "❌" "Your command exited with non-zero status $result"
|
||||
exit 1
|
||||
fi
|
||||
log "ENTRYPOINT" "ℹ️ " "Scheduler stopped"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function stop()
|
||||
|
@ -143,7 +96,7 @@ function stop()
|
|||
log "ENTRYPOINT" "ℹ️" "Stopping BunkerWeb service ..."
|
||||
|
||||
# Check if pid file exist and remove it if so
|
||||
PID_FILE_PATH="/opt/bunkerweb/tmp/scheduler.pid"
|
||||
PID_FILE_PATH="/var/rmp/bunkerweb/scheduler.pid"
|
||||
if [ -f "$PID_FILE_PATH" ];
|
||||
then
|
||||
var=$(cat "$PID_FILE_PATH")
|
||||
|
@ -182,7 +135,7 @@ function reload()
|
|||
log "ENTRYPOINT" "ℹ️" "Reloading BunkerWeb service ..."
|
||||
|
||||
# Check if pid file exist and remove it if so
|
||||
PID_FILE_PATH="/opt/bunkerweb/tmp/scheduler.pid"
|
||||
PID_FILE_PATH="/var/tmp/bunkerweb/scheduler.pid"
|
||||
if [ -f "$PID_FILE_PATH" ];
|
||||
then
|
||||
var=$(cat "$PID_FILE_PATH")
|
||||
|
@ -228,6 +181,6 @@ case $1 in
|
|||
;;
|
||||
*)
|
||||
echo "Invalid option!"
|
||||
echo "List of option available:"
|
||||
echo "List of options availables:"
|
||||
display_help
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue