From 34f7b11ecec254aee2cf9047ecaff3ce918c7deb Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Tue, 3 Oct 2023 23:36:52 +0530 Subject: [PATCH] feat: import from ForgeFlux/ftest/nginx --- .woodpecker.yml | 20 ++++++++++++++++++++ Dockerfile | 2 ++ README.md | 11 +++++++++++ init.sh | 9 +++++++++ nginx.conf | 14 ++++++++++++++ 5 files changed, 56 insertions(+) create mode 100644 .woodpecker.yml create mode 100644 Dockerfile create mode 100644 README.md create mode 100755 init.sh create mode 100644 nginx.conf diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..3a2a6cc --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,20 @@ +pipeline: + build_docker_img: + image: plugins/docker + when: + event: [pull_request] + settings: + dry_run: true + repo: forgeflux/ftest-nginx-proxy + tags: latest + + build_and_publish_docker_img: + image: plugins/docker + when: + event: [push, tag, deployment] + settings: + username: forgeflux + password: + from_secret: DOCKER_TOKEN + repo: forgeflux/ftest-nginx-proxy + tags: latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8163f46 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,2 @@ +FROM nginx +COPY ./nginx.conf /etc/nginx/conf.d/default.conf diff --git a/README.md b/README.md new file mode 100644 index 0000000..12652a3 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +[![status-badge](https://ci.batsense.net/api/badges/94/status.svg)](https://ci.batsense.net/repos/94) +--- + +ftest creates a Docker network called `ftest` and runs job containers on +it. Job containers upload results back to the ftest server. This should +work fine, when ftest server is running as a container and is part of +the container network. But when developing or when using the (WIP) CLI +tool, this isn't feasible. + +So this simple nginx proxy configuration exists to expose ftest server +running on port 29130 on host machine to the ftest network. diff --git a/init.sh b/init.sh new file mode 100755 index 0000000..1878eee --- /dev/null +++ b/init.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +docker run \ + -d \ + --name=ftest \ + -p 9080:9000 \ + --network=ftest \ + --add-host ftest_backend:`/sbin/ip route|awk '/default/ { print $9}'`\ + forgeflux/ftest-nginx diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..120a334 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,14 @@ +server { + listen 9000; + server_name ftest default_server; + + location / { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://ftest_backend:29130/; + proxy_set_header Host $http_host; + proxy_cache_bypass $http_upgrade; + proxy_redirect off; + } +}