Skip to content

Commit f37340e

Browse files
authored
Merge pull request #1 from nixielectra/2113
v2.11.3
2 parents 63d06da + 7bb5c4a commit f37340e

File tree

7 files changed

+129
-5
lines changed

7 files changed

+129
-5
lines changed

.github/workflows/docker.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build Docker Image
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
packages: write
10+
contents: read
11+
attestations: write
12+
id-token: write
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Build environment variable
17+
run: |
18+
echo "BUILD_IMAGE=nixielectra/nginx-proxy-manager" >> $GITHUB_ENV
19+
echo "BUILD_PLATFORM=linux/amd64,linux/arm64" >> $GITHUB_ENV
20+
echo "BUILD_VERSION=$(cat .version)" >> $GITHUB_ENV
21+
- name: BuildTag
22+
run: |
23+
echo "BUILD_TAG=-t ${BUILD_IMAGE}:${BUILD_VERSION} -t ${BUILD_IMAGE}:latest" >> $GITHUB_ENV
24+
- name: Set Docker credentials
25+
env:
26+
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
27+
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
28+
run: echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
- name: Buildx output variables
32+
run: |
33+
echo "BUILD_TAG=$BUILD_TAG"
34+
echo "BUILD_IMAGE=$BUILD_IMAGE"
35+
echo "BUILD_PLATFORM=$BUILD_PLATFORM"
36+
echo "BUILD_VERSION=$BUILD_VERSION"
37+
- name: Buildx Dockerfile
38+
run: |
39+
chmod -R 755 scripts
40+
./scripts/buildx-nixie

