generated from Templates/Baseline
Compare commits
1 Commits
61d0f2f412
...
fd646dccb5
Author | SHA1 | Date | |
---|---|---|---|
fd646dccb5 |
@ -1,26 +0,0 @@
|
|||||||
name: release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: setup go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '>=1.20.1'
|
|
||||||
- name: Use Go Action
|
|
||||||
id: use-go-action
|
|
||||||
uses: actions/release-action@main
|
|
||||||
with:
|
|
||||||
#files: -|
|
|
||||||
api_key: '${{ secrets.TOKEN }}'
|
|
||||||
#title:
|
|
||||||
#body:
|
|
29
.gitea/workflows/test.yaml
Normal file
29
.gitea/workflows/test.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
name: test
|
||||||
|
|
||||||
|
run-name: docker pipeline
|
||||||
|
|
||||||
|
on: [ 'push' ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: actions/setup-buildx-action@v2
|
||||||
|
#-
|
||||||
|
# name: Login to Gitea Package Registry
|
||||||
|
# uses: actions/login-action@v2
|
||||||
|
# with:
|
||||||
|
# registry: gitea.ocram85.com
|
||||||
|
# username: ${{ secrets.USERNAME }}
|
||||||
|
# password: ${{ secrets.TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: actions/build-push-action@v4
|
||||||
|
with:
|
||||||
|
push: false
|
||||||
|
#tags: gitea.ocram85.com/ocram85/swarmproxy:next
|
||||||
|
tags: ocram85/swarmproxy:test
|
49
Dockerfile
49
Dockerfile
@ -1,6 +1,6 @@
|
|||||||
FROM alpine:3.18.2
|
FROM alpine:3.18.2
|
||||||
|
|
||||||
# Set labels manually, each build service differs in used or predefined labels.
|
#LABEL build_version=""
|
||||||
LABEL maintainer="OCram85"
|
LABEL maintainer="OCram85"
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
LABEL build_version="${VERSION}"
|
LABEL build_version="${VERSION}"
|
||||||
@ -17,7 +17,8 @@ LABEL org.opencontainers.image.url="https://gitea.ocram85.com/OCram85/swarmproxy
|
|||||||
LABEL org.opencontainers.image.source="https://gitea.ocram85.com/OCram85/swarmproxy.git"
|
LABEL org.opencontainers.image.source="https://gitea.ocram85.com/OCram85/swarmproxy.git"
|
||||||
LABEL org.opencontainers.image.documentation="https://gitea.ocram85.com/OCram85/swarmproxy"
|
LABEL org.opencontainers.image.documentation="https://gitea.ocram85.com/OCram85/swarmproxy"
|
||||||
|
|
||||||
# Use a individual user and group ip for files and process
|
# Use a custom UID/GID instead of the default system UID which has a greater possibility
|
||||||
|
# for collisions with the host and other containers.
|
||||||
ENV TINYPROXY_UID 5123
|
ENV TINYPROXY_UID 5123
|
||||||
ENV TINYPROXY_GID 5123
|
ENV TINYPROXY_GID 5123
|
||||||
|
|
||||||
@ -27,24 +28,46 @@ ENV PORT "8888"
|
|||||||
ENV TIMEOUT "600"
|
ENV TIMEOUT "600"
|
||||||
ENV LOGLEVEL "Info"
|
ENV LOGLEVEL "Info"
|
||||||
ENV MAXCLIENTS "600"
|
ENV MAXCLIENTS "600"
|
||||||
ENV FILTER_FILE "/app/filter"
|
ENV FILTER_FILE "/etc/tinyproxy/filter"
|
||||||
|
|
||||||
|
# Curl is for healthchecks.
|
||||||
# get existing packages
|
|
||||||
# curl for healthchecks and debugging
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
tinyproxy curl
|
tinyproxy curl
|
||||||
|
|
||||||
COPY entrypoint.sh /app/entrypoint.sh
|
RUN mv /etc/tinyproxy/tinyproxy.conf /etc/tinyproxy/tinyproxy.default.conf
|
||||||
|
|
||||||
RUN touch /app/proxy.conf && \
|
RUN <<EOF cat >> /etc/tinyproxy/tinyproxy.conf
|
||||||
chmod +x /app/entrypoint.sh && \
|
User $TINYPROXY_UID
|
||||||
chown -R ${TINYPROXY_UID}:${TINYPROXY_GID} /app /etc/tinyproxy /var/log/tinyproxy
|
Group $TINYPROXY_GID
|
||||||
|
Port $PORT
|
||||||
|
Timeout $TIMEOUT
|
||||||
|
DefaultErrorFile "/usr/share/tinyproxy/default.html"
|
||||||
|
|
||||||
|
StatHost "tinyproxy.stats"
|
||||||
|
StatFile "/usr/share/tinyproxy/stats.html"
|
||||||
|
|
||||||
|
LogLevel $LOGLEVEL
|
||||||
|
MaxClients $MAXCLIENTS
|
||||||
|
ViaProxyName "tinyproxy"
|
||||||
|
|
||||||
|
Filter "$FILTER_FILE"
|
||||||
|
FilterURLs Off
|
||||||
|
FilterCaseSensitive Off
|
||||||
|
FilterDefaultDeny Yes
|
||||||
|
|
||||||
|
Allow 127.0.0.1/8
|
||||||
|
Allow 10.0.0.0/8
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
RUN set -eu && \
|
||||||
|
CONFIG='/etc/tinyproxy/tinyproxy.conf' && \
|
||||||
|
[ -z "$UPSTREAM_PROXY_FILE" ] || export UPSTREAM_PROXY=$(cat $UPSTREAM_PROXY_FILE) && \
|
||||||
|
[ -z "$UPSTREAM_PROXY" ] || echo "upstream http $UPSTREAM_PROXY \".\"" >> "$CONFIG"
|
||||||
|
|
||||||
|
RUN chown -R ${TINYPROXY_UID}:${TINYPROXY_GID} /etc/tinyproxy /var/log/tinyproxy
|
||||||
USER ${TINYPROXY_UID}:${TINYPROXY_GID}
|
USER ${TINYPROXY_UID}:${TINYPROXY_GID}
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
EXPOSE 8888
|
EXPOSE 8888
|
||||||
|
|
||||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
ENTRYPOINT ["/usr/bin/tinyproxy", "-d"]
|
||||||
CMD ["-c", "/app/proxy.conf", "-d"]
|
|
||||||
|
60
README.md
60
README.md
@ -13,7 +13,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h1 align="center">
|
<h1 align="center">
|
||||||
Swarmproxy - Tame your traffic
|
swarmproxy
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
@ -26,9 +26,10 @@
|
|||||||
|
|
||||||
### 1. ⚡ Get the image 📦
|
### 1. ⚡ Get the image 📦
|
||||||
|
|
||||||
You can download the image from the Gitea embedded container registry: `gitea.ocram85.com/ocram85/swarmproxy` with these tags:
|
You can download the image from the gitea embedded container registry: `gitea.ocram85.com/ocram85/swarmproxy` with these tags:
|
||||||
|
|
||||||
- `latest`, `main` - Is based on the lasted master branch commit.
|
- `latest` - Is based on the lasted master branch commit.
|
||||||
|
- `next` - Is a test build based on the pull request
|
||||||
- `1`, `0.1`, `0.1.0` - tag based version.
|
- `1`, `0.1`, `0.1.0` - tag based version.
|
||||||
|
|
||||||
> **💡 NOTE: See the [packages page](https://gitea.ocram85.com/OCram85/-/packages/container/swarmproxy/latest) for latest version and all other available tags.**
|
> **💡 NOTE: See the [packages page](https://gitea.ocram85.com/OCram85/-/packages/container/swarmproxy/latest) for latest version and all other available tags.**
|
||||||
@ -38,58 +39,43 @@ You can download the image from the Gitea embedded container registry: `gitea.oc
|
|||||||
```yaml
|
```yaml
|
||||||
version: "3.8"
|
version: "3.8"
|
||||||
|
|
||||||
networks:
|
secrets:
|
||||||
egress:
|
upstream-proxy:
|
||||||
attachable: true
|
external: true
|
||||||
#external: true
|
|
||||||
|
|
||||||
#configs:
|
|
||||||
# filter_file:
|
|
||||||
# # config can be predefined / external or loaded from file
|
|
||||||
# #external: true
|
|
||||||
# file: ./filter.txt
|
|
||||||
|
|
||||||
#secrets:
|
|
||||||
# upstream-proxy:
|
|
||||||
# external: true
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
swarmproxy:
|
swarmproxy:
|
||||||
image: gitea.ocram85.com/OCram85/swarmproxy:latest
|
image: gitea.ocram85.com/OCram85/swarmproxy:latest
|
||||||
deploy:
|
|
||||||
replicas: 1
|
|
||||||
#secrets:
|
|
||||||
# - upstream-proxy
|
|
||||||
environment:
|
environment:
|
||||||
# Recommended settings
|
# mandatory environment variables
|
||||||
# Use an optional upstream proxy
|
- UPSTREAM_PROXY=
|
||||||
#- UPSTREAM_PROXY=
|
|
||||||
# Set UPSTREAM_PROXY as docker secret if your upstream needs authentication
|
# Set UPSTREAM_PROXY as docker secret if your upstream needs authentication
|
||||||
# Eg.: http://user:password@upstream.intra:3128
|
# Eg.: http://user:password@upstream.intra:3128
|
||||||
#- UPSTREAM_PROXY_FILE=/run/secrets/UPSTREAM_PROXY
|
#- UPSTREAM_PROXY_FILE=/run/secrets/UPSTREAM_PROXY
|
||||||
|
|
||||||
# OPTIONAL config keys
|
# optional settings
|
||||||
#- TINYPROXY_UID=5123
|
#- TINYPROXY_UID=5123
|
||||||
#- TINYPROXY_GID=5123
|
#- TINYPROXY_GID=5123
|
||||||
#- PORT=8888
|
#- PORT=8888
|
||||||
#- TIMEOUT=600
|
#- TIMEOUT=600
|
||||||
#- LOGLEVEL=Info
|
#- LOGLEVEL=Info
|
||||||
#- MAXCLIENTS=600
|
#- MAXCLIENTS=600
|
||||||
#- FILTER_FILE=/app/filter
|
#- FILTER_FILE=/ety/tinyproxy/filter
|
||||||
|
deploy:
|
||||||
|
replicas: 1
|
||||||
volumes:
|
volumes:
|
||||||
# You can mount a single filter file into the container.
|
# mount a single file into the container if you need the modify it afterwards
|
||||||
# To reload the file use the docker kill -s USR1 <container_id| container_name> command.
|
# You can reload the file with `kill -s USR1 $(pidof tinyproxy)`
|
||||||
- ./filter.txt:/app/filter:ro
|
- ./filter.txt:/etc/tinyproxy/filter:ro
|
||||||
configs:
|
# Use a docker config or volume in production
|
||||||
- source: filter_file
|
-
|
||||||
target: /app/filter
|
networks:
|
||||||
|
- egress
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
egress:
|
egress:
|
||||||
aliases:
|
attachable: true
|
||||||
- swarmproxy
|
#external: true
|
||||||
- proxy
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 😡 We're Using GitHub Under Protest
|
## 😡 We're Using GitHub Under Protest
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
CONFIG="/app/proxy.conf"
|
|
||||||
|
|
||||||
function writeConfig() {
|
|
||||||
cat << EOF >> "$CONFIG"
|
|
||||||
User $TINYPROXY_UID
|
|
||||||
Group $TINYPROXY_GID
|
|
||||||
Port $PORT
|
|
||||||
Timeout $TIMEOUT
|
|
||||||
DefaultErrorFile "/usr/share/tinyproxy/default.html"
|
|
||||||
|
|
||||||
StatHost "tinyproxy.stats"
|
|
||||||
StatFile "/usr/share/tinyproxy/stats.html"
|
|
||||||
|
|
||||||
LogLevel $LOGLEVEL
|
|
||||||
MaxClients $MAXCLIENTS
|
|
||||||
ViaProxyName "Swarmproxy"
|
|
||||||
|
|
||||||
Allow 127.0.0.1/8
|
|
||||||
Allow 10.0.0.0/8
|
|
||||||
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
function addUpstreamConfig() {
|
|
||||||
[ -z "$UPSTREAM_PROXY_FILE" ] || export UPSTREAM_PROXY=$(cat $UPSTREAM_PROXY_FILE)
|
|
||||||
[ -z "$UPSTREAM_PROXY" ] || echo "upstream http $UPSTREAM_PROXY \".\"" >> "$CONFIG"
|
|
||||||
}
|
|
||||||
|
|
||||||
function addFilterConfig() {
|
|
||||||
if [ -f "$FILTER_FILE" ]; then
|
|
||||||
cat << FBLOCK >> "$CONFIG"
|
|
||||||
Filter "$FILTER_FILE"
|
|
||||||
FilterURLs Off
|
|
||||||
FilterCaseSensitive Off
|
|
||||||
FilterDefaultDeny Yes
|
|
||||||
FBLOCK
|
|
||||||
else
|
|
||||||
echo "🦁 FILTER_FILE not found or set."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function showConfig() {
|
|
||||||
echo "🦁 Final Swarmproxy config 🦁"
|
|
||||||
cat "$CONFIG"
|
|
||||||
}
|
|
||||||
|
|
||||||
function execTinyproxy() {
|
|
||||||
echo "🦁 Starting Tinyproxy..."
|
|
||||||
echo "args count: $#"
|
|
||||||
echo "args value: $@"
|
|
||||||
exec "/usr/bin/tinyproxy" "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
writeConfig
|
|
||||||
addUpstreamConfig
|
|
||||||
addFilterConfig
|
|
||||||
showConfig
|
|
||||||
execTinyproxy $@
|
|
||||||
}
|
|
||||||
|
|
||||||
main $@
|
|
||||||
echo "entrypoint end. 🚀"
|
|
Loading…
x
Reference in New Issue
Block a user