diff --git a/.github/workflows/docker-image-release.yml b/.github/workflows/docker-image-release.yml index cd11322..4d31c39 100644 --- a/.github/workflows/docker-image-release.yml +++ b/.github/workflows/docker-image-release.yml @@ -39,7 +39,7 @@ jobs: uses: docker/build-push-action@v4 with: context: . - file: ./Dockerfile.nginxsrc + file: ./Dockerfile platforms: linux/amd64,linux/arm64/v8 push: ${{ github.ref_type == 'tag' }} tags: ${{ steps.meta_flyingfish.outputs.tags }} diff --git a/Dockerfile b/Dockerfile index 196eb25..3e2ed06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,10 @@ FROM node:18-bullseye -ENV FLYINGFISH_NGINX_MODULE_MODE_DYN "1" +ENV FLYINGFISH_NGINX_MODULE_MODE_DYN "0" + +ARG NGINX_VERSION=1.22.1 +ARG HEADERS_MORE_VERSION=v0.34 +ARG NJS_BRANCH=0.8.0 RUN apt-get update -y RUN apt-get upgrade -y @@ -8,62 +12,184 @@ RUN apt-get install -y dublin-traceroute RUN apt-get install -y iputils-ping RUN apt-get install -y openssl RUN apt-get install -y curl gnupg2 ca-certificates lsb-release debian-archive-keyring -#RUN apk add --upgrade paris-traceroute - -RUN curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \ - | tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null - -RUN echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \ - http://nginx.org/packages/debian `lsb_release -cs` nginx" \ - | tee /etc/apt/sources.list.d/nginx.list +RUN apt install -y python3-pip python3-dev +RUN apt install -y git +RUN apt-get remove -y nginx nginx-common +RUN cd ~ && wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && tar -zxvf nginx-$NGINX_VERSION.tar.gz RUN apt update -y RUN apt-get upgrade -y -RUN apt install -y nginx nginx-module-njs nginx-module-njs-dbg +RUN apt-get install -y build-essential +RUN apt-get install -y libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev +RUN apt-get install -y mercurial +RUN cd ~ && \ + git clone --depth 1 --branch $NJS_BRANCH https://github.com/nginx/njs.git && \ + cd ~/njs && \ + ./configure && \ + make + +RUN cd ~ && \ + git clone --depth 1 -b $HEADERS_MORE_VERSION --single-branch https://github.com/openresty/headers-more-nginx-module.git \ + && cd ~/headers-more-nginx-module \ + && git submodule update --init + +RUN cd ~/nginx-$NGINX_VERSION && \ + ./configure \ + --sbin-path=/usr/bin/nginx \ + --conf-path=/etc/nginx/nginx.conf \ + --error-log-path=/var/log/nginx/error.log \ + --http-log-path=/var/log/nginx/access.log \ + --with-pcre \ + --pid-path=/var/run/nginx.pid \ + --with-compat \ + --with-file-aio \ + --with-threads \ + --with-http_addition_module \ + --with-http_auth_request_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_gunzip_module \ + --with-http_gzip_static_module \ + --with-http_mp4_module \ + --with-http_random_index_module \ + --with-http_realip_module \ + --with-http_slice_module \ + --with-http_ssl_module \ + --with-http_sub_module \ + --with-http_stub_status_module \ + --with-http_v2_module \ + --with-http_secure_link_module \ + --add-module=../njs/nginx \ + --add-module=../headers-more-nginx-module/ \ + --with-mail \ + --with-mail_ssl_module \ + --with-stream \ + --with-stream_realip_module \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --modules-path=/usr/lib/nginx/modules/ &&\ + make && \ + make install -RUN apt install -y python3-pip python3-dev -RUN apt install -y git RUN pip3 install pip --upgrade RUN pip3 install certbot-nginx RUN mkdir /etc/letsencrypt -RUN mkdir -p /opt/app -RUN mkdir -p /opt/app/frontend -RUN mkdir -p /opt/app/nginx -RUN mkdir -p /opt/app/nginx/body -RUN mkdir -p /opt/app/nginx/logs -RUN mkdir -p /opt/app/nginx/servers -RUN mkdir -p /opt/app/nginx/servers/logs -RUN mkdir -p /opt/app/nginx/html -RUN mkdir -p /var/log/flyingfish/ +# Init App dirs -------------------------------------------------------------------------------------------------------- +RUN mkdir -p /opt/flyingfish +RUN mkdir -p /opt/flyingfish/schemas +RUN mkdir -p /opt/flyingfish/core +RUN mkdir -p /opt/flyingfish/backend +RUN mkdir -p /opt/flyingfish/frontend +RUN mkdir -p /opt/flyingfish/nginx +RUN mkdir -p /opt/flyingfish/nginx/html +RUN mkdir -p /var/log/flyingfish RUN mkdir -p /var/lib/flyingfish -WORKDIR /opt/app +# Copy/Install Schemas ---------------------------------------------------------------------------------------------------- + +WORKDIR /opt/flyingfish/schemas + +COPY ./schemas/ ./ + +RUN rm -R node_modules | true +RUN rm -R dist | true +RUN rm package-lock.json | true + +RUN npm install +RUN npm run build + +# Copy/Install Core ---------------------------------------------------------------------------------------------------- + +WORKDIR /opt/flyingfish/core + +COPY ./core/ ./ + +RUN rm -R node_modules | true +RUN rm -R dist | true +RUN rm package-lock.json | true + +RUN npm install +RUN npm run build + +# Copy/Install DemoPlugin ---------------------------------------------------------------------------------------------- + +WORKDIR /opt/flyingfish/demoplugin -COPY core ./../core -COPY backend/dist ./dist -COPY backend/node_modules ./node_modules -COPY backend/package.json ./package.json +COPY ./demoplugin/ ./ -COPY frontend/assets ./frontend/assets -COPY frontend/images ./frontend/images -COPY frontend/dist ./frontend/dist -COPY frontend/src ./frontend/src -COPY frontend/index.html ./frontend/index.html -COPY frontend/login.html ./frontend/login.html -COPY frontend/manifest.json ./frontend/manifest.json -COPY frontend/package.json ./frontend/package.json +RUN rm -R node_modules | true +RUN rm -R dist | true +RUN rm package-lock.json | true -COPY nginx/dist ./nginx/dist -COPY nginx/node_modules ./nginx/node_modules -COPY nginx/pages ./nginx/pages -COPY nginx/htpasswd ./nginx/htpasswd -COPY nginx/package.json ./nginx/package.json +RUN npm install +RUN npm run build + +# Copy/Install Backend ------------------------------------------------------------------------------------------------- + +WORKDIR /opt/flyingfish/backend + +COPY backend ./ + +RUN rm -R node_modules | true +RUN rm -R dist | true +RUN rm package-lock.json | true + +RUN npm install +RUN npm run build + +# Copy/Install Frontend ------------------------------------------------------------------------------------------------ + +WORKDIR /opt/flyingfish/frontend + +COPY frontend ./ +RUN rm -R ./node_modules | true +RUN rm -R ./dist | true +RUN rm ./package-lock.json | true + +RUN npm install --force +RUN npm run gulp-clone-bambooo +RUN npm run gulp-copy-data +RUN npm run gulp-build-webpack + +# Copy/Install nginx --------------------------------------------------------------------------------------------------- + +WORKDIR /opt/flyingfish/nginx + +COPY nginx ./ +RUN rm -R ./node_modules | true +RUN rm -R ./dist | true +RUN rm -R ./logs | true +RUN rm -R ./body | true +RUN rm -R ./sample | true +RUN rm -R ./servers | true +RUN rm ./package-lock.json | true +RUN rm ./nginx.pid | true +RUN rm ./dhparam.pem | true +RUN rm nginx.conf | true + +RUN mkdir /opt/flyingfish/nginx/servers +RUN mkdir /opt/flyingfish/nginx/servers/proxy_temp +RUN chmod 700 /opt/flyingfish/nginx/servers/proxy_temp +RUN mkdir /opt/flyingfish/nginx/logs +RUN chmod 755 /opt/flyingfish/nginx/logs + +RUN npm install + +# add supervisor ------------------------------------------------------------------------------------------------------- + +WORKDIR /opt/flyingfish RUN npm install supervisor -g +# defaults ports ------------------------------------------------------------------------------------------------------- + EXPOSE 80 EXPOSE 443 EXPOSE 3000 -CMD [ "node", "dist/main.js", "--envargs=1"] \ No newline at end of file +# start main app ------------------------------------------------------------------------------------------------------- + +WORKDIR /opt/flyingfish + +CMD [ "node", "backend/dist/main.js", "--envargs=1"] \ No newline at end of file diff --git a/Dockerfile.nginxsrc b/Dockerfile.nginxsrc deleted file mode 100644 index 72704f3..0000000 --- a/Dockerfile.nginxsrc +++ /dev/null @@ -1,194 +0,0 @@ -FROM node:18-bullseye - -ENV FLYINGFISH_NGINX_MODULE_MODE_DYN "0" - -ARG NGINX_VERSION=1.22.1 -ARG HEADERS_MORE_VERSION=v0.34 - -RUN apt-get update -y -RUN apt-get upgrade -y -RUN apt-get install -y dublin-traceroute -RUN apt-get install -y iputils-ping -RUN apt-get install -y openssl -RUN apt-get install -y curl gnupg2 ca-certificates lsb-release debian-archive-keyring -RUN apt install -y python3-pip python3-dev -RUN apt install -y git - -RUN apt-get remove -y nginx nginx-common -RUN cd ~ && wget http://nginx.org/download/nginx-1.22.1.tar.gz && tar -zxvf nginx-1.22.1.tar.gz -RUN apt update -y -RUN apt-get upgrade -y -RUN apt-get install -y build-essential -RUN apt-get install -y libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev -RUN apt-get install -y mercurial -RUN cd ~ && \ - git clone --depth 1 --branch 0.7.9 https://github.com/nginx/njs.git && \ - cd ~/njs && \ - ./configure && \ - make - -RUN cd ~ && \ - git clone --depth 1 -b $HEADERS_MORE_VERSION --single-branch https://github.com/openresty/headers-more-nginx-module.git \ - && cd ~/headers-more-nginx-module \ - && git submodule update --init - -RUN cd ~/nginx-1.22.1 && \ - ./configure \ - --sbin-path=/usr/bin/nginx \ - --conf-path=/etc/nginx/nginx.conf \ - --error-log-path=/var/log/nginx/error.log \ - --http-log-path=/var/log/nginx/access.log \ - --with-pcre \ - --pid-path=/var/run/nginx.pid \ - --with-compat \ - --with-file-aio \ - --with-threads \ - --with-http_addition_module \ - --with-http_auth_request_module \ - --with-http_dav_module \ - --with-http_flv_module \ - --with-http_gunzip_module \ - --with-http_gzip_static_module \ - --with-http_mp4_module \ - --with-http_random_index_module \ - --with-http_realip_module \ - --with-http_slice_module \ - --with-http_ssl_module \ - --with-http_sub_module \ - --with-http_stub_status_module \ - --with-http_v2_module \ - --with-http_secure_link_module \ - --add-module=../njs/nginx \ - --add-module=../headers-more-nginx-module/ \ - --with-mail \ - --with-mail_ssl_module \ - --with-stream \ - --with-stream_realip_module \ - --with-stream_ssl_module \ - --with-stream_ssl_preread_module \ - --modules-path=/usr/lib/nginx/modules/ &&\ - make && \ - make install - -RUN pip3 install pip --upgrade -RUN pip3 install certbot-nginx -RUN mkdir /etc/letsencrypt - -# Init App dirs -------------------------------------------------------------------------------------------------------- -RUN mkdir -p /opt/flyingfish -RUN mkdir -p /opt/flyingfish/schemas -RUN mkdir -p /opt/flyingfish/core -RUN mkdir -p /opt/flyingfish/backend -RUN mkdir -p /opt/flyingfish/frontend -RUN mkdir -p /opt/flyingfish/nginx -RUN mkdir -p /opt/flyingfish/nginx/html -RUN mkdir -p /var/log/flyingfish -RUN mkdir -p /var/lib/flyingfish - -# Copy/Install Schemas ---------------------------------------------------------------------------------------------------- - -WORKDIR /opt/flyingfish/schemas - -COPY ./schemas/ ./ - -RUN rm -R node_modules | true -RUN rm -R dist | true -RUN rm package-lock.json | true - -RUN npm install -RUN npm run build - -# Copy/Install Core ---------------------------------------------------------------------------------------------------- - -WORKDIR /opt/flyingfish/core - -COPY ./core/ ./ - -RUN rm -R node_modules | true -RUN rm -R dist | true -RUN rm package-lock.json | true - -RUN npm install -RUN npm run build - -# Copy/Install DemoPlugin ---------------------------------------------------------------------------------------------- - -WORKDIR /opt/flyingfish/demoplugin - -COPY ./demoplugin/ ./ - -RUN rm -R node_modules | true -RUN rm -R dist | true -RUN rm package-lock.json | true - -RUN npm install -RUN npm run build - -# Copy/Install Backend ------------------------------------------------------------------------------------------------- - -WORKDIR /opt/flyingfish/backend - -COPY backend ./ - -RUN rm -R node_modules | true -RUN rm -R dist | true -RUN rm package-lock.json | true - -RUN npm install -RUN npm run build - -# Copy/Install Frontend ------------------------------------------------------------------------------------------------ - -WORKDIR /opt/flyingfish/frontend - -COPY frontend ./ -RUN rm -R ./node_modules | true -RUN rm -R ./dist | true -RUN rm ./package-lock.json | true - -RUN npm install --force -RUN npm run gulp-clone-bambooo -RUN npm run gulp-copy-data -RUN npm run gulp-build-webpack - -# Copy/Install nginx --------------------------------------------------------------------------------------------------- - -WORKDIR /opt/flyingfish/nginx - -COPY nginx ./ -RUN rm -R ./node_modules | true -RUN rm -R ./dist | true -RUN rm -R ./logs | true -RUN rm -R ./body | true -RUN rm -R ./sample | true -RUN rm -R ./servers | true -RUN rm ./package-lock.json | true -RUN rm ./nginx.pid | true -RUN rm ./dhparam.pem | true -RUN rm nginx.conf | true - -RUN mkdir /opt/flyingfish/nginx/servers -RUN mkdir /opt/flyingfish/nginx/servers/proxy_temp -RUN chmod 700 /opt/flyingfish/nginx/servers/proxy_temp -RUN mkdir /opt/flyingfish/nginx/logs -RUN chmod 755 /opt/flyingfish/nginx/logs - -RUN npm install - -# add supervisor ------------------------------------------------------------------------------------------------------- - -WORKDIR /opt/flyingfish - -RUN npm install supervisor -g - -# defaults ports ------------------------------------------------------------------------------------------------------- - -EXPOSE 80 -EXPOSE 443 -EXPOSE 3000 - -# start main app ------------------------------------------------------------------------------------------------------- - -WORKDIR /opt/flyingfish - -CMD [ "node", "backend/dist/main.js", "--envargs=1"] \ No newline at end of file diff --git a/backend/src/Routes/Main/UpnpNat/Delete.ts b/backend/src/Routes/Main/UpnpNat/Delete.ts index bf630d4..634aeea 100644 --- a/backend/src/Routes/Main/UpnpNat/Delete.ts +++ b/backend/src/Routes/Main/UpnpNat/Delete.ts @@ -1,4 +1,4 @@ -import {DBHelper, NatPortServiceDB} from 'flyingfish_core'; +import {NatPortServiceDB} from 'flyingfish_core'; import {DefaultReturn, StatusCodes, UpnpNatDeleteRequest} from 'flyingfish_schemas'; /** diff --git a/docker-compose.yml b/docker-compose.yml index 70c3e6e..37eb523 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -50,7 +50,7 @@ services: image: flyingfish:v1.2 build: context: ./ - dockerfile: Dockerfile.nginxsrc + dockerfile: Dockerfile container_name: flyingfish_service volumes: - ./nginx:/opt/flyingfish/nginx:rw diff --git a/frontend/node_modules/bambooo b/frontend/node_modules/bambooo deleted file mode 160000 index 942c7ef..0000000 --- a/frontend/node_modules/bambooo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 942c7ef62b858f782d720d6888b9333a0b0cc127