backend/internal/certificate.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,22 @@ function omissions() {
2929
const internalCertificate = {
3030

3131
allowedSslFiles: ['certificate', 'certificate_key', 'intermediate_certificate'],
32-
intervalTimeout: 1000 * 60 * 60, // 1 hour
32+
intervalTimeout: 86400 * 1000, // 1 day
3333
interval: null,
3434
intervalProcessing: false,
3535
renewBeforeExpirationBy: [30, 'days'],
3636

3737
initTimer: () => {
38-
logger.info('Let\'s Encrypt Renewal Timer initialized');
38+
let timerExecutedEvery = 1;
39+
if (typeof process.env.CERTIFICATE_RENEWAL_INTERVAL_IN_DAYS !== 'undefined') {
40+
internalCertificate.intervalTimeout = process.env.CERTIFICATE_RENEWAL_INTERVAL_IN_DAYS * 86400 * 1000;
41+
timerExecutedEvery = process.env.CERTIFICATE_RENEWAL_INTERVAL_IN_DAYS;
42+
}
43+
logger.info('Timer for certificates renewal will be executed every ' + timerExecutedEvery + ' day(s)');
3944
internalCertificate.interval = setInterval(internalCertificate.processExpiringHosts, internalCertificate.intervalTimeout);
4045
// And do this now as well
4146
internalCertificate.processExpiringHosts();
47+
logger.info('Let\'s Encrypt Renewal Timer initialized');
4248
},
4349

4450
/**

backend/internal/ip_ranges.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ const regIpV6 = /^(([\da-fA-F]+)?:)+\/\d+/;
1414

1515
const internalIpRanges = {
1616

17-
interval_timeout: 1000 * 60 * 60 * 6, // 6 hours
17+
interval_timeout: 1000 * 60 * 60 * 24, // 24 hours
1818
interval: null,
1919
interval_processing: false,
2020
iteration_count: 0,
2121

2222
initTimer: () => {
23+
let timerExecutedEvery = 24;
24+
if (typeof process.env.IPRANGE_RENEWAL_INTERVAL_IN_HOURS !== 'undefined') {
25+
internalIpRanges.interval_timeout = process.env.IPRANGE_RENEWAL_INTERVAL_IN_HOURS * 1000 * 60 * 60;
26+
timerExecutedEvery = process.env.IPRANGE_RENEWAL_INTERVAL_IN_HOURS;
27+
}
28+
logger.info('Timer for ipranges renewal will be executed every ' + timerExecutedEvery + ' hour(s)');
2329
logger.info('IP Ranges Renewal Timer initialized');
2430
internalIpRanges.interval = setInterval(internalIpRanges.fetch, internalIpRanges.interval_timeout);
2531
},

backend/templates/proxy_host.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ proxy_set_header Connection $http_connection;
2222
proxy_http_version 1.1;
2323
{% endif %}
2424

25-
access_log /data/logs/proxy-host-{{ id }}_access.log proxy;
26-
error_log /data/logs/proxy-host-{{ id }}_error.log warn;
25+
error_log /dev/null;
26+
access_log off;
2727

2828
{{ advanced_config }}
2929

docker/Dockerfile-nixie

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM jc21/nginx-proxy-manager:latest
2+
3+
EXPOSE 80 81 443
4+
5+
RUN rm -rf /app/internal/certificate.js /app/internal/ip_ranges.js /app/templates/proxy_host.conf
6+
COPY backend/internal/certificate.js /app/internal/certificate.js
7+
COPY backend/internal/ip_ranges.js /app/internal/ip_ranges.js
8+
COPY backend/templates/proxy_host.conf /app/templates/proxy_host.conf
9+
10+
WORKDIR /app
11+
12+
VOLUME [ "/data", "/etc/letsencrypt" ]
13+
ENTRYPOINT [ "/init" ]
14+
15+
LABEL org.label-schema.schema-version="1.0" \
16+
org.label-schema.license="MIT" \
17+
org.label-schema.name="nginx-proxy-manager" \
18+
org.label-schema.description="Docker container for managing Nginx proxy hosts with a simple, powerful interface " \
19+
org.label-schema.url="https://github.com/nixielectra/nginx-proxy-manager" \
20+
org.label-schema.vcs-url="https://github.com/nixielectra/nginx-proxy-manager.git" \
21+
org.label-schema.cmd="docker run --rm -ti nixielectra/nginx-proxy-manager:latest"

scripts/buildx-nixie

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4+
. "$DIR/ci/test-and-build-nixie"
5+
6+
cd "${DIR}/../.."
7+
8+
# Buildx Builder
9+
docker buildx create --name "Buildx-NPM" || echo
10+
docker buildx use "Buildx-NPM"
11+
12+
if [ "${BUILD_TAG:-0}" != 0 ]; then
13+
docker buildx build -f docker/Dockerfile-nixie $BUILD_TAG --platform $BUILD_PLATFORM . --push
14+
else
15+
docker buildx build -f docker/Dockerfile-nixie -t "nixielectra/nginx-proxy-manager:dev" --platform $BUILD_PLATFORM . --push
16+
fi
17+
18+
docker buildx rm "Buildx-NPM"
19+
20+
echo "Multiarch build Complete"

scripts/ci/test-and-build-nixie

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash -e
2+
3+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4+
. "$DIR/../.common.sh"
5+
6+
TESTING_IMAGE=nginxproxymanager/nginx-full:certbot-node
7+
docker pull "${TESTING_IMAGE}"
8+
9+
# Test
10+
echo -e "${BLUE}${CYAN}Testing backend ...${RESET}"
11+
docker run --rm \
12+
-v "$(pwd)/backend:/app" \
13+
-v "$(pwd)/global:/app/global" \
14+
-w /app \
15+
"${TESTING_IMAGE}" \
16+
sh -c 'yarn install && yarn eslint . && rm -rf node_modules'
17+
echo -e "${BLUE}${GREEN}Testing Complete${RESET}"
18+
19+
# Build
20+
echo -e "${BLUE}${CYAN}Building ...${RESET}"
21+
docker build --pull --no-cache --compress \
22+
-t "${IMAGE:-nginx-proxy-manager}:${BRANCH_LOWER:-unknown}-ci-${BUILD_NUMBER:-0000}" \
23+
-f docker/Dockerfile-nixie \
24+
--progress=plain \
25+
--build-arg TARGETPLATFORM=linux/amd64 \
26+
--build-arg BUILDPLATFORM=linux/amd64 \
27+
--build-arg BUILD_VERSION="${BUILD_VERSION:-unknown}" \
28+
--build-arg BUILD_COMMIT="${BUILD_COMMIT:-unknown}" \
29+
--build-arg BUILD_DATE="$(date '+%Y-%m-%d %T %Z')" \
30+
.
31+
echo -e "${BLUE}${GREEN}Building Complete${RESET}"

0 commit comments

Comments
 (0)