12 Commits

Author SHA1 Message Date
Shizun Ge
f1d4f43fc7 set CGO_ENABLED to 0 2023-06-25 22:58:30 -07:00
Shizun Ge
585e970906 Add CGO_ENABLED=1 to Dockerfile 2023-06-25 22:55:09 -07:00
Shizun Ge
88d068a452 rename workflow and deprecate ::set-output. 2023-06-24 23:40:55 -07:00
Shizun Ge
6cd395e190 Merge pull request #59 from shizunge/dependabot/go_modules/github.com/prometheus/client_golang-1.16.0
Bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0
2023-06-19 17:51:58 -07:00
dependabot[bot]
4e710699f4 Bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.15.1 to 1.16.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.15.1...v1.16.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-20 00:50:25 +00:00
Shizun Ge
49f9422525 Merge pull request #60 from shizunge/dependabot/github_actions/docker/build-push-action-4.1.1
Bump docker/build-push-action from 4.1.0 to 4.1.1
2023-06-19 17:49:37 -07:00
Shizun Ge
4513b84ec9 Merge pull request #61 from shizunge/dependabot/go_modules/github.com/oschwald/geoip2-golang-1.9.0
Bump github.com/oschwald/geoip2-golang from 1.8.0 to 1.9.0
2023-06-19 17:49:23 -07:00
Shizun Ge
595761d045 Merge pull request #62 from shizunge/dependabot/github_actions/docker/setup-buildx-action-2.7.0
Bump docker/setup-buildx-action from 2.6.0 to 2.7.0
2023-06-19 17:49:13 -07:00
dependabot[bot]
7f0cb911a1 Bump docker/setup-buildx-action from 2.6.0 to 2.7.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.6.0 to 2.7.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2.6.0...v2.7.0)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 08:58:24 +00:00
dependabot[bot]
5acaafb691 Bump github.com/oschwald/geoip2-golang from 1.8.0 to 1.9.0
Bumps [github.com/oschwald/geoip2-golang](https://github.com/oschwald/geoip2-golang) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/oschwald/geoip2-golang/releases)
- [Commits](https://github.com/oschwald/geoip2-golang/compare/v1.8.0...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/oschwald/geoip2-golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 08:58:22 +00:00
dependabot[bot]
613fbf8d61 Bump docker/build-push-action from 4.1.0 to 4.1.1
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 08:58:21 +00:00
Shizun Ge
ef8e1fc21b add faq section. describe how to bind to privileged ports in docker. 2023-06-15 23:28:18 -07:00
6 changed files with 29 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
name: Build docker image and push to docker hub on push
name: On push to main
on:
push:
@@ -21,14 +21,13 @@ jobs:
shell: bash
run: |
RELEASE_VERSION="dev-$(date +%s)"
echo "::set-output name=image_tag::${RELEASE_VERSION}"
echo "Action image_tag=${RELEASE_VERSION}"
echo "image_tag=${RELEASE_VERSION}" >> ${GITHUB_OUTPUT}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Install buildx
uses: docker/setup-buildx-action@v2.6.0
uses: docker/setup-buildx-action@v2.7.0
- name: Login to docker hub
uses: docker/login-action@v2.2.0
@@ -44,7 +43,7 @@ jobs:
password: ${{ github.token }}
- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
uses: docker/build-push-action@v4.1.0
uses: docker/build-push-action@v4.1.1
with:
platforms: ${{ env.PLATFORMS }}
push: true

View File

@@ -1,4 +1,4 @@
name: Build docker image and push to docker hub on release
name: On release
on:
release:
@@ -20,14 +20,13 @@ jobs:
shell: bash
run: |
RELEASE_VERSION=${GITHUB_REF#refs/*/}
echo "::set-output name=image_tag::${RELEASE_VERSION}"
echo "Action image_tag=${RELEASE_VERSION}"
echo "image_tag=${RELEASE_VERSION}" >> ${GITHUB_OUTPUT}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Install buildx
uses: docker/setup-buildx-action@v2.6.0
uses: docker/setup-buildx-action@v2.7.0
- name: Login to docker hub
uses: docker/login-action@v2.2.0
@@ -43,7 +42,7 @@ jobs:
password: ${{ github.token }}
- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
uses: docker/build-push-action@v4.1.0
uses: docker/build-push-action@v4.1.1
with:
platforms: ${{ env.PLATFORMS }}
push: true

View File

@@ -3,6 +3,7 @@ FROM golang AS build
RUN mkdir /endlessh
ADD . /endlessh
WORKDIR /endlessh
RUN export CGO_ENABLED=0
RUN go mod tidy
RUN go build -o endlessh .

View File

@@ -10,10 +10,9 @@ An example how to setup endlessh-go, Prometheus, and Grafana using [docker compo
An example how to setup endlessh-go with the Maxmind GeoIP Database.
### Using privileged ports (<1024) on docker
## FAQ
### Bind to privileged ports (<1024) in a container
If you want to run the image with privileged ports (below 1025), you need to set the container user to root:
You need to add capability `NET_BIND_SERVICE` to the program.
```yml
user: root
```
If you are using docker, this can be done via cli argument [`--cap-add`](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) or [`cap_add`](https://docs.docker.com/compose/compose-file/compose-file-v3/#cap_add-cap_drop) in the docker compose file.

10
go.mod
View File

@@ -4,9 +4,9 @@ go 1.20
require (
github.com/golang/glog v1.1.1
github.com/oschwald/geoip2-golang v1.8.0
github.com/oschwald/geoip2-golang v1.9.0
github.com/pierrre/geohash v1.1.0
github.com/prometheus/client_golang v1.15.1
github.com/prometheus/client_golang v1.16.0
)
require (
@@ -14,10 +14,10 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/oschwald/maxminddb-golang v1.10.0 // indirect
github.com/oschwald/maxminddb-golang v1.11.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
golang.org/x/sys v0.6.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
golang.org/x/sys v0.9.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
)

22
go.sum
View File

@@ -19,27 +19,27 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/mmcloughlin/geohash v0.10.0 h1:9w1HchfDfdeLc+jFEf/04D27KP7E2QmpDu52wPbJWRE=
github.com/oschwald/geoip2-golang v1.8.0 h1:KfjYB8ojCEn/QLqsDU0AzrJ3R5Qa9vFlx3z6SLNcKTs=
github.com/oschwald/geoip2-golang v1.8.0/go.mod h1:R7bRvYjOeaoenAp9sKRS8GX5bJWcZ0laWO5+DauEktw=
github.com/oschwald/maxminddb-golang v1.10.0 h1:Xp1u0ZhqkSuopaKmk1WwHtjF0H9Hd9181uj2MQ5Vndg=
github.com/oschwald/maxminddb-golang v1.10.0/go.mod h1:Y2ELenReaLAZ0b400URyGwvYxHV1dLIxBuyOsyYjHK0=
github.com/oschwald/geoip2-golang v1.9.0 h1:uvD3O6fXAXs+usU+UGExshpdP13GAqp4GBrzN7IgKZc=
github.com/oschwald/geoip2-golang v1.9.0/go.mod h1:BHK6TvDyATVQhKNbQBdrj9eAvuwOMi2zSFXizL3K81Y=
github.com/oschwald/maxminddb-golang v1.11.0 h1:aSXMqYR/EPNjGE8epgqwDay+P30hCBZIveY0WZbAWh0=
github.com/oschwald/maxminddb-golang v1.11.0/go.mod h1:YmVI+H0zh3ySFR3w+oz8PCfglAFj3PuCmui13+P9zDg=
github.com/pierrre/compare v1.1.0 h1:57z388tk9GXcyLnLXh1pMRdCQrfUH056x9dyNCCZZtg=
github.com/pierrre/geohash v1.1.0 h1:AeTekkssK2HV3le9vya4cVFIPMx60bVIHaTvC+/5vyc=
github.com/pierrre/geohash v1.1.0/go.mod h1:QQAU8mXr7WIhJJqL2uAvhJHrMeH/jLeETutCqY/fDeU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI=
github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8=
github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM=
github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc=
github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI=
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg=
github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/the42/cartconvert v0.0.0-20131203171324-aae784c392b8 h1:I4DY8wLxJXCrMYzDM6lKCGc3IQwJX0PlTLsd3nQqI3c=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=