-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change from python webserver to abom-http
- Loading branch information
Showing
16 changed files
with
122 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.15.0 | ||
4.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
0 * * * * root gitaptly_update | ||
0 * * * * root /usr/share/gitaptly/update | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
package/usr/bin/gitaptly_create_release → package/usr/share/gitaptly/create_release
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/bin/bash | ||
set -e | ||
directory=$1 | ||
|
||
cd $directory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
set -e | ||
parallel rm -rf ::: /var/lib/gitaptly/dists/stable/Release /var/lib/gitaptly/dists/stable/main/binary-all/Packages.gz /var/lib/gitaptly/dists/stable/main/binary-all/Packages /var/lib/gitaptly/pool/main/* |
13 changes: 7 additions & 6 deletions
13
package/usr/bin/gitaptly_run_ftp → package/usr/share/gitaptly/run_ftp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
#!/bin/bash -e | ||
source /opt/gitaptly/env | ||
source /opt/gitaptly/bin/activate | ||
cmd=(python3 -m http.server --cgi --directory /var/lib/gitaptly $PORT) | ||
if [ -n "$OTLP_TRACES_ENDPOINT" ] || [ -n "$OTLP_METRICS_ENDPOINT" ]; then | ||
export OTEL_SERVICE_NAME="GitAptly" | ||
export OTEL_SERVICE_NAME=GitAptly | ||
export OTEL_LOGS_EXPORTER=otlp | ||
export OTEL_TRACES_EXPORTER=otlp | ||
export OTEL_METRICS_EXPORTER=otlp | ||
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf | ||
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="$OTLP_TRACES_ENDPOINT" | ||
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT="$OTLP_METRICS_ENDPOINT" | ||
export OTEL_EXPORTER_OTLP_TRACES_HEADERS=authorization=$(echo "$OTLP_TRACES_HEADER" | jq -Rr @uri) | ||
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT="$OTLP_METRICS_ENDPOINT" | ||
export OTEL_EXPORTER_OTLP_METRICS_HEADERS=authorization=$(echo "$OTLP_METRICS_HEADER" | jq -Rr @uri) | ||
cmd=(opentelemetry-instrument "${cmd[@]}") | ||
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT="$OTLP_LOGS_ENDPOINT" | ||
export OTEL_EXPORTER_OTLP_LOGS_HEADERS=authorization=$(echo "$OTLP_LOGS_HEADER" | jq -Rr @uri) | ||
export OTEL_SHELL_EXPERIMENTAL_OBSERVE_PIPES=TRUE | ||
fi | ||
exec "${cmd[@]}" | ||
abomhttp "$PORT" /var/lib/gitaptly |
10 changes: 6 additions & 4 deletions
10
package/usr/bin/gitaptly_scan → package/usr/share/gitaptly/scan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
#!/bin/bash -e | ||
#!/bin/bash | ||
set -e | ||
source /opt/gitaptly/env | ||
if [ -n "$GITHUB_API_TOKEN" ]; then | ||
auth_header="Authorization: Bearer $GITHUB_API_TOKEN" | ||
else | ||
auth_header='foo: bar' | ||
fi | ||
per_page=100 | ||
url="https://api.github.com/repos/$1/releases?per_page=$per_page" | ||
curl --no-progress-meter --fail --retry 16 --retry-all-errors --head -H "$auth_header" "$url" \ | ||
host=api.github.com | ||
path="/repos/$1/releases?per_page=$per_page" | ||
printf "HEAD $path HTTP/1.1\r\nConnection: close\r\nUser-Agent: gitaptly\r\nHost: $host\r\n$auth_header\r\n\r\n" | ncat --ssl --no-shutdown "$host" 443 \ | ||
| grep '^link: ' | cut -d ' ' -f 2- | tr -d ' <>' | tr ',' '\n' \ | ||
| grep 'rel="last"' | cut -d ';' -f1 | cut -d '?' -f 2- | tr '&' '\n' \ | ||
| grep '^page=' | cut -d = -f 2 \ | ||
| xargs seq 1 | xargs parallel -q curl --no-progress-meter --fail --retry 16 --retry-all-errors -H "$auth_header" "$url"\&page={} ::: \ | ||
| xargs seq 1 | xargs parallel -q curl --no-progress-meter --fail --retry 16 --retry-all-errors -H "$auth_header" https://"$host""$path"\&page={} ::: \ | ||
| jq '.[] | .assets[] | .browser_download_url' -r | (grep '.deb$' || true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
set -e | ||
method="$1" | ||
path="$2" | ||
|
||
if [ "$method" != GET ]; then | ||
printf 'HTTP/1.1 405 Method Forbidden\r\n\r\n' | ||
exit 0 | ||
fi | ||
|
||
file=$(echo "$path" | rev | cut -d/ -f1 | rev) | ||
repo=$(echo "$path" | rev | cut -d/ -f2 | rev) | ||
owner=$(echo "$path" | rev | cut -d/ -f3 | rev) | ||
|
||
# if [ -f /usr/bin/opentelemetry_shell.sh ]; then | ||
# span_handle="$(otel_span_current)" | ||
# otel_span_attribute $span_handle http.route=/$owner/$repo | ||
# otel_span_attribute $span_handle github.repository.owner=$owner | ||
# otel_span_attribute $span_handle github.repository.name=$repo | ||
# otel_span_attribute $span_handle github.repository.file=$file | ||
# metric_handle=$(otel_metric_create "gitaptly.downloads") | ||
# otel_metric_attribute $metric_handle github.repository.owner=$owner | ||
# otel_metric_attribute $metric_handle github.repository.repo=$repo | ||
# otel_metric_attribute $metric_handle github.repository.file=$file | ||
# otel_metric_add $metric_handle 1 | ||
# fi | ||
|
||
printf 'HTTP/1.1 200 OK\r\n' | ||
printf 'content-encoding: identity\r\n' | ||
printf 'content-type: application/vnd.debian.binary-package\r\n' | ||
printf '\r\n' | ||
bash /usr/share/gitaptly/scan $owner/$repo | grep "$file"'$' | head --lines=1 | xargs wget -O - | ||
|
||
# printf 'HTTP/1.1 308 Permanent Redirect\r\n' | ||
# printf 'location: ' && bash /usr/share/gitaptly/scan $owner/$repo | grep "$file"'$' | head --lines=1 && printf '\r\n' | ||
# printf '\r\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.